---
title: Triage meeting 2024-07-24
tags: ["T-lang", "triage-meeting", "minutes"]
date: 2024-07-24
discussion: https://rust-lang.zulipchat.com/#narrow/stream/410673-t-lang.2Fmeetings/topic/Triage.20meeting.202024-07-24
url: https://hackmd.io/cPwjDu1NRP61Mg6HMrmgtQ
---
# T-lang meeting agenda
- Meeting date: 2024-07-24
## Attendance
- People: TC, tmandry, nikomatsakis, pnkfelix, Josh, Urgau
## Meeting roles
- Minutes, driver: TC
## Scheduled meetings
- 2024-07-24: "Design meeting: `Freeze` in bounds (RFC 3633)" [#277](https://github.com/rust-lang/lang-team/issues/277)
- 2024-07-31: "Planning meeting: 2024-07-31" [#276](https://github.com/rust-lang/lang-team/issues/276)
Edit the schedule here: https://github.com/orgs/rust-lang/projects/31/views/7.
## Announcements or custom items
(Meeting attendees, feel free to add items here!)
### Guest attendee items
TC: For any guests who are present, please note in this section if you're attending for the purposes of any items on (or off) the agenda in particular.
### Moving right along
TC: As we've been doing recently, due to the impressive backlog, I'm going to push the pace a bit. If it's ever too fast or you need a moment before we move on, please raise a hand and we'll pause.
### Design meeting at 12:30 EST / 09:30 PST / 17:30 CET
TC: Remember that we have a design/planning meeting that starts half an hour after this call ends.
### Next meeting with RfL
We're next meeting with RfL on 2024-07-31 to review the status of RfL project goals.
https://github.com/rust-lang/rfcs/pull/3614
### Lang project goal slate
TC: The project goals RFC is up, and there's a slate of items for lang. We should look over these:
https://github.com/nikomatsakis/rfcs/blob/project-goals-2024h2/text/0000-Project-Goals-2024h2.md#lang-team
Our checkboxes are here:
https://github.com/rust-lang/rfcs/pull/3672#issuecomment-2221533061
## Rust 2024 review
Project board: https://github.com/orgs/rust-lang/projects/43/views/5
None.
### Meta
TC: We have tracking issues for the Rust 2024 aspects of every item queued for the edition:
https://github.com/rust-lang/rust/issues?q=label%3AA-edition-2024+label%3AC-tracking-issue
For each item, we've identified an *owner*. Our most recent update for item owners is here:
https://rust-lang.zulipchat.com/#narrow/stream/268952-edition/topic/Owners.20update.202024-04-30
Our motivating priorities are:
- Make this edition a success.
- Do so without requiring heroics from anyone.
- ...or stressing anyone or everyone out.
The current timeline to be communicated is:
| Date | Version | Edition stage |
|------------|---------------|--------------------------------|
| 2024-07-25 | Release v1.80 | Checking off items... |
| 2024-09-05 | Release v1.81 | Checking off items... |
| 2024-10-11 | Branch v1.83 | Go / no go on all items |
| 2024-10-17 | Release v1.82 | Rust 2024 nightly beta |
| 2024-11-22 | Branch v1.84 | Prepare to stabilize... |
| 2024-11-28 | Release v1.83 | Stabilize Rust 2024 on master |
| 2025-01-03 | Branch v1.85 | Cut Rust 2024 to beta |
| 2025-01-09 | Release v1.84 | Announce Rust 2024 is pending! |
| 2025-02-20 | Release v1.85 | Release Rust 2024 |
### Tracking Issue for Lifetime Capture Rules 2024 (RFC 3498) #117587
**Link:** https://github.com/rust-lang/rust/issues/117587
TC: With the acceptance of RFC 3617, the adoption of `+ use<..>` syntax, and the great work by CE, this is looking to be in good shape for the edition.
### Reserve gen keyword in 2024 edition for Iterator generators #3513
**Link:** https://github.com/rust-lang/rfcs/pull/3513
TC: With the acceptance of RFC 3513 and the great work by Oli, this is looking to be in good shape for the edition.
### Tracking issue for promoting `!` to a type (RFC 1216) #35121
**Link:** https://github.com/rust-lang/rust/issues/35121
**Link:** https://github.com/rust-lang/rust/pull/123508
TC: This item is now ready for Rust 2024.
## Nominated RFCs, PRs, and issues
### "size_of_val_raw: for length 0 this is safe to call" rust#126152
**Link:** https://github.com/rust-lang/rust/pull/126152
TC: RalfJ nominates this to give us a chance to intervene in an opsem FCP to change the documentation for the unstable [`size_of_val_raw`](https://doc.rust-lang.org/nightly/std/mem/fn.size_of_val_raw.html).
It's about adding a special case for making the function always safe to call when the dynamic tail length is zero.
TC: What do we think, do we want to intervene?
tmandry: The rationale is here:
https://github.com/rust-lang/unsafe-code-guidelines/issues/465#issuecomment-2136401114
NM: This seems to make sense.
Josh: Sounds right.
tmandry/TC: +1.
Josh: I'll leave a comment.
### "Make `missing_fragment_specifier` an error in edition 2024" rust#128006
**Link:** https://github.com/rust-lang/rust/pull/128006
TC: tgross nominates for us:
> `missing_fragment_specifier` has been a future compatibility warning since 2017. Uplifting it to an unconditional hard error was attempted in 2020, but eventually reverted due to fallout.
>
> Make it an error only in edition >= 2024, leaving the lint for older editions. This change will make it easier to support more macro syntax that relies on usage of `$`.
Please set aside questions of whether this is too late for the edition. The question is whether we want it as a lang matter. I assure you that on the edition side, if it can't make it, it will get dropped, and we'll handle that.
TC: What do we think?
NM: The rule here was that the fragment specifier could be elided if it wasn't used.
NM: We should make this a hard error.
Josh: Agreed. It'd be nice to do this everywhere, but at least in the edition we should do this.
TC/tmandry: +1.
tmandry: This would also unblock named repetition groups.
```rust!
macro_rules! foo {
( $group1( $a:ident ),+ ) => {
$group1( println!("{}", $a); )+
}
}
```
TC: Sounds like we're all in favor, let's do it.
Josh: I'll write it up. We can mention also we're interested in doing this in all editions if possible?
TC: Sounds right. Let's just make sure to get it into Rust 2024 first and not block on checking it in all editions; we can do that later.
NM/pnkfelix: +1.
Josh: I'll capture that.
### "Stabilize opaque type precise capturing (RFC 3617)" rust#127672
**Link:** https://github.com/rust-lang/rust/pull/127672
TC: We're proposing to stabilize:
```rust
fn does_not_capture(x: &()) -> impl Sized + use<> {}
// ~~~~~~~~~~~~~~~~~~
// Does not capture the elided lifetime.
```
This is edition-relevant in that it enables the stabilization of the Lifetime Capture Rules 2024, which is a lang priority item for the edition.
We're doing two main things at the moment:
- Updating `rustc` to use `+ use<..>` rather than the `Captures` trick.
- Putting out a blog post about the Lifetime Capture Rules 2024 and about `+ use<..>` syntax.
We have an outstanding concern from Jack, as a lang advisor, about the pace of stabilization. Still, it'd be helpful if people could review this stabilization and check off, if possible, while we work through that.
NM: The pushback, while important, has also convinced me more about how important this is and that it's a net simplification to Rust.
### "Stabilize unsafe extern blocks (RFC 3484)" rust#127921
**Link:** https://github.com/rust-lang/rust/pull/127921
TC: In RFC 3484, we accepted `unsafe extern` blocks. The idea here is that we want to place the `unsafe` obligation to assert that the signatures within an `extern` block are correct on the author of the `extern` block (rather than upon users of items within an `extern` block). This allows for items within an `extern` block to be marked as `safe` and to be used outside of `unsafe` blocks.
In Rust 2024, `extern` blocks *must* be marked with `unsafe`.
In earlier editions, the `unsafe` qualifier is optional on `extern`, but without it, items cannot be marked as `safe` or `unsafe`.
What's being proposed for stabilization here exactly matches what we approved in the RFC.
This item is edition-relevant and we'd like it to stabilize in all editions ahead of Rust 2024.
TC: What do we think?
TC: I've now proposed this for FCP merge. Checkboxes are here:
https://github.com/rust-lang/rust/pull/127921#issuecomment-2248305332
NM: I'd prefer, stylistically, that we have a lint or have rustfmt add `unsafe` to each item. But that's something we can do later.
TC: I raised this with the style team, and they declined to have rustfmt do this, at least as long as there's not a warning lint about it.
TC: This is now going into FCP.
### "Rescope temp lifetime in let-chain into IfElse" rust#107251
**Link:** https://github.com/rust-lang/rust/pull/107251
TC: This PR is about shortening, over an edition, the scope of temporary lifetimes in if-let scrutinees so that they end before the `else` block. The current rules are a particular problem for let-chains which we hope to stabilize.
Ding assembled this report based on our request:
https://hackmd.io/@dingxf/rkJXW-0BA
Niko and tmandry reviewed the document, and the feeling that Ding took away is that we should do the semantics-preserving `match` approach.
Per Ding:
> We are expanding the applicable scope of the lint so that we will detect the values with significant drops and apply the rewrite if we found them in `if let`s.
The next steps here then are to:
- Update the lint in that way.
- Update the documentation.
- Do a crater run to confirm this all makes sense.
- Make a stabilization PR for Rust 2024 with this behavior.
TC: This is just an FYI.
NM: Sounds right.
tmandry: The previous crater run didn't flag all of the code that would be changed, so we still don't know the prevalence. So we'll need to see; if too many crates get touched, we'll need to rethink this.
### "Decide on path forward for attributes on expressions" rust#127436
**Link:** https://github.com/rust-lang/rust/issues/127436
TC: We decided recently to unblock progress on attributes on expressions (RFC 16) by allowing attributes on blocks. We have a proposed FCP to this effect.
After we did this, the question came up what we want to do about attributes in list contexts, e.g.:
```rust
call(#[foo] { block1 }, #[bar] { block2 })
```
...in particular, macro attributes.
Petrochenkov says:
> It needs to be decided how proc macros see the commas, or other separators in similar cases.
>
> Ideally proc macros should be able to turn 1 expression into multiple (including 0) expressions in this position, similarly to `cfg`s or macros in list contexts without separators. So it would be reasonable if the separators were included into both input and output tokens streams (there are probably other alternatives, but they do not fit into the token-based model as well). The "reparse context" bit from [#61733 (comment)](https://github.com/rust-lang/rust/issues/61733#issuecomment-509626449) is likely relevant to this case as well.
We filed a concern to figure this all out.
TC: We were trying to make incremental progress here. Could we perhaps narrow our stabilization to exclude these questions?
Josh: Today you can write:
```rust!
call(#[cfg(...)] arg, #[cfg(...)] arg2)
```
And this will omit the argument *including* the comma.
tmandry: My sense is that we want at least zero or one. Maybe expanding to N. Eventually; what we do now to move it forward is maybe separate.
Options ordered from least to most conservative (and then from most to least expressive):
- Option A: Punt this case and don't support attributes in this position without parens (e.g. `call((#[attr] arg), (#[attr] arg2))`)
- Option B (exactly one): Specify that, for now, if you use a macro attribute on an expression, that macro can only expand to a single expresion (not zero tokens, and no tokens following in the output).
- Option C (zero or one): Specify that, for now, if you use a macro attribute on an expression, that macro can only expand to zero tokens or an expression with nothing following (extra tokens, including `,`, are an error for now)
- Option D (zero or more): Specify that an attribute in this position can expand to tokens that may include a `,`, and that if they expand to zero tokens then we elide the comma.
- Option E (flexible): include comma, let macro decide, etc
- We find it surprising that comma would be included.
Josh: I think we should rule out E, and never include the comma; if people want that they should put the macro at a different level. I'm skeptical of half measures here. Those seem to be compatibility hazards. It seems we should do either A or D.
NM: Option D actually seems complicated to implement. It may be that option A is the only trivially implementable one. Option B seems conservative with room to expand. Option A seems limiting and that it will confuse people. I'd rather not have holes. Options C and D feel like "nice to haves" that could be useful but which could be modeled in the future.
tmandry: It seems we have differing intuitions on the team. I agree it may be surprising for a single to expand to multiple. But I see how expanding to zero would be surprising. And we have to decide whether the input gets the comma.
NM: this isn't how the compiler works anyway, we build a parse tree and then expand it into an expr
```rust
macro_rules! m {
() => {
1, 2
}
}
fn main() {
foo(m!()); // ERROR
}
Compiling playground v0.0.1 (/playground)
error: macro expansion ignores token `,` and any following
--> src/main.rs:3:10
|
3 | 1, 2
| ^
...
8 | foo(m!());
| ---- caused by the macro expansion here
|
= note: the usage of `m!` is likely invalid in expression context
help: you might be missing a semicolon here
|
8 | foo(m!(););
|
```
pnkfelix: But the compiler has moved toward more of having token trees everywhere. So the idea of splicing things isn't isn't completely absurd, but that doesn't mean that it's the right thing.
nikomatsakis: here is another example to show what I mean -- macros in Rust produce a single expression. If you consider cfg, you could think "0 or 1".
```rust
macro_rules! m {
() => {
1+2
}
}
fn main() {
foo(m!() * 3); // OK and equivalent to (1+2)*3
}
```
TC: You're arguing against N, or also against zero here?
NM: I could see making an extension to support zero here. And I'd like to extend that to MBEs too then (e.g., `m!()` in the above case could produce no tokens via `=> {}` and then emit the argument). It would be useful. It's a pure extension.
(The meeting ended here.)
---
### "Decide on bounds syntax for async closures (RFC 3668)" rust#128129
**Link:** https://github.com/rust-lang/rust/issues/128129
In the special design meeting 2024-07-23, we discussed five syntaxes for async closures:
- `F: async FnMut() -> T`
- `F: AsyncFnMut() -> T`
- `F: async mut fn() -> T`
- `F: async mut () -> T`
- `F: async mut || -> T`
Our current straw poll is:
| name | `async Fn*() -> T` | `AsyncFn*() -> T` | `async fn * () -> T` | `async * () -> T` | `async * \|A, B\| -> T` |
|--------------|--------------------|-------------------|----------------------|-------------------|-------------------------|
| nikomatsakis | +1 | +0 | -1 | -1 | -1 |
| tmandry | +1 | +1 | -0.5 | -1 | -0.5 |
| Josh | -1 | +0.75 | +0.5 | +1 | +0.5 |
| pnkfelix | +0 | -0 | -0.5 | +0 | -1 |
| scottmcm | | | | | |
| TC | +1 | -0.5 | -1 | -1 | -1 |
| CE | +1 | -1 | -1 | -0.5 | -1 |
| eholk | +1 | +0 | -1 | -0.75 | -0.5 |
- +1: "This is what I would do."
- +0: "I'm OK with this, leaning positive."
- -0: "I'm neutral to this, leaning negative."
- -1: "I would block this."
We agreed to:
- Move this to an unresolved question in RFC 3668.
- Allow that RFC to proceed to FCP.
- Implement both of the two main syntax options in nightly.
- Give both syntaxes equal billing in any blog posts about this.
There was substantial discussion of this after the design meeting itself in the thread here:
https://rust-lang.zulipchat.com/#narrow/stream/410673-t-lang.2Fmeetings/topic/Design.20meeting.202024-07-23
TC: This is just an FYI for those that didn't follow this closely.
### "Stabilize `raw_ref_op` (RFC 2582)" rust#127679
**Link:** https://github.com/rust-lang/rust/pull/127679
TC: RalfJ proposes that we stabilize `raw_ref_op`:
```rust
#![feature(raw_ref_op)]
use core::mem::MaybeUninit;
fn main() {
let mut x: MaybeUninit<u8> = MaybeUninit::uninit();
let _y: *const _ = &raw const x;
let _z: *mut _ = &raw mut x;
}
```
This is the syntax for the feature that currently underlies `addr_of!` and `addr_of_mut!`.
This feature and syntax comes from RFC 2582:
- https://github.com/rust-lang/rfcs/pull/2582
Ralf argues, in brief:
- It's clear these are here to stay; it's time to give a proper syntax.
- Giving these syntax will help with understanding among users.
- The `addr_of` name is unfortunate, given provenance, and this would help in getting rid of that.
There was extensive litigation of the syntax on the RFC. The obvious choice was `*const $place` and `*mut $place`, but people didn't like the `*` being there as it usually means dereference. So we landed on `&raw const $place` and `&raw mut place`.
There's been discussion of using `&raw $place` instead for const pointers, but this requires an edition so as to reserve `raw` as a contextual keyword. This would also rule out later using `&raw $place` for one of the improved pointer types that people have discussed.
Otherwise, semantically, these work exactly like the macros, so there don't seem to be a lot of truly open questions here.
TC: What do we think?
### "Inferred types `_::Enum`" rfcs#3444
**Link:** https://github.com/rust-lang/rfcs/pull/3444
TC: This RFC allows `_` to be used more widely for type inference. Niko nominates this for discussion:
> I'd like to discuss this in a lang team meeting. The RFC is pretty broad in scope:
>
> > This RFC introduces a feature allowing the base type of enumerations and structures to be inferred in contexts where strict typing information already exists. Some examples of strict typing include match statements and function calls. The syntax is `_::EnumVariant` for enumerations and `_ { a: 1 }` for constructing structs.
>
> I'm curious to take the temperature of the lang team on this or some subset. I'm not entirely sure what I think yet, to be honest. I might be inclined towards a subset (e.g., only in match patterns). There are definitely challenging implementation questions and I'm curious how e.g. rust-analyzer would be impacted.
>
> It seems pretty clear that repeating `X::Variant` is not "fun"; Swift has its `.Variant` shorthand for this reason. OTOH, it's a bit hard for me to assess how this ranks on the list of syntactic papercuts, it seems unlikely to be a source of _confusion_ for new users and it's rarely something I've heard raised.
>
> In any case, I feel like it'd be good for the team to weigh in on our current stance towards this RFC.
### "Tracking issue for the `quote!` macro in `proc_macro`" rust#54722
**Link:** https://github.com/rust-lang/rust/issues/54722
TC: In our discussion about adding syntax for getting the tag (or discriminant?) from an enum variant, it was brought up that `#foo`-style syntaxes could be a problem for the `quote` crate, but that perhaps this would be less of a problem if we stabilized [proc_macro::quote](https://doc.rust-lang.org/proc_macro/macro.quote.html) (since it uses `$` instead for unquoting).
This stabilization has been languishing for the last... five and a half years. I'm not sure whether this falls more on us or on `libs-api` (it's tagged for both). Either way, it seems worth discussing whether this is something we want to see happen and whether anything is blocking it.
TC: What do we think?
### "Allow dropping `dyn Trait` principal" rust#126660
**Link:** https://github.com/rust-lang/rust/pull/126660
TC: Jules has a PR for us:
> This allows the following examples to compile:
>
> ```rust
> trait Trait: Send {}
> fn foo(x: &dyn Trait) -> &dyn Send { x }
> ```
>
> ```rust
> trait Trait {}
> fn foo(x: &dyn Trait + Send) -> &dyn Send { x }
> ```
>
> This makes the language more consistent, as we already allow:
>
> ```rust
> trait Trait {}
> fn foo(x: &dyn Trait + Send) -> &dyn Trait { x }
> ```
>
> The PR includes a test case, in `tests/ui/traits/dyn-drop-principal.rs`.
This is related to:
- https://github.com/rust-lang/rust/pull/114679
- https://github.com/rust-lang/rust/issues/126313
...and lcnr nominates with this question:
> nominating for lang, to let them decide whether they mind delegating this to t-types. We simply reuse the vtable of the parent trait when dropping the principal. This relies on all vtables to have the same header which is used for dropping and `size_of_val/align_of_val`. I don't know whether that's currently guaranteed anywhere, cc @rust-lang/opsem i guess?
TC: What do we think?
### "Importing an enum variant can create a conflict with a new prelude type" rust#127738
**Link:** https://github.com/rust-lang/rust/issues/127738
TC: Josh nominates for us:
> The experiment in #125107 uncovered an interesting source of version breakage, which occurs if the standard library prelude attempts to introduce an additional type.
>
> Suppose `std` adds the type `Cell` to the prelude. This will break code that looks like this:
>
```rust
use Cell::A;
//~^ ERROR `Cell` is ambiguous
// The derive here is important but it doesn't particularly matter which trait is being derived.
#[derive(PartialEq)]
pub enum Cell {
A
}
```
>
> This makes it a _potentially_ breaking change to add new types to the prelude. We could still potentially add types that create no actual breakage (e.g. because no extant Rust code declares its own conflicting type), but this nonetheless introduces a potential source of breakage that could block introducing new types until an edition boundary (and creates one more thing people have to deal with when migrating to the new edition).
>
> It seems worth exploring whether we can, or should, attempt to fix this, such as by allowing the type to shadow in this case. Note that it _does_ properly shadow if there's no `derive` on the enum.
>
> Nominating for lang discussion on the "should we" question: should we consider doing something to eliminate or mitigate this source of conflict? This kind of conflict applies both to the current problem with the standard library prelude, as well as any potential future features for letting other libraries have preludes.
TC: What do we think?
### "RFC: Implementable trait aliases" rfcs#3437
**Link:** https://github.com/rust-lang/rfcs/pull/3437
TC: We discussed this in the lang planning meeting in June, and it looks like there have been updates since we last looked at this, so it's time for us to have another look since we seemed interested in this happening.
TC: What do we think?
### "Fixup Windows verbatim paths when used with the `include!` macro" rust#125205
**Link:** https://github.com/rust-lang/rust/pull/125205
TC: Chris Denton asks us:
> On Windows, the following code can fail if the `OUT_DIR` environment variable is a [verbatim path](https://doc.rust-lang.org/std/path/enum.Prefix.html) (i.e. begins with `\\?\`):
>
> ```rust
> include!(concat!(env!("OUT_DIR"), "/src/repro.rs"));
> ```
>
> This is because verbatim paths treat `/` literally, as if it were just another character in the file name.
>
> The good news is that the standard library already has code to fix this. We can simply use `components` to normalize the path so it works as intended.
>
> I think it could just be considered a bug fix but it might also be considered a change in language.
TC: What do we think, is this a bug fix or a change to the language, and if the latter, do we want it?
### "Stabilize `extended_varargs_abi_support`" rust#116161
**Link:** https://github.com/rust-lang/rust/pull/116161
TC: This stabilization was nominated for us, with pnkfelix commenting:
> Just to add on to @cjgillot 's comment above: @wesleywiser and I could not remember earlier today whether T-lang _wants_ to own FCP'ing changes like this that are restricted to extending the set of calling-conventions (i.e. the `conv` in `extern "conv" fn foo(...)`), which is largely a detail about what platforms one is interoperating with, and not about changing the expressiveness of the Rust language as a whole in the abstract.
>
> (My own gut reaction is that T-compiler is a more natural owner for this than T-lang, but I wasn't certain and so it seems best to let the nomination stand and let the two teams duke it out.)
TC: What do we think about 1) this stabilization, and 2) whether we want to own this?
### "Don't make statement nonterminals match pattern nonterminals" rust#120221
**Link:** https://github.com/rust-lang/rust/pull/120221
TC: CE handed this one to us, since it changes the contract of macro matchers.
Here's the code that does not work today that we would make work:
```rust
macro_rules! m {
($pat:pat) => {};
($stmt:stmt) => {};
}
macro_rules! m2 {
($stmt:stmt) => {
m! { $stmt }
//~^ ERROR expected pattern
};
}
m2! { let x = 1 }
```
This code does not work because we consider `:stmt` to be a possible `:pat` even though we then always reject it later in the process. By saying that `:stmt` cannot be a `:pat`, we make this code work.
We discussed this in the meeting on 2024-03-27:
> CE: Right now the tokens that a macro matcher may begin with is a stable guarantee. We are relaxing the assumption that pattern matchers may begin with statement metavariables ($var whose type is stmt), because when we actually try to *parse* such a pattern, we are always guaranteed to fail. This only allows more code to compile, and would only break future code if we specifically wanted to begin patterns with *statement metavariable*.
>
> scottmcm: I agree that it's weird to allow a `:stmt` in a pattern, so am happy to say we won't. Let's see what others think, since this conversation was in a sparsely-attended triage meeting:
>
> scottmcm: The other thing we explored was what it would take to make this actually work, since you can actually put an `:expr` into a pattern. But CE argued that we don't actually like that that works, it's just something we're stuck with because people used it before `:literal` was available, which seems fair.
TC: What do we think?
### "Support ?Trait bounds in supertraits and dyn Trait under a feature gate" rust#121676
**Link:** https://github.com/rust-lang/rust/pull/121676
TC: This is related to this MCP about a path toward async drop and scoped tasks:
https://github.com/rust-lang/compiler-team/issues/727
TC: petrochenkov gives some background:
> Summary:
>
> * [Initial support for auto traits with default bounds #120706](https://github.com/rust-lang/rust/pull/120706) introduces a way to add new auto traits that are appended to all bound lists by default, similarly to existing `Sized`. Such traits may include `Leak`, `SyncDrop` or similar, see [Initial support for auto traits with default bounds #120706 (comment)](https://github.com/rust-lang/rust/pull/120706#issuecomment-1934006762) for more detailed motivation.
> * To opt out from bounds added by default the `?Trait` syntax is used, but such "maybe" bounds are not supported in some contexts like supertrait lists and `dyn Trait + ...` lists, because `Sized` is not added by default in those context.
> * This PR adds a feature for supporting `trait Trait1: ?Trait2`, `dyn Trait1 + ?Trait2` and also multiple maybe bounds in the same list `?Trait1 + ?Trait2`, because the new traits need to be added by default in those contexts too, and `?Sized + ?Leak` may also make sense.
> * We need this to be available in bootstrap compiler, to make experiments on standard library without adding too many `#[cfg(not(bootstrap))]`s
> * Larger compiler team MCP including this feature - [MCP: Low level components for async drop compiler-team#727](https://github.com/rust-lang/compiler-team/issues/727), it gives some more context
TC: The question here is whether we want to charter this as an experiment.
### "Emit a warning if a `match` is too complex" rust#122685
**Link:** https://github.com/rust-lang/rust/pull/122685
TC: Nadri nominates this for us and describes the situation:
> Dear T-lang, this PR adds a warning that cannot be silenced, triggered when a match takes a really long time to analyze (in the order of seconds). This is to help users figure out what's taking so long and fix it.
>
> We _could_ make the limit configurable or the warning `allow`able. I argue that's not necessary because [crater](https://github.com/rust-lang/rust/pull/121979#issuecomment-2003089646) showed zero regressions with the current limit, and it's be pretty easy in general to split up a `match` into smaller `match`es to avoid blowup.
>
> We're still figuring out the exact limit, but does the team approve in principle?
(As an aside, awhile back someone [showed](https://niedzejkob.p4.team/rust-np/) how to [lower](https://github.com/NieDzejkob/rustc-sat) SAT to exhaustiveness checking with `match`. Probably that would hit this limit.)
TC: What do we think?
### "Stabilize `count`, `ignore`, `index`, and `length` (`macro_metavar_expr`)" rust#122808
**Link:** https://github.com/rust-lang/rust/pull/122808
TC: c410-f3r proposes the following for stabilization:
> # Stabilization proposal
>
> This PR proposes the stabilization of a subset of `#![feature(macro_metavar_expr)]` or more specifically, the stabilization of `count`, `ignore`, `index` and `length`.
>
> ## What is stabilized
>
> ### Count
> The number of times a meta variable repeats in total.
>
```rust
macro_rules! count_idents {
( $( $i:ident ),* ) => {
${count($i)}
};
}
fn main() {
assert_eq!(count_idents!(a, b, c), 3);
}
```
>
> ### Ignore
> Binds a meta variable for repetition, but expands to nothing.
>
```rust
macro_rules! count {
( $( $i:stmt ),* ) => {{
0 $( + 1 ${ignore($i)} )*
}};
}
fn main() {
assert_eq!(count!(if true {} else {}, let _: () = (), || false), 3);
}
```
>
> ### Index
> The current index of the inner-most repetition.
>
```rust
trait Foo {
fn bar(&self) -> usize;
}
macro_rules! impl_tuple {
( $( $name:ident ),* ) => {
impl<$( $name, )*> Foo for ($( $name, )*)
where
$( $name: AsRef<[u8]>, )*
{
fn bar(&self) -> usize {
let mut sum: usize = 0;
$({
const $name: () = ();
sum = sum.wrapping_add(self.${index()}.as_ref().len());
})*
sum
}
}
};
}
impl_tuple!(A, B, C, D);
fn main() {
}
```
>
> ### Length
>
> The current index starting from the inner-most repetition.
>
```rust
macro_rules! array_3d {
( $( $( $number:literal ),* );* ) => {
[
$(
[
$( $number + ${length()}, )*
],
)*
]
};
}
fn main() {
assert_eq!(array_3d!(0, 1; 2, 3; 4, 5), [[2, 3], [4, 5], [6, 7]]);
}
```
>
> ## Motivation
>
> Meta variable expressions not only facilitate the use of macros but also allow things that can't be done today like in the `$index` example.
>
> An initial effort to stabilize this feature was made in #111908 but ultimately reverted because of possible obstacles related to syntax and expansion.
>
> Nevertheless, [#83527 (comment)](https://github.com/rust-lang/rust/issues/83527#issuecomment-1744822345) tried to address some questions and fortunately the lang team accept #117050 the unblocking suggestions.
>
> Here we are today after ~4 months so everything should be mature enough for wider use.
>
> ## What isn't stabilized
> `$$` is not being stabilized due to unresolved concerns.
TC: I asked WG-macros for feedback on this here:
https://rust-lang.zulipchat.com/#narrow/stream/404510-wg-macros/topic/Partial.20macro_metavar_expr.20stabilization
TC: Josh proposed FCP merge on this stabilization.
### "RFC: inherent trait implementation" rfcs#2375
**Link:** https://github.com/rust-lang/rfcs/pull/2375
TC: We had a design meeting on 2023-09-12 about inherent trait impls. In that meeting, I proposed a `use` syntax for this:
> In the discussion above, we had left two major items unresolved.
>
> - How do we make blanket trait impls inherent?
> - How can we allow only *some* items from the trait impl to be made inherent?
> - This is especially tricky for associated functions and methods with a default implementation.
>
> (Part of the motivation for wanting to allow only some items to be made inherent is to prevent or to fix breakage caused when a trait later adds a new method with a default implementation whose name conflicts with the name of an existing inherent method.)
>
> Coming up with a syntax for these that combines well with the `#[inherent]` attribute could be challenging.
>
> One alternative that would make solving these problems straightforward is to add some syntax to the inherent `impl` block for the type. Given the desugaring in the RFC, there is some conceptual appeal here. (quaternic proposed this arrangement; TC is proposing the concrete syntax.)
>
> We can use `use` syntax to make this concise and intuitive.
>
> Here's an example:
```rust
trait Trait1<Tag, T> {
fn method0(&self) -> u8 { 0 }
fn method1(&self) -> u8 { 1 }
}
trait Trait2<Tag, T> {
fn method2(&self) -> u8 { 2 }
fn method3(&self) -> u8 { 3 }
fn method4(&self) -> u8 { 4 }
}
struct Tag;
struct Foo<T>(T);
impl<T> Foo<T> {
// All methods and associated items of Trait1 become inherent,
// except for `method0`. The inherent items are only visible
// within this crate.
pub(crate) use Trait1<Tag, T>::*;
// Only `method2` and `method3` on Trait2 become inherent.
pub use Trait2<Tag, T>::{method2, method3};
fn method0(&self) -> u64 { u64::MAX }
}
impl<T> Trait1<Tag, T> for Foo<T> {}
impl<U: Trait1<Tag, T>, T> Trait2<Tag, T> for U {}
```
> This solves another problem that we discussed above. How do we prevent breakage in downstream crates when a trait later adds a new method with a default implementation? Since a downstream crate might have made an impl of this trait for some local type inherent and might have an inherent method with a conflicting name, this could be breaking.
>
> We already handle this correctly for `use` declarations with wildcards. Any locally-defined items override an item that would otherwise be brought into scope with a wildcard import. We can reuse that same behavior and intuition here. When a wildcard is used to make all items in the trait inherent, any locally-defined inherent items in the `impl` prevent those items from the trait with the same name from being made inherent.
>
> Advantages:
>
> - It provides a syntax for adopting as inherent a blanket implementation of a trait for the type.
> - It provides a syntax for specifying which methods should become inherent, including methods with default implementations.
> - The wildcard import (`use Trait::*`) makes it very intuitive what exactly is happening and what exactly your API is promising.
> - The `use` syntax makes it natural for a locally-defined item to override an item from the wildcard import because that's exactly how other `use` declarations work.
> - `rust-analyzer` would probably support expanding a wildcard `use Trait::*` to an explicit `use Trait::{ .. }` just as it does for other `use` declarations, which would help people to avoid breakage.
> - We can support any visibility (e.g. `use`, `pub use`, `pub(crate) use`, etc.) for the items made inherent.
>
> Disadvantages:
>
> - There's some redundancy, especially when the items to make inherent are specifically named.
During the meeting, this emerged as the presumptive favorite, and we took on a TODO item to updated the RFC.
After follow-on discussion in Zulip, Niko agreed, and also raised a good question:
> Per the discussion on zulip, I have become convinced that it would be better to make this feature use the syntax `use`, like:
>
```rust
impl SomeType {
pub use SomeTrait::*; // re-export the methods for the trait implementation
}
```
>
> This syntax has a few advantages:
>
> * We can give preference to explicit method declared in the impl blocks over glob re-exports, eliminating one source of breakage (i.e., trait adds a method with a name that overlaps one of the inherent methods defined on `SomeType`)
> * Can make just specific methods (not all of them) inherent.
> * Easier to see the inherent method when scanning source.
> * You can re-export with different visibility levels (e.g., `pub(crate)`)
> * It would work best if we planned to permit `use SomeTrait::some_method;` as a way to import methods as standalone fns, but I wish we did that.
>
> However, in writing this, I realize an obvious disadvantage -- if the trait has more generics and things, it's not obvious how those should map. i.e., consider
>
```rust
struct MyType<T> {
}
impl<T> MyType<T> {
pub use MyTrait::foo;
}
impl<T: Debug> MyTrait for MyType<T> {
fn foo(&self) { }
}
```
>
> This would be weird -- is this an error, because the impl block says it's for all `T`? And what if it were `trait MyTRait<X>`?
TC: My sense is that we've just been awaiting someone digging in and updating the RFC here.
### "Raw Keywords" rfcs#3098
**Link:** https://github.com/rust-lang/rfcs/pull/3098
TC: We've at various times discussed that we had earlier decided that if we wanted to use a new keyword within an edition, we would write it as `k#keyword`, and for that reason, we prefer to not speculatively reserve keywords ahead of an edition (except, perhaps, when it's clear we plan to use it in the near future).
TC: Somewhat amusingly, however, we never in fact accepted that RFC. Back in 2021, we accepted scottmcm's proposal to **cancel**:
> We discussed this RFC again in the lang team triage meeting today.
>
> For the short-term goal of the reservation for the edition, we'll be moving forward on #3101 instead. As such, we wanted to leave more time for conversations about this one, and maybe use crater results from 3101 to make design changes,
>
> @rfcbot cancel
Instead we accepted RFC 3101 that reserved `ident#foo`, `ident"foo"`, `ident'f'`, and `ident#123` starting in the 2023 edition.
Reading through the history, here's what I see:
- What do we want to do about Rust 2015 and Rust 2018? It's a breaking change to add this there. Is this OK? Do we want to do a crater run on this?
- Would we have the stomach to actually do this? It's one thing to *say* that if we wanted to use a new keyword within an edition, we'd write `k#keyword`, but it's another to actually do it in the face of certain criticism about that being e.g. unergonomic. Would we follow through?
TC: What do we think?
### "Add support for `use Trait::func`" rfcs#3591
**Link:** https://github.com/rust-lang/rfcs/pull/3591
This RFC would add support for:
```rust
use Default::default;
struct S {
a: HashMap<i32, i32>,
}
impl S {
fn new() -> S {
S {
a: default()
}
}
}
```
Josh has proposed FCP merge and has nominated. There are outstanding concerns about the handling of turbofish and associated constants.
TC: What do we think?
### "Supertrait item shadowing v2" rfcs#3624
**Link:** https://github.com/rust-lang/rfcs/pull/3624
TC: On 2024-04-24, we had discussed (on a gut check basis) a proposal from Amanieu to change method resolution such that when both a subtrait and one of its supertraits are in scope, shadowed methods from the subtrait would be chosen rather than resulting in ambiguity errors.
Most notably, this would allow the standard library to uplift methods from `itertools`, which they've been deferring for years due to no way to do so without causing breakage. But there are many other possible uses and reasons to believe this might be a good rule.
After our last discussion, we had asked for an RFC. This is that RFC. What do we think?
### "Tracking issue for the `start` feature" rust#29633
**Link:** https://github.com/rust-lang/rust/issues/29633
TC: Nils proposes to us that we delete the unstable `#[start]` attribute:
> I think this issue should be closed and `#[start]` should be deleted. It's nothing but an accidentally leaked implementation detail that's a not very useful mix between "portable" entrypoint logic and bad abstraction.
>
> I think the way the stable user-facing entrypoint should work (and works today on stable) is pretty simple:
>
> * `std`-using cross-platform programs should use `fn main()`. the compiler, together with `std`, will then ensure that code ends up at `main` (by having a platform-specific entrypoint that gets directed through `lang_start` in `std` to `main` - but that's just an implementation detail)
> * `no_std` platform-specific programs should use `#![no_main]` and define their own platform-specific entrypoint symbol with `#[no_mangle]`, like `main`, `_start`, `WinMain` or `my_embedded_platform_wants_to_start_here`. most of them only support a single platform anyways, and need cfg for the different platform's ways of passing arguments or other things _anyways_
>
> `#[start]` is in a super weird position of being neither of those two. It tries to pretend that it's cross-platform, but its signature is a total lie. Those arguments are just stubbed out to zero on Windows, for example. It also only handles the platform-specific entrypoints for a few platforms that are supported by `std`, like Windows or Unix-likes. `my_embedded_platform_wants_to_start_here` can't use it, and neither could a libc-less Linux program. So we have an attribute that only works in some cases anyways, that has a signature that's a total lie (and a signature that, as I might want to add, has changed recently, and that I definitely would not be comfortable giving _any_ stability guarantees on), and where there's a pretty easy way to get things working without it in the first place.
>
> Note that this feature has **not** been RFCed in the first place.
TC: What do we think?
### "Stabilize `anonymous_lifetime_in_impl_trait`" rust#107378
**Link:** https://github.com/rust-lang/rust/pull/107378
TC: We unnominated this back in October 2023 as more analysis seemed to be needed. Since then, nikomatsakis and tmandry have posted substantive analysis that it seems we should discuss.
### "#[cold] on match arms" rust#120193
**Link:** https://github.com/rust-lang/rust/pull/120193
TC: Apparently our unstable `likely` and `unlikely` intrinsics don't work. There's a proposal to do some work on fixing that and stabilizing a solution here. The nominated question is whether we want to charter this as an experiment.
### "Disallow deriving (other than Copy/Clone) on types with unnamed fields" rust#121270
**Link:** https://github.com/rust-lang/rust/pull/121270
TC: pnkfelix nominates this for us:
> This PR that addresses some ICEs arising for the unstable `feature(unnamed_fields)`, by conservatively mapping the ICE'ing cases to static errors instead.
>
> The T-compiler team wants to know the opinion of T-lang of whether `feature(unnamed_fields)` is sufficiently likely, in the near future, to be removed (or significantly reworked) to such a degree that it would make more sense to close this PR rather than have contributors spend further time on it.
>
> (See also the context established by https://hackmd.io/7r0i-EWyR8yO6po2LnS2rA#Tracking-issue-for-RFC-2102-Unnamed-fields-of-struct-and-union-type-rust49804 (where I think there was supposed to be an eventual writeup of the concerns people had with `feature(unnamed_fields)`) and [#49804 (comment)](https://github.com/rust-lang/rust/issues/49804#issuecomment-2106381721) )
On 2024-05-12, Josh said:
> It sounds like, from the minutes, that some folks would like to see this feature designed differently than it was when it was previously accepted. It wouldn't be the first or last feature to need some design adjustments when lang design met compiler reality. Happy to help with that, so that we can find a design that meets the requirements in the original RFC and any new issues that have arisen since then.
This is about RFC 2102:
https://github.com/rust-lang/rfcs/pull/2102
We discussed this in the meeting on 2024-06-12 without consensus.
Some felt that this was still needed, others first wanted to look for a more minimal approach.
We left this for further discussion.
TC: What do we think?
### "Skip pub structs with repr(c) and repr(transparent) in dead code analysis" rust#127104
**Link:** https://github.com/rust-lang/rust/pull/127104
TC: The background here is in:
- https://github.com/rust-lang/rust/issues/126169
TC: What do we think?
### "Tracking Issue for unicode and escape codes in literals" rust#116907
**Link:** https://github.com/rust-lang/rust/issues/116907
TC: nnethercote has implemented most of RFC 3349 ("Mixed UTF-8 literals") and, based on implementation experience, argues that the remainder of the RFC should not be implemented:
> I have a partial implementation of this RFC working locally (EDIT: now at #120286). The RFC proposes five changes to literal syntax. I think three of them are good, and two of them aren't necessary.
TC: What do we think?
### "Proposal: Remove `i128`/`u128` from the `improper_ctypes` lint" lang-team#255
**Link:** https://github.com/rust-lang/lang-team/issues/255
TC: Trevor Gross describes the situation:
> For a while, Rust's 128-bit integer types have been incompatible with those from C. The original issue is here [rust-lang/rust#54341](https://github.com/rust-lang/rust/issues/54341), with some more concise background information at the MCP here [rust-lang/compiler-team#683](https://github.com/rust-lang/compiler-team/issues/683)
>
> The current Beta of 1.77 will have [rust-lang/rust#116672](https://github.com/rust-lang/rust/pull/116672), which manually sets the alignment of `i128` to make it ABI-compliant with any version of LLVM (`clang` does something similar now). 1.78 will have LLVM18 as the vendored version which fixes the source of this error.
>
> Proposal: now that we are ABI-compliant, do not raise `improper_ctypes` on our 128-bit integers. I did some testing with abi-cafe and a more isolated https://github.com/tgross35/quick-abi-check during the time https://reviews.llvm.org/D86310 was being worked on, and verified everything lines up. (It would be great to have some fork of abi-cafe in tree, but that is a separate discussion.)
>
> @joshtriplett mentioned that changing this lint needs a lang FCP https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/LLVM.20alignment.20of.20i128/near/398422037. cc @maurer
>
> Reference change from when I was testing [rust-lang/rust@c742908](https://github.com/rust-lang/rust/commit/c742908c4b9abde264b8c5e9663e31c649a47f2f)
TC: Josh nominates this for our discussion. What do we think?
### "`is` operator for pattern-matching and binding" rfcs#3573
**Link:** https://github.com/rust-lang/rfcs/pull/3573
TC: Josh proposes for us that we should accept:
```rust
if an_option is Some(x) && x > 3 {
println!("{x}");
}
```
And:
```rust
func(x is Some(y) && y > 3);
```
TC: The main topic discussed in the issue thread so far has been the degree to which Rust should have "two ways to do things". Probably the more interesting issue is how the binding and drop scopes for this should work.
TC: In the 2024-02-21 meeting (with limited attendance), we discussed how we should prioritize stabilizing let chains, and tmandry suggested we may want to allow those to settle first.
TC: What do we think, as a gut check?
### "Unsafe fields" rfcs#3458
**Link:** https://github.com/rust-lang/rfcs/pull/3458
TC: Nearly ten years ago, on 2014-10-09, pnkfelix proposed unsafe fields in RFC 381:
https://github.com/rust-lang/rfcs/issues/381
On 2017-05-04, Niko commented:
> I am pretty strongly in favor of unsafe fields at this point. The only thing that holds me back is some desire to think a bit more about the "unsafe" model more generally.
Then, in 2023, Jacob Pratt refreshed this proposal with RFC 3458. It proposes that:
> Fields may be declared `unsafe`. Unsafe fields may only be mutated (excluding interior mutability) or initialized in an unsafe context. Reading the value of an unsafe field may occur in either safe or unsafe contexts. An unsafe field may be relied upon as a safety invariant in other unsafe code.
E.g.:
```rust
struct Foo {
safe_field: u32,
/// Safety: Value must be an odd number.
unsafe unsafe_field: u32,
}
// Unsafe field initialization requires an `unsafe` block.
// Safety: `unsafe_field` is odd.
let mut foo = unsafe {
Foo {
safe_field: 0,
unsafe_field: 1,
}
};
```
On 2024-05-21, Niko nominated this for us:
> I'd like to nominate this RFC for discussion. I've not read the details of the thread but I think the concept of unsafe fields is something that comes up continuously and some version of it is worth doing.
TC: What do we think?
### "RFC: Allow symbol re-export in cdylib crate from linked staticlib" rfcs#3556
**Link:** https://github.com/rust-lang/rfcs/pull/3556
TC: This seems to be about making the following work:
```rust
// kind is optional if it's been specified elsewhere, e.g. via the `-l` flag to rustc
#[link(name="ext", kind="static")]
extern {
#[no_mangle]
pub fn foo();
#[no_mangle]
pub static bar: std::ffi::c_int;
}
```
There are apparently use cases for this.
What's interesting is that apparently it already does, but we issue a warning that is wrong:
```rust
warning: `#[no_mangle]` has no effect on a foreign function
--> src/lib.rs:21:5
|
21 | #[no_mangle]
| ^^^^^^^^^^^^ help: remove this attribute
22 | pub fn foo_rfc3556_pub_with_no_mangle();
| ---------------------------------------- foreign function
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: symbol names in extern blocks are not mangled
```
TC: One of the author's asks of us is that we don't make this into a hard error (e.g. with the new edition).
TC: What do we think?
### "Better errors with bad/missing identifiers in MBEs" rust#118939
**Link:** https://github.com/rust-lang/rust/pull/118939
TC: The idea here seems to be to improve some diagnostics around `macro_rules`, but this seems to be done by way of reserving the `macro_rules` token more widely, which is a breaking change. Petrochenkov has objected to it on that basis, given that reserving `macro_rules` minimally has been the intention since we hope it will one day disappear in favor of `macro`. What do we think?
### "Uplift `clippy::invalid_null_ptr_usage` lint" rust#119220
**Link:** https://github.com/rust-lang/rust/pull/119220
TC: Urgau proposes this for us:
> This PR aims at uplifting the `clippy::invalid_null_ptr_usage` lint into rustc, this is similar to the [`clippy::invalid_utf8_in_unchecked` uplift](https://github.com/rust-lang/rust/pull/111543) a few months ago, in the sense that those two lints lint on invalid parameter(s), here a null pointer where it is unexpected and UB to pass one.
>
> ## `invalid_null_ptr_usages`
>
> (deny-by-default)
>
> The `invalid_null_ptr_usages` lint checks for invalid usage of null pointers.
>
> ### Example
>
```rust
// Undefined behavior
unsafe { std::slice::from_raw_parts(ptr::null(), 0); }
// Not Undefined behavior
unsafe { std::slice::from_raw_parts(NonNull::dangling().as_ptr(), 0); }
```
>
> Produces:
>
```
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused, consider using a dangling pointer instead
--> $DIR/invalid_null_ptr_usages.rs:14:23
|
LL | let _: &[usize] = std::slice::from_raw_parts(ptr::null(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^
| |
| help: use a dangling pointer instead: `core::ptr::NonNull::dangling().as_ptr()`
```
>
> ### Explanation
>
> Calling methods who's safety invariants requires non-null pointer with a null pointer is undefined behavior.
>
> The lint use a list of functions to know which functions and arguments to checks, this could be improved in the future with a rustc attribute, or maybe even with a `#[diagnostic]` attribute.
TC: What do we think?
### "panic in a no-unwind function leads to not dropping local variables" rust#123231
**Link:** https://github.com/rust-lang/rust/issues/123231
TC: RalfJ nominates this for us. Consider this code:
```rust
#![feature(c_unwind)]
struct Noise;
impl Drop for Noise {
fn drop(&mut self) {
eprintln!("Noisy Drop");
}
}
extern "C" fn test() {
let _val = Noise;
panic!("heyho");
}
fn main() {
test();
}
```
It doesn't print anything. Should it?
### "Uplift `clippy::double_neg` lint as `double_negation`" rust#126604
**Link:** https://github.com/rust-lang/rust/pull/126604
TC: This proposes to lint against cases like this:
```
fn main() {
let x = 1;
let _b = --x; //~ WARN use of a double negation
}
```
TC: What do we think?
### "Lang discussion: Item-level `const {}` blocks, and `const { assert!(...) }`" lang-team#251
**Link:** https://github.com/rust-lang/lang-team/issues/251
TC: This issue was raised due to discussion in a T-libs-api call. Josh gives the context:
> In discussion of [rust-lang/libs-team#325](https://github.com/rust-lang/libs-team/issues/325) (a proposal for a compile-time assert macro), the idea came up to allow `const {}` blocks at item level, and then have people use `const { assert!(...) }`.
>
> @rust-lang/libs-api would like some guidance from @rust-lang/lang about whether lang is open to toplevel `const { ... }` blocks like this, which would influence whether we want to add a compile-time assert macro, as well as what we want to call it (e.g. `static_assert!` vs `const_assert!` vs some other name).
>
> Filing this issue to discuss in a lang meeting. This issue is _not_ seeking any hard commitment to add such a construct, just doing a temperature check.
CAD97 noted:
> To ensure that it's noted: if both item and expression `const` blocks are valid in the same position (i.e. in statement position), a rule to disambiguate would be needed (like for statement versus expression `if`-`else`). IMO it would be quite unfortunate for item-level `const` blocks to be evaluated pre-mono if that same `const` block but statement-level would be evaluated post-mono.
>
> Additionally: since `const { assert!(...) }` is post-mono (due to using the generic context), it's potentially desirable to push people towards using `const _: () = assert!(...);` (which is pre-mono) whenever possible (not capturing generics).
TC: What do we think?
### "Add lint against function pointer comparisons" rust#118833
**Link:** https://github.com/rust-lang/rust/pull/118833
TC: In the 2024-01-03 call, we developed a tentative consensus to lint against direct function pointer comparison and to push people toward using `ptr::fn_addr_eq`. We decided to ask T-libs-api to add this. There's now an open proposal for that here:
https://github.com/rust-lang/libs-team/issues/323
One question that has come up is whether we would expect this to work like `ptr::addr_eq` and have separate generic parameters, e.g.:
```rust
/// Compares the *addresses* of the two pointers for equality,
/// ignoring any metadata in fat pointers.
///
/// If the arguments are thin pointers of the same type,
/// then this is the same as [`eq`].
pub fn addr_eq<T: ?Sized, U: ?Sized>(p: *const T, q: *const U) -> bool { .. }
```
Or whether we would prefer that `fn_addr_eq` enforced type equality of the function pointers. Since we're the ones asking for this, we probably want to develop a consensus here. We discussed this in the call on 2024-01-10, then we opened a Zulip thread:
https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Signature.20of.20.60ptr.3A.3Afn_addr_eq.60
TC: On this subject, scottmcm raised this point, with which pnkfelix seemed to concur:
> I do feel like if I saw code that had `fn1.addr() == fn2.addr()` (if `FnPtr` were stabilized), I'd write a comment saying "isn't that what `fn_addr_eq` is for?"
>
> If the answer ends up being "no, actually, because I have different types", that feels unfortunate even if it's rare.
>
> (Like how `addr_eq(a, b)` is nice even if with strict provenance I could write `a.addr() == b.addr()` anyway.)
TC: scottmcm also asserted confidence that allowing mixed-type pointer comparisons is correct for `ptr::addr_eq` since comparing the addresses of `*const T`, `*const [T; N]`, and `*const [T]` are all reasonable. I pointed out that, if that's reasonable, then `ptr::fn_addr_eq` is the higher-ranked version of that, since for the same use cases, it could be reasonable to compare function pointers that return those three different things or accept them as arguments.
TC: Adding to that, scottmcm noted that comparing addresses despite lifetime differences is also compelling, e.g. comparing `fn(Box<T>) -> &'static mut T` with `for<'a> fn(Box<T>) -> &'a mut T`.
TC: Other alternatives we considered were not stabilizing `ptr::fn_addr_eq` at all and instead stabilizing `FnPtr` so people could write `ptr::addr_eq(fn1.addr(), fn2.addr())`, or expecting that people would write instead `fn1 as *const () == fn2 as *const ()`.
TC: Recently CAD97 raised an interesting alternative:
> From the precedent of `ptr::eq` and `ptr::addr_eq`, I'd expect a "`ptr::fn_eq`" to have one generic type and a "`ptr::fn_addr_eq`" to have two. Even if `ptr::fn_eq`'s implementation is just an address comparison, it still serves as a documentation point to call out the potential pitfalls with comparing function pointers.
TC: What do we think?
---
TC: Separately, on the 2024-01-10 call, we discussed some interest use cases for function pointer comparison, especially when it's indirected through `PartialEq`. We had earlier said we didn't want to lint when such comparisons were indirected through generics, but we did address the non-generic case of simply composing such comparisons.
One example of how this is used is in the standard library, in `Waker::will_wake`:
https://doc.rust-lang.org/core/task/struct.Waker.html#method.will_wake
It's comparing multiple function pointers via a `#[derive(PartialEq)]` on the `RawWakerVTable`.
We decided on 2024-01-01 that this case was interesting and we wanted to think about it further. We opened a discussion thread about this:
https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Function.20pointer.20comparison.20and.20.60PartialEq.60
Since then, another interesting use case in the standard library was raised, in the formatting machinery:
https://doc.rust-lang.org/src/core/fmt/rt.rs.html
What do we think about these, and would we lint on derived `PartialEq` cases like these or no?
### "Should Rust still ignore SIGPIPE by default?" rust#62569
**Link:** https://github.com/rust-lang/rust/issues/62569
TC: Prior to `main()` being executed, the Rust startup code makes a syscall to change the handling of `SIGPIPE`. Many believe that this is wrong thing for a low-level language like Rust to do, because 1) it makes it impossible to recover what the original value was, and 2) means things like `seccomp` filters must be adjusted for this.
It's also just, in a practical sense, wrong for most CLI applications.
This seems to have been added back when Rust had green threads and then forgotten about. But it's been an ongoing footgun.
Making a celebrity appearance, Rich Felker, the author of MUSL libc, notes:
> As long as Rust is changing signal dispositions inside init code in a way that the application cannot suppress or undo, it is _fundamentally unusable to implement standard unix utilities that run child processes_ or anything that needs to preserve the signal dispositions it was invoked with and pass them on to children. Changing inheritable process state behind the application's back is just unbelievably bad behavior and does not belong in a language runtime for a serious language...
>
> As an example, if you implement `find` in Rust, the `-exec` option will invoke its commands with `SIGPIPE` set to `SIG_IGN`, so that they will not properly terminate on broken pipe. But if you just made it set `SIGPIPE` to `SIG_DFL` before invoking the commands, now it would be broken in the case where the invoking user intentionally set `SIGPIPE` to `SIG_IGN` so that the commands would not die on broken pipe.
There was discussion in 2019 about fixing this over an edition, but nothing came of it.
Are we interested in fixing it over this one?
Strawman (horrible) proposal: We could stop making this pre-main syscall in Rust 2024 and have `cargo fix` insert this syscall at the start of every `main` function.
(In partial defense of the strawman, it gets us directly to the arguably best end result while having an automatic semantics-preserving edition migration and it avoids the concerns about lang/libs coupling that Mara raised. The edition migration could add a comment above this inserted code telling people under what circumstances they should either keep or delete the added line.)
### "types team / lang team interaction" rust#116557
**Link:** https://github.com/rust-lang/rust/issues/116557
TC: nikomatsakis nominated this:
> We had some discussion about types/lang team interaction. We concluded a few things:
>
> * Pinging the team like @rust-lang/lang is not an effective way to get attention. Nomination is the only official way to get attention.
> * It's ok to nominate things in an "advisory" capacity but not block (e.g., landing a PR), particularly as most any action can ultimately be reversed. But right now, triagebot doesn't track closed issues, so that's a bit risky.
>
> Action items:
>
> * We should fix triagebot to track closed issues.
TC: What do we think?
### "[RFC] `core::marker::Freeze` in bounds" rfcs#3633
**Link:** https://github.com/rust-lang/rfcs/pull/3633
TC: There's now a proposal on the table for the stabilization of the `Freeze` trait in bounds.
TC: We'll probably need to schedule a design meeting to work through this.
### "Implement `PartialOrd` and `Ord` for `Discriminant`" rust#106418
**Link:** https://github.com/rust-lang/rust/pull/106418
TC: We discussed this last in the meeting on 2024-03-13. scottmcm has now raised on concern on the issue and is planning to make a counter-proposal:
> I remain concerned about exposing this with no opt-out on an unrestricted generic type @rfcbot concern overly-broad
>
> I'm committing to making an alternative proposal because I shouldn't block without one. Please hold my feet to the fire if that's no up in a week.
>
> Basically, I have an idea for how we might be able to do this, from [#106418 (comment)](https://github.com/rust-lang/rust/pull/106418#issuecomment-1698887324)
>
> > 2. Expose the variant ordering privately, only accessible by the type owner/module.
> >
> > Solution 2. is obviously more desirable, but AFAIK Rust can't do that and there is no proposal to add a feature like that.
https://github.com/rust-lang/rust/pull/106418#issuecomment-1994833151
### "Fallout from expansion of redundant import checking" rust#121708
**Link:** https://github.com/rust-lang/rust/issues/121708
TC: We discussed this in the meeting on 2024-03-13. The feelings expressed included:
- We don't want to create a perverse incentive for people to expand existing lints rather than to create new ones where appropriate just because there's less process for expanding the meaning of an existing lint.
- It would be good if potentially-disruptive expansions of an existing lint either:
- Had a machine-applicable fix.
- Or had a new name.
- We don't want to require a new lint name for each expansion.
- We don't want to require a crater run for each change to a lint.
- There are two ways to prevent disruption worth exploring:
- Prevent potentially-disruptive changes from hitting master.
- Respond quickly to early indications of disruption once the changes hit master.
- Compiler maintainers have a sense of what might be disruptive and are cautious to avoid it. It may be OK to have a policy that is not perfectly measurable.
TC: tmandry volunteered to draft a policy proposal.
### "What are the guarantees around which constants (and callees) in a function get monomorphized?" rust#122301
**Link:** https://github.com/rust-lang/rust/issues/122301
TC: The8472 asks whether this code, which compiles today, can be relied upon:
```rust
const fn panic<T>() {
struct W<T>(T);
impl<T> W<T> {
const C: () = panic!();
}
W::<T>::C
}
struct Invoke<T, const N: usize>(T);
impl<T, const N: usize> Invoke<T, N> {
const C: () = match N {
0 => (),
// Not called for `N == 0`, so not monomorphized.
_ => panic::<T>(),
};
}
fn main() {
let _x = Invoke::<(), 0>::C;
}
```
The8472 notes that this is a useful property and that there are use cases for this in the compiler and the standard library, at least unless or until we adopt something like `const if`:
https://github.com/rust-lang/rfcs/issues/3582
RalfJ has pointed out to The8472 that the current behavior might not be intentional and notes:
> It's not opt-dependent, but it's also unclear how we want to resolve the opt-dependent issue. Some [proposals](https://github.com/rust-lang/rust/issues/122814#issuecomment-2015090501) involve also walking all items "mentioned" in a const. That would be in direct conflict with your goal here I think. To be clear I think that's a weakness of those proposals. But if that turns out to be the only viable strategy then we'll have to decide what we want more: using `const` tricks to control what gets monomorphized, or not having optimization-dependent errors.
>
> One crucial part of this construction is that everything involved is generic. If somewhere in the two "branches" you end up calling a monomorphic function, then that may have its constants evaluated even if it is in the "dead" branch -- or it may not, it depends on which functions are deemed cross-crate-inlinable. That's basically what #122814 is about.
TC: The question to us is whether we want to guarantee this behavior. What do we think?
### "Policy for lint expansions" rust#122759
**Link:** https://github.com/rust-lang/rust/issues/122759
TC: In the call on 2024-03-13, we discussed this issue raised by tmandry:
"Fallout from expansion of redundant import checking"
https://github.com/rust-lang/rust/issues/121708
During the call, the thoughts expressed included:
- We don't want to create a perverse incentive for people to expand existing lints rather than to create new ones where appropriate just because there's less process for expanding the meaning of an existing lint.
- It would be good if potentially-disruptive expansions of an existing lint either:
- Had a machine-applicable fix.
- Or had a new name.
- We don't want to require a new lint name for each expansion.
- We don't want to require a crater run for each change to a lint.
- There are two ways to prevent disruption worth exploring:
- Prevent potentially-disruptive changes from hitting master.
- Respond quickly to early indications of disruption once the changes hit master.
- Compiler maintainers have a sense of what might be disruptive and are cautious to avoid it. It may be OK to have a policy that is not perfectly measurable.
TC: tmandry volunteered to draft a policy proposal. He's now written up this proposal in this issue.
TC: What do we think?
### "Tracking Issue for externally implementable items" rust#125418
**Link:** https://github.com/rust-lang/rust/issues/125418
TC: We reviewed in triage an RFC for externally implementable functions on 2024-05-22 along with a companion/alternative RFC for externally implementable statics. That discussion produced two more proposals, one from Amanieu and one from tmandry.
TC: We're likely going to need a design meeting to work through these.
## Action item review
- [Action items list](https://hackmd.io/gstfhtXYTHa3Jv-P_2RK7A)
## Pending lang team project proposals
None.
## PRs on the lang-team repo
### "Add soqb`s design doc to variadics notes" lang-team#236
**Link:** https://github.com/rust-lang/lang-team/pull/236
### "Update auto traits design notes with recent discussion" lang-team#237
**Link:** https://github.com/rust-lang/lang-team/pull/237
### "Update hackmd link to a public link" lang-team#258
**Link:** https://github.com/rust-lang/lang-team/pull/258
### "Adding a link to "how to add a feature gate" in the experimenting how-to" lang-team#267
**Link:** https://github.com/rust-lang/lang-team/pull/267
## RFCs waiting to be merged
None.
## `S-waiting-on-team`
### "size_of_val_raw: for length 0 this is safe to call" rust#126152
**Link:** https://github.com/rust-lang/rust/pull/126152
### "Make `missing_fragment_specifier` an error in edition 2024" rust#128006
**Link:** https://github.com/rust-lang/rust/pull/128006
### "warn less about non-exhaustive in ffi" rust#116863
**Link:** https://github.com/rust-lang/rust/pull/116863
### "`repr(tag = ...)` for type aliases" rfcs#3659
**Link:** https://github.com/rust-lang/rfcs/pull/3659
### "Fixup Windows verbatim paths when used with the `include!` macro" rust#125205
**Link:** https://github.com/rust-lang/rust/pull/125205
### "Don't make statement nonterminals match pattern nonterminals" rust#120221
**Link:** https://github.com/rust-lang/rust/pull/120221
### "Initial support for auto traits with default bounds" rust#120706
**Link:** https://github.com/rust-lang/rust/pull/120706
### "Stabilize `count`, `ignore`, `index`, and `length` (`macro_metavar_expr`)" rust#122808
**Link:** https://github.com/rust-lang/rust/pull/122808
### "Skip pub structs with repr(c) and repr(transparent) in dead code analysis" rust#127104
**Link:** https://github.com/rust-lang/rust/pull/127104
### "Better errors with bad/missing identifiers in MBEs" rust#118939
**Link:** https://github.com/rust-lang/rust/pull/118939
### "Rename `AsyncIterator` back to `Stream`, introduce an AFIT-based `AsyncIterator` trait" rust#119550
**Link:** https://github.com/rust-lang/rust/pull/119550
### "Allow `#[deny]` inside `#[forbid]` as a no-op" rust#121560
**Link:** https://github.com/rust-lang/rust/pull/121560
## Proposed FCPs
**Check your boxes!**
### "Stabilize opaque type precise capturing (RFC 3617)" rust#127672
**Link:** https://github.com/rust-lang/rust/pull/127672
### "Decide on path forward for attributes on expressions" rust#127436
**Link:** https://github.com/rust-lang/rust/issues/127436
### "Stabilize `raw_ref_op` (RFC 2582)" rust#127679
**Link:** https://github.com/rust-lang/rust/pull/127679
### "Guard Patterns" rfcs#3637
**Link:** https://github.com/rust-lang/rfcs/pull/3637
### "`repr(tag = ...)` for type aliases" rfcs#3659
**Link:** https://github.com/rust-lang/rfcs/pull/3659
### "Stabilize `count`, `ignore`, `index`, and `length` (`macro_metavar_expr`)" rust#122808
**Link:** https://github.com/rust-lang/rust/pull/122808
### "Add support for `use Trait::func`" rfcs#3591
**Link:** https://github.com/rust-lang/rfcs/pull/3591
### "Supertrait item shadowing v2" rfcs#3624
**Link:** https://github.com/rust-lang/rfcs/pull/3624
### "Stabilize `anonymous_lifetime_in_impl_trait`" rust#107378
**Link:** https://github.com/rust-lang/rust/pull/107378
### "[RFC] externally implementable functions" rfcs#3632
**Link:** https://github.com/rust-lang/rfcs/pull/3632
### "Implement `PartialOrd` and `Ord` for `Discriminant`" rust#106418
**Link:** https://github.com/rust-lang/rust/pull/106418
### "Policy for lint expansions" rust#122759
**Link:** https://github.com/rust-lang/rust/issues/122759
### "Don't allow unwinding from Drop impls" rfcs#3288
**Link:** https://github.com/rust-lang/rfcs/pull/3288
### "Add text for the CFG OS Version RFC" rfcs#3379
**Link:** https://github.com/rust-lang/rfcs/pull/3379
### "[RFC] Add `#[export_ordinal(n)]` attribute" rfcs#3641
**Link:** https://github.com/rust-lang/rfcs/pull/3641
### "Tracking Issue for enum access in offset_of" rust#120141
**Link:** https://github.com/rust-lang/rust/issues/120141
### "Stabilize associated type position impl Trait (ATPIT)" rust#120700
**Link:** https://github.com/rust-lang/rust/pull/120700
## Active FCPs
### "Async closures" rfcs#3668
**Link:** https://github.com/rust-lang/rfcs/pull/3668
### "add float semantics RFC" rfcs#3514
**Link:** https://github.com/rust-lang/rfcs/pull/3514
### "RFC for project goals" rfcs#3672
**Link:** https://github.com/rust-lang/rfcs/pull/3672
### "Tracking Issue for nested field access in offset_of" rust#120140
**Link:** https://github.com/rust-lang/rust/issues/120140
## P-critical issues
None.