---
# System prepended metadata

title: Libs-API Meeting 2024-09-24
tags: [Minutes, Libs Meetings]

---

---
date: 2024-09-24
url: https://hackmd.io/L0cUH8d4SlKFSCwHrdcqJw
---

# Libs-API Meeting 2024-09-24

###### tags: `Libs Meetings` `Minutes`

**Meeting Link**: https://meet.jit.si/rust-libs-meeting-crxoz2at8hiccp7b3ixf89qgxfymlbwr
**Attendees**: Amanieu, David, JoshT, Mara, The 8472, Chris Denton, Urgau, TC

## Agenda

- Triage
- Anything else?

## Triage

### FCPs

29 rust-lang/rust T-libs-api FCPs

  - merge rust.tf/130698 *Tracking Issue for \`const\_make\_ascii\`* - (3 checkboxes left)
  - merge rust.tf/80437 *Tracking Issue for \`box\_into\_inner\`* - (1 checkboxes left)
  - merge rust.tf/67441 *Tracking issue for const \`Option\` functions* - (3 checkboxes left)
  - merge rust.tf/82814 *Tracking Issue for const \`Result\` methods* - (3 checkboxes left)
  - merge rust.tf/130660 *Tracking Issue for \`const\_char\_encode\_utf16\`* - (3 checkboxes left)
  - merge rust.tf/130538 *Stabilize const \`{slice,array}::from\_mut\`* - (3 checkboxes left)
  - merge rust.tf/106418 *Implement \`PartialOrd\` and \`Ord\` for \`Discriminant\`* - (2 checkboxes left)
  - merge rust.tf/123723 *Make \`std::os::darwin\` public* - (3 checkboxes left)
  - merge rust.tf/86918 *Tracking Issue for \`pin\_deref\_mut\`* - (3 checkboxes left)
  - merge rust.tf/120141 *Tracking Issue for enum access in offset\_of* - (6 checkboxes left)
  - merge rust.tf/129238 *Stabilize \`Ipv6Addr::is\_unique\_local\` and \`Ipv6Addr::is\_unicast\_link\_local\`* - (3 checkboxes left)
  - merge rust.tf/130086 *Tracking Issue for const\_str\_as\_mut* - (3 checkboxes left)
  - merge rust.tf/111735 *Tracking Issue for \`BufRead::skip\_until\`* - (3 checkboxes left)
  - merge rust.tf/130350 *stabilize Strict Provenance and Exposed Provenance APIs* - (3 checkboxes left)
  - merge rust.tf/111774 *Tracking Issue for \`slice\_first\_last\_chunk\` feature (\`slice::{split\_,}{first,last}\_chunk{,\_mut}\`)* - (3 checkboxes left)
  - merge rust.tf/111645 *Tracking Issue for \`UnsafeCell::from\_mut\`* - (3 checkboxes left)
  - merge rust.tf/83570 *Tracking Issue for \`#!\[feature(const\_slice\_first\_last)\]\`* - (3 checkboxes left)
  - merge rust.tf/101804 *Tracking Issue for \`feature(const\_slice\_split\_at\_mut)\`* - (3 checkboxes left)
  - merge rust.tf/91822 *Tracking Issue for \`const\_ptr\_as\_ref\`* - (3 checkboxes left)
  - merge rust.tf/72440 *Tracking Issue for constify\-ing non\-trait \`Duration\` methods* - (3 checkboxes left)
  - merge rust.tf/130191 *\[discussion\] \`ErrorKind::CrossesDevices\` from \`io\_error\_more\`* - (4 checkboxes left)
  - merge rust.tf/130190 *\[discussion\] \`ErrorKind::FilesystemQuotaExceeded\` from \`io\_error\_more\`* - (4 checkboxes left)
  - merge rust.tf/72505 *Tracking issue for \`#!\[feature(const\_float\_classify)\]\`* - (3 checkboxes left)
  - merge rust.tf/86722 *Tracking Issue for const\_maybe\_uninit\_assume\_init* - (3 checkboxes left)
  - merge rust.tf/88836 *Tracking Issue for \`#!\[feature(const\_unsafecell\_get\_mut)\]\`* - (3 checkboxes left)
  - merge rust.tf/91005 *Tracking Issue for \`str::from\_utf8\_unchecked\_mut\` as a \`const fn\`* - (3 checkboxes left)
  - merge rust.tf/130512 *Tracking Issue for \`const\_char\_encode\_utf8\`* - (3 checkboxes left)
  - merge rust.tf/67456 *Tracking issue for const slice::from\_raw\_parts* - (4 checkboxes left)
  - merge rust.tf/130518 *Stabilize the \`map\`/\`value\` methods on \`ControlFlow\`* - (3 checkboxes left)

[Amanieu (25)](https://rfcbot.rs/fcp/Amanieu), [pnkfelix (1)](https://rfcbot.rs/fcp/pnkfelix), [joshtriplett (27)](https://rfcbot.rs/fcp/joshtriplett), [m-ou-se (25)](https://rfcbot.rs/fcp/m-ou-se), [scottmcm (2)](https://rfcbot.rs/fcp/scottmcm), [dtolnay (1)](https://rfcbot.rs/fcp/dtolnay), [nikomatsakis (2)](https://rfcbot.rs/fcp/nikomatsakis), [BurntSushi (6)](https://rfcbot.rs/fcp/BurntSushi), [tmandry (1)](https://rfcbot.rs/fcp/tmandry)

### (nominated) rust.tf/libs67 *Replace \`feature(layout\_for\_ptr)\` with \`feature(layout\_for\_meta)\`*

JoshT: This is for wide pointers. The metadata is the part that makes them wide.

Amanieu: Does this support e.g. thin pointers to cstr?

JoshT: That doesn't directly seem related to me. 

Mara: It's a bit unclear if those are 'thin' or 'wide': it's more like a 'wide pointer' with a zero sized metadata..

The 8472: The new API doesn't take the pointer, only the metadata.. So that's not compatible with thin &CStr.

Mara: Oh, I already asked about this in a comment in May 2023. Didn't get an answer to it..

Amanieu: so, close? it doesn't work with thin-ish pointers like &CStr.

JoshT: Also missing specific motivation/justification.

Amanieu to reply.

### (nominated) rust.tf/libs92 *Add \`InProgress\` variant to \`io::ErrorKind\`*

JoshT:

```text!
~$ errno EINPROGRESS
EINPROGRESS 115 Operation now in progress
~$ errno EAGAIN
EAGAIN 11 Resource temporarily unavailable
```

JoshT: Different than EAGAIN, because this you shouldn't retry; it's already in progress and will be completed on its own.

Amanieu: For both, just stick it in epoll?

JoshT: For EINPROGRESS, you shouldn't run the call again when ready. very different than EAGAIN.

Mara: Other than EACCESS+EPERM, we only have 1:1 mappings for errno->ErrorKind on linux/unix. Wouldn't want to add more..

Mara: Adding a new errno to an existing ErrorKind is technically not semver compatible. Exisitng match arms for `ErrorKind::WouldBlock` would start executing for EINPROGRESS in a future version of Rust.

Amanieu: Alright, happy to accept this.

Amanieu: Note that windows sockets always return the 'would block' error, so it's somewhat inconsistent..

Chris, The 8472: Why make a ErrorKind if its only use is platform specific?

Amanieu: Happy to add errorkinds if it's useful to someone.

JoshT: I think it's valuable.

The 8472: No objections, but i don't think it's very valuable.

Mara: I think it's nicer to be able to write `WouldBlock | InProgress => ..` than something where you compare the code itself to `libc::INPROGRESS`.

Josh to reply.

### (nominated) rust.tf/libs246 *ACP: replace use of \`Pointee\` trait with a \`ptr::Metadata\` type*

Mara: This makes `from_raw_parts` safe, moving the invariant to `Metadata<T>` itself. This means that the validity of metadata cannot depend on the pointer itself.. Is that okay?

Mara: ptr::from_raw_parts is not unsafe today either..

David: `Metadata<str>` and `Metadata<[u8]>` is different. Today, both are `usize`. With this new API, you can no longer take the parts from one wide str pointer and use them for a wide slice ptr, etc.

Amanieu: We have the same for discriminants.

Mara: But we don't want that property here.

David: It's missing from this API. Incomplete.

David: What about `type Metadata<T> = <T as Pointee>::Metadata;`?

Amanieu: Listed in alternatives

Mara: It compares it to Discriminant. But i don't agree it should be similar. Unrelated.

David: Agree.

Amanieu: For discriminant, you don't want to be able to 'mess' with it. For metadata, you do want to be able to do that.

{brief tangent on messing with Discriminant values}

Amanieu: Looks like we're in agreement on Metadata, no wrapper type.

David: ACP author says it's unlikely to get stabilized soon following this route.

JoshT: more of an organisational issue. no champion driving this, and involves two teams.

David: Motivation for this ACP is to have something that can be stabilized sooner. Comes at a cost of making it worse even for current use cases.

Amanieu: Also happy with rejecting this entirely.

Mara: With the current state of things, i agree this is not the right direction. Might change if we know more about custom DSTs in the future.

### (nominated) rust.tf/libs257 *Implement \`From\<&'a &'static str\>\` for \`Arguments\<'a\>\`*

Mara: Something better is likely to come along (e.g. `From<&'static str>`), but might take months/years.. But I think it's fine to wait for that.

