# Libs-API Meeting 2023-10-24
###### tags: `Libs Meetings` `Minutes`
**Meeting Link**: https://meet.jit.si/rust-libs-meeting-crxoz2at8hiccp7b3ixf89qgxfymlbwr
**Attendees**: David, Amanieu, Josh, The 8472, Chris Denton, Urgau
## Agenda
- Triage
- Anything else?
## Triage
### FCPs
20 rust-lang/rust T-libs-api FCPs
- merge rust.tf/80437 *Tracking Issue for \`box\_into\_inner\`* - (1 checkboxes left)
- merge rust.tf/52331 *Correcting Path::components on Redox* - (5 checkboxes left)
- merge rust.tf/82901 *Tracking Issue for \`Option::get\_or\_insert\_default\`* - (2 checkboxes left)
- merge rust.tf/83871 *Tracking Issue for CharIndices::offset function* - (3 checkboxes left)
- merge rust.tf/99262 *Tracking Issue for \`io\_error\_downcast\`* - (4 checkboxes left)
- merge rust.tf/106655 *Tracking Issue for \`#!\[feature(offset\_of)\]\`* - (0 checkboxes left)
- merge rust.tf/62726 *Tracking issue for io\_slice\_advance* - (3 checkboxes left)
- merge rust.tf/111922 *feat: implement \`DoubleEndedSearcher\` for \`CharArray\[Ref\]Searcher\`* - (3 checkboxes left)
- merge rust.tf/80552 *Tracking Issue for the GroupBy and GroupByMut iterators* - (3 checkboxes left)
- merge rust.tf/114986 *FCP process: Require 2/3 majority for FCP* - (2 checkboxes left)
- merge rust.tf/106418 *Implement \`PartialOrd\` and \`Ord\` for \`Discriminant\`* - (1 checkboxes left)
- merge rust.tf/76118 *Tracking Issue for \`array\_methods\`* - (3 checkboxes left)
- merge rust.tf/109402 *Implement owned ops for \`HashSet\` and \`BTreeSet\`* - (4 checkboxes left)
- merge rust.tf/116113 * Generalize \`{Rc,Arc}::make\_mut()\` to unsized types.* - (4 checkboxes left)
- merge rust.tf/113833 *\`std::error::Error\` \-\> Trait Implementations: lifetimes consistency improvement* - (3 checkboxes left)
- merge rust.tf/116218 *Stabilize \`const\_maybe\_uninit\_zeroed\` and \`const\_mem\_zeroed\`* - (5 checkboxes left)
- merge rust.tf/115974 *Split core's PanicInfo and std's PanicInfo* - (3 checkboxes left)
- merge rust.tf/101288 *Tracking Issue for \`{char, u8}::is\_ascii\_octdigit\`* - (3 checkboxes left)
- merge rust.tf/101196 *Tracking Issue for \`Ready::into\_inner()\`* - (3 checkboxes left)
- merge rust.tf/116570 *Handle out of memory errors in io:Read::read\_to\_end()* - (2 checkboxes left)
[yaahc (3)](https://rfcbot.rs/fcp/yaahc), [dtolnay (4)](https://rfcbot.rs/fcp/dtolnay), [m-ou-se (14)](https://rfcbot.rs/fcp/m-ou-se), [Amanieu (14)](https://rfcbot.rs/fcp/Amanieu), [pnkfelix (2)](https://rfcbot.rs/fcp/pnkfelix), [joshtriplett (11)](https://rfcbot.rs/fcp/joshtriplett), [nikomatsakis (2)](https://rfcbot.rs/fcp/nikomatsakis), [BurntSushi (7)](https://rfcbot.rs/fcp/BurntSushi)
### (nominated) rust.tf/96979 *Override \`Waker::clone\_from\` to avoid cloning \`Waker\`s unnecessarily*
- Last time: ensure async working group has seen this
- They have no objections
- Ready for FCP
- 8472: technically no need for FCP because clone_from is already an existing API under Clone trait
- Amanieu: observable change
- Amanieu: none of us in this team understand the implications of this very well; FCP would be the cautious approach but we don't need it
- Amanieu to respond; unnominate and ready for review by Jubilee
### (nominated) rust.tf/116129 *Rewrite \`pin\` module documentation to clarify usage and invariants*
Unnominating. Waiting on review by Amanieu.
### (nominated) rust.tf/116714 *Derive \`Ord\`, \`PartialOrd\` and \`Hash\` for \`SocketAddr\*\`*
- Amanieu: this is clearly a bugfix because PartialOrd (et al?) were ignoring some fields
- Amanieu: looks good to merge
- Josh to review
### (nominated) rust.tf/117039 *Clarify UB in \`get\_unchecked(\_mut)\`*
- 8472: under the hood this is an `offset` operation so the requirements of that all apply, although this is not called out adequately as safety requirement in the documentation
- 8472: for the safety requirement, better to match what we do for references or match what we do for pointer offsets?
- Amanieu: in favor of making this clarification to make this UB
- Amanieu: we can add a debug-only check that catches this, like we have in several other methods
- If someone needs the opposite behavior without UB: `.as_ptr().offset(...)`
- Amanieu to start FCP
### (waiting on team) rust.tf/116118 *Implement \`Try\` for \`()\`*
- Discussed last week, not in favor
- Last week: "To close next week", giving author a chance to reply but they haven't
- Amanieu to close both ACP and PR
### (new change proposal) rust.tf/libs282 *Add \`write\_utf8\` and \`write\_ascii\` to \`io::Write\`*
- 8472: there are a lot of intermediate wrappers that would need to duplicate all their logic 3 ways in order for this to make a worthwhile difference in practice
- Amanieu: is the ascii case valuable enough to have here
- Josh: write_utf8 makes sense because it's something that the `write!` macro (and `write_fmt`) would commonly translate into; `write_ascii` doesn't provide that benefit.
- Amanieu: how would `write` vs `write_utf8` be implemented differently on the Windows console in order to derive a benefit?
- Chris/8472: for `write` there is a 4-byte buffer that buffers incoming bytes to synthesize them into utf-16 code points, which can be avoided in the `write_utf8` case
- Digression on whether writing non-utf8 to a console should emit replacement characters or return errors -- when you pipe binary data to a console, flooding it with replacement characters is not a helpful behavior
- 8472: windows console is already super slow for other reasons, so `write_utf8` is unlikely to make a difference
- See if we can get benchmarks
- David: partway alternative: optimize `write_fmt` to handle the `.as_str()` case more efficiently
- Tentatively plan to close because we don't expect a performance benefit, especially because a lot of plumbing needs code changes to propagate the advantage of this, but looking forward to benchmarks
### (new change proposal) rust.tf/libs283 *Add \`shallow\_clone()\` method to Cow which always reborrows data*
- David: today Cow has inherent methods to get `B::Owned` and `&mut B::Owned`, but no inherent method to get `&B`. There is `.as_ref()` (you deal with inference ambiguities) and `.deref()` (you need an import). An inherent method to easily get `&B` would be nice and if caller wants to wrap that in `Cow::Borrowed(...)`, it's easy
- Amanieu: add inherent `as_ref`?
- David: unlikely to be doable because of breakage of existing downstream `impl AsRef<MyType> for Cow<T>` impls, but open to try crater
- 8472/David: I think this could just use a documentation improvement, no new API
- 8472 to reply
### (new change proposal) rust.tf/libs284 *ACP: Unix socket ancillary data v2*
- Amanieu: this is going to be a very large API to review
- Josh: RFC explains why what's currently in std is insufficient, so a rewrite/replacement is well-motivated
- 8472: since we provide API to get a file descriptor out of std's types, you can implement all of this in a crate via extension traits
- Discussion amounting to: yes we are interested in standard library APIs for this
- Josh: the existing API for ancillary data exposes undesirable level of complexity, the proposed API is better but pieces of it still need iteration, unsure if the complexity still exposed is inherent complexity of ancillary data vs accidental complexity of imperfectly designed API
- 8472: proposed API requries allocation, can we do it better
- Josh: let's respond to ACP saying yes we want API improvements in this space, move discussion to the RFC; 2 rounds of team review (accepting RFC, stabilization) are enough
- Josh to respond on ACP and mark RFC as libs-api nominated so we revisit regularly alongside ACPs
### (new change proposal) rust.tf/libs285 *ACP: PartialOrd\<\[U\]\> for \[T\]*
- Amanieu: hello inference failures (although PartialEq already has the heterogeneous case)
- Amanieu/Josh: worth a shot as long as crater looks okay
- Josh: `PartialOrd<[U; N]>` also?
- Josh: see if we can aim for alignment between the set of PartialEq and PartialOrd impls
- Josh to respond
### (new change proposal) rust.tf/libs286 *\[ACP\] Provide an interface for creating instances of fmt::Formatter*
- Defer until Mara has a chance to look
### (stalled change proposal) rust.tf/libs167 *\`str::from\_raw\_parts\`*
- 8472: you are doing unsafe stuff, is it misguided to make that as compact as possible?
- 8472: 2 separate safety requirements: valid memory, and utf8. If we are conflating into 1 function, it needs to suggest both of those in the function name
- Amanieu: we have `String::from_raw_parts` since 1.0
- Josh: be consistent with String by not adding utf8 to the name
- Leaning toward accept
- 8472: make sure documentation will match the level of rigor of String's `from_raw_parts`
- Josh to reply
### (stalled change proposal) rust.tf/libs164 *Add methods for use cases that \`align\_to\` does not cover*
- Amanieu: depending on the CPU, often you are better off using unaligned slices
- Josh: this is not well supported in Rust without hitting UB; you need explicit unaligned loads via raw pointer
- Amanieu: `transmute_elements` says to use `aligned_subslice` if you need to go up in alignment, but `aligned_subslice` does not allow changing the type, so unclear how you would actually achieve a transmute that goes up in alignment
- Open to adding as nightly to understand how they are useful, and surface any gaps in going up in alignment
- Let's revisit this one again next week
### (stalled change proposal) rust.tf/libs155 *Arbitrary alternate flags in \`std::fmt::Formatter\`*
### (stalled change proposal) rust.tf/libs124 *Integrate \`Error\` trait with panic interfaces*
### (stalled change proposal) rust.tf/libs111 *Restructure ptr\_metadata to minimal support*
_Generated by [fully-automatic-rust-libs-team-triage-meeting-agenda-generator](https://github.com/rust-lang/libs-team/tree/main/tools/agenda-generator)_