David: Agree.

JoshT: +1

The 8472: We could make this public as unstable, by making it a method..

Mara: It already exists as method, we use it in the standard library. We could make that pub+unstable.

Amanieu: Then we can gauge how much interest there is.

Mara to reply.

### (nominated) rust.tf/97601 *Tracking Issue for map\_many\_mut*

This is for HashMap. We also have this as unstable for slices.

JoshT: For slices, out of bounds is a logic error (panic), but not finding something in a hashmap shouldn't be a panic.

Amanieu: It'd get too complicated if it can handle finding some but not all.

JoshT: Agreed. Hard to imagine code that needs that.

JoshT: Panic on duplicate keys. But doing that check first is annoying. If someone might duplicate the check then we shouldn't panic.

Mara: So an enum with three states?

The 8472: Result::Err with two possible errors?

JoshT: `Option::None` makes sense for not found.

TC: If you do want a slice of options... what would you do?

Amanieu: You can't do that. Can't think of cases where you want that.

TC: I have wanted to look up multiple (few) items at once and get Options to them.

Mara: Almost feels like get_many_mut and get_few_mut would be slightly different use cases? (hardcoded two/three items, vs a dynamic list.)

Amanieu: Most cases will be two items.

The 8472: Example is swap.

Amanieu: We are 10 minutes over time. Let's table this for next time.

```rust!
pub fn get_many_mut<Q: ?Sized, const N: usize>(
    &mut self,
    ks: [&Q; N]
) -> Option<[&'_ mut V; N]>
where
    K: Borrow<Q>,
    Q: Hash + Eq;

pub unsafe fn get_many_unchecked_mut<Q: ?Sized, const N: usize>(
    &mut self,
    ks: [&Q; N],
) -> Option<[&'_ mut V; N]>
where
    K: Borrow<Q>,
    Q: Hash + Eq;
```

Return values:

1. `Option<[&mut V; N]>` (return `None` for missing keys or overlapping keys) (currently implemented)
2. `Result<Option<[&mut V; N]>, GetManyMutError>` (return `Ok(None)` for missing keys, `Err` for overlapping keys)
3. `Option<[&mut V; N]>` (return `None` for missing keys, panic on overlapping keys)
4. `Result<[&mut V; N], GetManyMutError>` (different error variants for missing vs overlapping)
5. `Result<[Option<&mut V>; N], GetManyMutError>` (error only for duplicate keys)
6. `Option<[Option<&mut V>; N]>` (outer None for duplicate keys)
7. `[Option<&mut V>; N]` (with panic for duplicates)
8. `[Option<&mut V>; N]` with None for second+ duplicate

Preferences (favorite first)

- David: 7 or 5 (and add `transpose`), 8, 4, 3, 6, 1, 2
- Amanieu: 1, 4
- Josh: 7 > 5 > 6 > 2 > 1 > `*`, + add `transpose` method
- TC: 7 > 5 > 6 > 8 > `*`, + add `transpose` method
- The 8472: 5 > 6

Add `transpose` similar to https://doc.rust-lang.org/nightly/std/primitive.array.html#method.transpose

```rust
impl<T, const N: usize> [Option<T>; N] {
    fn transpose(self) -> Option<[T; N]>;
}
```

Josh: `let [Some(v1), Some(v2)] = map.get_many_mut([k1, k2])? else { ... }`

```rust
impl<K, V> HashMap<K, V> {
    fn get_many_mut<'a, Q>(
        &'a mut self,
        indices: &[&Q],
        out: &mut [Option<&'a mut V>],
    )
    where
        K: Borrow<Q>;
}

let mut values = [const { None }; 3];
hashmap.get_many_mut(&[&3, &2, &1], &mut values);
```

Slice API:

```rust!
impl [T] {
    pub unsafe fn get_many_unchecked_mut<const N: usize>(&mut self, indices: [usize; N]) -> [&mut T; N];
    pub fn get_many_mut<const N: usize>(&mut self, indices: [usize; N]) -> Result<[&mut T; N], GetManyMutError<N>>;
}

pub struct GetManyMutError<const N: usize> { /* private */ }
```

|                          | Out of bounds | Duplicate |
|--------------------------|---------------|-----------|
| index_many_mut           | panic         | panic     |
| index_many_mut_unchecked | UB            | UB        |
| index_many_mut_checked   | panic         | `Err(..)` |
| get_many_mut             | `[None, ..]`  | panic     |
| get_many_mut_unchecked   | `[None, ..]`  | UB        |
| get_many_mut_checked     | `[None, ..]`  | `Err(..)` |

### (nominated) rust.tf/130538 *Stabilize const \`{slice,array}::from\_mut\`*

FCP started

### (nominated) rust.tf/130608 *Implemented \`FromStr\`/\`TryInto\<String\>\` for \`CString\`*

FCP started

### (waiting on team) rust.tf/107122 *Use \`Try\` trait to make \`Once\[Cell | Lock\]::get\_or\_try\_init\` generic over return type*

Nominated try_trait_v2 for next week.

Move forward with PR.

Amanieu to reply.

### (waiting on team) rust.tf/119550 *Rename \`AsyncIterator\` back to \`Stream\`, introduce an AFIT\-based \`AsyncIterator\` trait*

### (waiting on team) rust.tf/130136 *Partially stabilize const\_pin*

### (waiting on team) rust.tf/130229 *ptr::add/sub: do not claim equivalence with \`offset(c as isize)\`*

### (waiting on team) rust.tf/130518 *Stabilize the \`map\`/\`value\` methods on \`ControlFlow\`*



### (new change proposal) rust.tf/libs446 *Add \`File\` constructors that nudge people toward buffered I/O*

### (new change proposal) rust.tf/libs438 *ACP: \`ForwardInit\<'a, T\>\` to complement \`MaybeUninit\<T\>\`*

### (new change proposal) rust.tf/libs420 *Add basic tempfile API to stdlib*

### (new change proposal) rust.tf/libs406 *Make \`proc\_macro\` available outside procedural macro generation*

### (new change proposal) rust.tf/libs403 *Add \`RawStatusCode\`*

### (new change proposal) rust.tf/libs398 *Make \`core::str::from\_utf8\*\` methods available on the \`str\` type*

### (new change proposal) rust.tf/libs397 *ACP: Add \`prev\_power\_of\_two\` and \`bit\_width\` methods for unsigned integers and \`NonZero\<uN\>\`*

### (new change proposal) rust.tf/libs395 *\`impl core::str::Pattern for \[&str; N\]\`*

### (new change proposal) rust.tf/libs394 *Simple seedable insecure random number generation, stable across Rust versions*

### (new change proposal) rust.tf/libs388 *Extend std::fs::Permissions on Windows*


### (stalled change proposal) rust.tf/libs148 *Expose raw std{in,out,err}*

### (stalled change proposal) rust.tf/libs176 *\`Peek\` trait for peekable iterators*

### (stalled change proposal) rust.tf/libs205 *Expose the internal \`SimpleMessage\` struct and allow creating \`std::io::Error\`s with them*

### (stalled change proposal) rust.tf/libs111 *Restructure ptr\_metadata to minimal support*

### (stalled change proposal) rust.tf/libs332 *Implement ExactSizeIterator for Flatten\<option::IntoIter\<I\>\>*

### (stalled change proposal) rust.tf/libs322 *\`AssertThreadSafe\` (name TBD) – a more general API for lifting conservative \`!Send\` or \`!Sync\` implementations*

### (stalled change proposal) rust.tf/libs333 *\`NonNull::{from\_ref, from\_mut}\`*

### (stalled change proposal) rust.tf/libs314 *Add security\_attributes() to windows::OpenOptionsExt*

### (stalled change proposal) rust.tf/libs264 *Ability to stop child process from Inheriting Handles*

### (stalled change proposal) rust.tf/libs292 *Add an \`unsafe fn\` for creating a ZST*


_Generated by [fully-automatic-rust-libs-team-triage-meeting-agenda-generator](https://github.com/rust-lang/libs-team/tree/main/tools/agenda-generator)_
