--- title: Triage meeting 2024-01-10 tags: ["T-lang", "triage-meeting", "minutes"] date: 2024-01-10 discussion: https://hackmd.io/NdSvK7MBTs2ZVnMP7fgiPw url: https://hackmd.io/NdSvK7MBTs2ZVnMP7fgiPw --- # T-lang meeting agenda - Meeting date: 2024-01-10 ## Attendance - People: TC, tmandry, Josh, pnkfelix, Urgau, fmease, Waffle, eholk, Lukas Wirth, scottmcm ## Meeting roles - Minutes, driver: TC ## Scheduled meetings - 2024-01-10: "Discuss Rust 2024 edition planning: 2024-01-10" [#248](https://github.com/rust-lang/lang-team/issues/248) - 2024-01-17: "Discuss RFC 2442: Simple postfix macros" [#247](https://github.com/rust-lang/lang-team/issues/247) - 2024-01-24: "Bounds for RPIT/RPITIT/async fn" [#246](https://github.com/rust-lang/lang-team/issues/246) - 2024-01-31: "Design meeting: Rust for Linux" [#240](https://github.com/rust-lang/lang-team/issues/240) 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!) ### New calendar ICS URL If you use a calendar to track recurring lang team meetings, please update the URL for the ICS file to: https://rust-lang.github.io/calendar/lang.ics For context see: https://rust-lang.zulipchat.com/#narrow/stream/410673-t-lang.2Fmeetings/topic/New.20calendar.20ICS.20URL ## Nominated RFCs, PRs, and issues ### "dead_code suggestion for unused fields does not account for changes to auto trait implementations" rust#119645 **Link:** https://github.com/rust-lang/rust/issues/119645 TC: We recently decided in... https://github.com/rust-lang/rust/pull/118297 ...to lint against unused tuple struct fields. This caused people to notice that the suggestion to remove certain fields, whether tuple or field structs, could change the auto traits implemented by that struct. The proposed solution is to mention `PhantomData` and how it might be used in the lint message. Are we OK with this? tmandry: Would we make the suggestion only when removing the field would change the auto traits, or would we always put it there? TC: That was unclear to me in the proposal on Zulip. tmandry: It could be confusing to put it there always. JT: For a private struct, we may not want to lint either. Waffle: Private structs can affect public APIs because of auto trait leakage. JT: Sure, I suppose I should say whether it ever ends up in a public ADT. pnkfelix: In principle we could figure that out, but that would be a more complicated analysis. JT: Maybe we should just suggest `()` and *maybe* mention that removing fields could affect auto traits. pnkfelix: The other direction to go would be to say that fields that affect auto traits are not unused. JT: We've already been doing this on field structs. tmandry: Particularly for tuple structs, removing the field while preserving semantics could be annoying. TC: That's why they want to suggest `PhantomData`. An unused struct field can always (modulo the below issue) be replaced by `PhantomData`. tmandry: Right. Actually, in consideration of that, I think this proposal is fine, including suggesting `PhantomData`. JT: I'd be OK if we could only lint when it would matter. Could we do that? Waffle: Probably. tmandry: There are other things it could affect, such as variance. *Consensus*: Let's ask whether we can make that suggestion in the lint only if the removal of the field would affect the auto traits of the struct, and if so, then we have a consensus to do that. ### "dead_code suggestion would break the semantics of code using`#[repr(transparent)]`" rust#119659 **Link:** https://github.com/rust-lang/rust/issues/119659 TC: We recently decided in... https://github.com/rust-lang/rust/pull/118297 ...to lint against unused tuple struct fields. This caused people to notice that the suggestion to remove certain fields, whether tuple or field structs, could change the correctness of code using such structs when those structs are marked `#[repr(transparent)]`. We already suppress the lint for structs marked `#[repr(C)]`. The proposed is to suppress it for `#[repr(transparent)]` also. Are we OK with this? JT: This one is completely valid. Makes perfect sense. tmandry: +1. pnkfelix: +1. *Consensus*: Let's do this. ### "Discuss ideas for GSoC 2024" lang-team#249 **Link:** https://github.com/rust-lang/lang-team/issues/249 TC: On the Zulip stream for the foundation, there has been recent discussion of coming up with projects for which to apply to Google Summer of Code: https://rust-lang.zulipchat.com/#narrow/stream/335408-foundation/topic/Google.20Summer.20of.20Code.20and.20idea.20list Jakub Beránek has drafted a document with some ideas here: https://hackmd.io/hJhkRIJ5RneLXkQp9p8Xng Our representative on the council, Jack Huey, has asked that we discuss this to see whether we have ideas for GSoC projects. The application deadline is 2024-02-06. Do we have ideas or ideas on a process for generating those ideas? JT: Maybe we could discuss it on Zulip and brainstorm there. scottmcm: The foundation has some extra funding than they were expecting. We might also keep in mind, as we're brainstorming, that even if something isn't funded for GSoC, it may still be something we'd want the foundation to fund. *Consensus*: Let's open a thread on Zulip. --- *Post-meeting notes*: That thread is: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Ideas.20for.20GSoC.202024 ### "Arbitrary self types v2" rfcs#3519 **Link:** https://github.com/rust-lang/rfcs/pull/3519 TC: We discussed this on 2023-11-22. The general feeling seemed to be that we wanted to find some way to enable this, including for raw pointers, `NonNull`, etc., but we were feeling unsure about the path to get there. We asked the author to cogitate on this and come back with a revised plan. The author has laid out an extensive revised plan in three comments that starts here: https://github.com/rust-lang/rfcs/pull/3519#issuecomment-1856141480 It's about 2000 words, so it will take a few minutes to read. In a recent [issue](https://github.com/rust-lang/rust/pull/118806), T-libs-api indicated they were waiting to see what we were going to do with this RFC before making certain other decisions. Given the length of the update, perhaps let's all just take a note to have a look at this so we can discuss next week. JT: Concretely, there are places in the standard library where we may want to use arbitrary self types -- in particular the raw pointer version of a self type -- but we don't want t to do that unless it's on a path to stabilization. *Consensus*: Let's read and discuss next week. ### "Avoid non-local definitions in functions" rfcs#3373 **Link:** https://github.com/rust-lang/rfcs/pull/3373 TC: This is the RFC is about "sneaky inner impls", e.g.: ```rust trait Trait {} struct S; fn foo() { impl Trait for S {} } ``` We discussed this in the 2024-01-03 meeting and decided to update the RFC to say that we would warn-by-default in these cases immediately and would later consider what to do in Rust 2024 and Rust 2027. To address a known use case for macros, this does not propose to lint for anonymous `const` initializers. These updates have now been made and there is a proposed FCP merge in progress. This is just a heads-up before we unnominate unless people have anything to discuss here. scottmcm: If this is a "let's just lint about it", it feels odd that it has the full power of an RFC. It feels like linting about it is something that clippy could go do today. JT: Clippy could, but we're talking about rustc doing it. TC: We could rephrase scottmcm's point to be that we could do this by FCP on some issue. JT: True, but this is already written up and it suggests a direction. pnkfelix: The fact that it's just a lint now is an artifact of what we asked for. scottmcm: I feel like we're not going to make this a hard error in Rust 2024, as if we wanted to do that, from a timeline perspective, we'd need to be accepting that in the RFC now. JT: The RFC says only we might consider making it deny-by-default in Rust 2024. tmandry: We'll find a bunch of cases by linting against this now. *Consensus*: Let's all have a look at the revised RFC. --- *Post-meeting notes*: This entered FCP immediately after the meeting. ### "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, and since it may affect how we can lint, perhaps we want to discuss that. scottmcm: The other thing we can look at is [`byte_offset_from`](https://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.byte_offset_from-1) as that also has separate generics. tmandry: I'm having trouble thinking of cases where people would want to do this. JT: If we're proposing people replace `==` on pointers with this, then semantically, we'd allow arbitrary comparsions. Tyler: Does this allow comparing function types, or just function pointers? Should it? scottmcm: It could make sense to require people to cast the unnameable function types. pnkfelix: There's an open discussion about the type equality of functions of higher ranked lifetimes. That may suggest allowing comparison of different types here. See, e.g., this discussion: <https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Would.20you.20expect.20these.20to.20be.20the.20same.20type.3F/near/412001531> tmandry: That could suggest maybe a more limited form of generality here. I do think there should be an escape hatch here. TC: One could always cast the function pointers to `*const ()` and compare those directly or with `ptr::addr_eq`. scottmcm: Can you do that, or do you need transmute? Waffle: You can do it in safe code: <https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0a8dfd97897ff002d7cbd0e1899f71dd> ```rust fn cast(x: fn()) -> *const () { x as *const () } ``` waffle: Also, note that Voldemort types (i.e. unnameable types) don't implement `FnPtr`. scottmcm: Having two generics here will affect type inference, e.g. if you have a type on the LHS and no type on the RHS. You probably don't want the type inference to flow from the LHS to the RHS in such cases. TC: At the end of the day, function pointers are data, and the name of the function implies we're comparing the *address*, so the analogy to `ptr::addr_eq` seems compelling. JT: We could consider stabilizing the `FnPtr` trait if we want to offer an escape hatch to let people compare different types. tmandry: I think the analogy to data pointers is somewhat misleading. The byte_offset example makes sense when you have a struct -- that makes sense. The comparable operations don't make sense for functions. I do question whether addr_eq is the right signature, for the same reasons. JT: Worth noting that our `PartialEq` impl that this is replacing does require things to be the same type. tmandry: scottmcm's point is valid about flowing type inference, but it's not the high bit in my decision here. scottmcm: I agree the type inference point is not the high order bit. It's extremely important that the equals operator flows type information. scottmcm: `addr_eq` is stable for Rust 1.76 on nightly. So if tmandry, you don't think that's the right signature, then we should discuss that soon. tmandry: Is there a rationale for the current signature? scottmcm: E.g., I want to check whether my thin pointer is the same addr as the wide pointer, or compare the address of the struct to the address of the first field. JT: Do we agree about not changing the `fn_addr_eq` signature? scottmcm: I'm not certain about that yet. TC: Let's maybe write down our thoughts; that may trigger thoughts from others, then we can take this back up. scottmcm: +1. *Consensus*: Let's write down our thoughts on this on the GitHub issue or on Zulip, then we'll take this back up. --- *Post-meeting notes*: TC: Here is the request we made to add `ptr::addr_eq`: https://github.com/rust-lang/libs-team/issues/274 It was implemented here: https://github.com/rust-lang/rust/pull/116325 And the tracking issue is: https://github.com/rust-lang/rust/issues/116324 The original issue motivating our unhappiness was here: https://github.com/rust-lang/rust/issues/106447 The `ptr::addr_eq` function is scheduled to be stabilized with Rust 1.76, so we need to act quickly if we may want to revert this stabilizaton. As pnkfelix noted, type equality between function pointers can be a bit subtle and surprising at the moment. The underlying issue for that is: https://github.com/rust-lang/rust/issues/97156 And it's under discussion on Zulip here: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Would.20you.20expect.20these.20to.20be.20the.20same.20type.3F/near/412001531 Regarding potentially reverting the stabilization of `ptr::addr_eq`, we've opened a thread to discuss that here: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Signature.20of.20.60ptr.3A.3Aaddr_eq.60 And regarding the signature of `ptr::fn_addr_eq` (and alternatives that include not adding it at all), we've opened a discussion here: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Signature.20of.20.60ptr.3A.3Afn_addr_eq.60 --- Also [raised](https://github.com/rust-lang/rust/pull/118833#issuecomment-1873496176) after our last talk is one interesting use case: the standard library uses function pointer comparisons to implement [`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`. Would we lint on derived `PartialEq` cases like these or no? TC: Did we talk about what to do in these cases? JT: Maybe we did. We talked about e.g. sticking these in a hash table. We said we wouldn't warn in a generic context. TC: On the other hand, this isn't a generic case. tmandry: This is an interesting case. I'd have to think about it. There's definitely a chance of a false negative here. That doesn't seem documented here. We should probably do that. *Consensus*: Let's think further about this. (The meeting ended here.) --- *Post-meeting notes*: TC: On this subject of function pointer comparison and `PartialEq`, we've opened a discussion of this here: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Function.20pointer.20comparison.20and.20.60PartialEq.60 --- ### "Tracking Issue for cfg-target-abi" rust#80970 **Link:** https://github.com/rust-lang/rust/issues/80970 TC: Chris Denton proposes to stabilize `#[cfg(target_abi = "..")]`: > ## Stabilization report > > I propose to stabilize `#[cfg(target_abi = "...")]`, This implements [RFC-2992](https://rust-lang.github.io/rfcs/2992-cfg-target-abi.html) (cfg-target-abi). The implementation was completed in #86922 and this tracking issue was subsequently marked as ready for stabilization by @joshtriplett. > > ### Summary > > This stabilizes the `cfg` option called `target_abi`: > > ```rust > #[cfg(target_abi = "macabi")] > ``` > > And `target_abi` is also shown when using `--print=cfg` (output snipped for length): > > ``` > > rustc --print=cfg --target aarch64-apple-ios-sim > > target_abi="sim" > target_arch="aarch64" > target_env="" > target_os="ios" > target_vendor="apple" > ``` > > Without `target_abi`, cfgs are limited to `target_arch`, `target_vendor`, `target_os`, and `target_env`. However, some targets are only differentiated by their abi and thus it's necessary to resort to parsing the full target string in a build script when there's a need to disambiguate. For example, the following targets are the same if only using stable `target_*` `cfg`s: > > * `aarch64-apple-ios` and `aarch64-apple-ios-sim` (arch: "aarch64", vendor: "apple", os: "ios", env: "") > * `x86_64-pc-windows-gnullvm` and `x86_64-pc-windows-gnu` (arch: "`x86_64", vendor: "pc", os: "windows", env: "gnu") > > ### Notes > > The `target_abi` defaults to `""` (the empty string) and most targets don't set it. This is similar to `target_env` where if it's not needed for disambiguation then it's often not set. > > In the future `target_abi` could be an array of zero or more properties that affect the ABI (e.g. `softfloat` may be combined with other ABI properties), However, this feature can be added later without breaking compatibility. TC: Given the recent discussions over ABI issues, I made sure RalfJ was aware of this, and he had no particular concerns. ### "Make `ConstPropLint` lint run on promoteds" rust#119432 **Link:** https://github.com/rust-lang/rust/pull/119432 TC: Oli nominates this for us: > Nominating for T-lang for awareness.... TLDR: existing lints will trigger in more situations where we were missing them before. In our test suite this causes duplicate lint emissions, but they are deduplicated for users. gurry: > Fixes #117949 wherein the lint didn't fire for the following promoteds: > > * SHL or SHR operators in a non-optimized build > * any arithmetic operator in an optimized build > > What I have done here is simply enabled `ConstPropLint` to run on promoted bodies by removing the relevant `if` check. > > After this change _all_ promoted arithmetic operators will lint _in both non-optimized and optimized builds_. On the flip side programs containing the above mentioned overflowing promoteds that were accepted earlier will now be rejected. Hope that is okay from a backward compatibility standpoint. > > I have added tests covering all overflowing promoted & non-promoted ops for both compile-time and runtime operations and for optimized as well as non-optimized builds. > > I had to amend some existing tests to make them pass and had to delete a couple that were set to pass despite overflows. > > This PR increases the number of duplicate diagnostics emitted (because the same operator might get linted in both the promoted MIR and the main MIR). I hope that is an acceptable trade-off given that we now lint overflows much more comprehensively than earlier. What do we think? ### "Detect `NulInCStr` error earlier." rust#119172 **Link:** https://github.com/rust-lang/rust/pull/119172 TC: nnethercote nominated this for us: > [Detect `NulInCStr` error earlier by] making it an `EscapeError` instead of a `LitError`. This makes it like the other errors produced when checking string literals contents, e.g. for invalid escape sequences or bare CR chars. > > NOTE: this means these errors are issued earlier, before expansion, which changes behaviour. It will be possible to move the check back to the later point if desired. If that happens, it's likely that all the string literal contents checks will be delayed together. > > One nice thing about this: the old approach had some code in `report_lit_error` to calculate the span of the nul char from a range. This code used a hardwired `+2` to account for the `c"` at the start of a C string literal, but this should have changed to a `+3` for raw C string literals to account for the `cr"`, which meant that the caret in `cr"` nul error messages was one short of where it should have been. The new approach doesn't need any of this and avoids the off-by-one error. > > In short, the delayed C NUL str check is inconsistent with all other string literal checks. If it ships in its current state, we're stuck with that behaviour permanently. If we move it earlier right now before it ships, we have the option to delay it (and all other string literal checks) later on (as implemented in #118699). So if we do this in the next few days, we avoid a one-way door shutting. (This also has some relationship with: https://github.com/rust-lang/rust/pull/118699) TC: On the basis of this observation, we decided to revert the stabilization of C string literals from Rust 1.76: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/rfc.203349.3A.20mixed.20utf8.20literals TC: However, we still need to decide the issue before we can move to restabilize. 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? ### "Decision: semantics of the `#[expect]` attribute" rust#115980 **Link:** https://github.com/rust-lang/rust/issues/115980 TC: @nikomatsakis gives this background: > This issue is spun out from #54503 to serve as the decision issue for a specific question. The question is what the 'mental model' for the `expect` attribute should be. Two proposed options: > > 1. The expectation is fulfilled, if a #[warn] attribute in the same location would cause a diagnostic to be emitted. The suppression of this diagnostic fulfills the expectation. ([src](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Expect.20attribute.20mental.20model/near/341522535)) (Current implementation in rustc) > 2. The expectation is fulfilled if removing the `#[expect]` attribute would cause the warning to be emitted. ([src](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Expect.20attribute.20mental.20model/near/354082551)) > > @xFrednet created a [list of use cases](https://hackmd.io/@xFrednet/expect-attr-use-cases) to help with the discussion of these two models; they found both models work equally well, except for [use case 4](https://hackmd.io/@xFrednet/expect-attr-use-cases#Use-case-4-Suppress-lints-from-CI) which would only be possible with the first model. TC: ...and proposes that we adopt option 1. ### "`.await` does not perform autoref or autoderef" rust#111546 **Link:** https://github.com/rust-lang/rust/issues/111546 TC: This was nominated for T-lang by WG-async. @tmandry said: > We discussed this in a recent wg-async meeting ([notes](https://hackmd.io/G6ULofyXSIS4CK9u-jwYRg)). The consensus was that we thought the change was well-motivated. At the same time, we want to be cautious about introducing problems (namely backwards compatibility). > > There should probably be a crater run of this change, and we should also work through any problematic interactions that could be caused by this change. (@rust-lang/types should probably weigh in.) > > The main motivation for the change is the analogy to `.method()`, as well as to wanting async and sync to feel similarly convenient in most cases. > > Note that there is another analogy that works against this, the analogy to `IntoIterator`, where the lang-effect form (`for _ in foo {}`) does not do autoref/autoderef. However, given that this _looks_ very different from `foo.await`, and taking a reference with that form is significantly more convenient (`for x in &foo` or `for x in foo.iter()` vs `(&foo).await`), it seemed the analogy was stretched pretty thin. So we elected to put more weight on the above two considerations. > > That being said, this change would need lang team signoff. You can consider this comment wg-async's official recommendation to the lang team. TC: There's now been a crater run done for this. The result was that this breaks a small number of crates, but at least one of those crates has a large number of dependencies (`aws-smithy-runtime`). It can be fixed in the dependency in such a way that dependent crates do not have to make changes, but those dependent crates would need to update to a fixed version of the dependency. (See this [discussion](https://rust-lang.zulipchat.com/#narrow/stream/187312-wg-async/topic/Perform.20autoref.2Fautoderef.20on.20.2Eawait.20-.20.23111773).) TC: What do we think? ### "Add `wasm_c_abi` `future-incompat` lint" rust#117918 **Link:** https://github.com/rust-lang/rust/pull/117918 TC: daxpedda gives the context: > This is a warning that will tell users to update to `wasm-bindgen` v0.2.88, which supports spec-compliant C ABI. > > The idea is to prepare for a future where Rust will switch to the spec-compliant C ABI by default; so not to break everyone's world, this warning is introduced. > > Addresses https://github.com/rust-lang/rust/issues/71871 TC: Is this something we want to do? ### "Support overriding `warnings` level for a specific lint via command line" rust#113307 **Link:** https://github.com/rust-lang/rust/pull/113307 TC: We discussed in the 2023-09-26 meeting, but were unsure of the question we were being asked. @jieyouxu has since replied: > I believe I wanted to ask that if the command line indeed forms the root of the tree, or if it actually overrides the source annotations. TC: On that basis, @tmandry replied: > ### Nesting > > I think the command line (specifically `-A`, `-W`, `-D` flags) should form the root of the tree. We have `--cap-lints`, `--force-warn`, and `-F` (forbid) for overriding the source. (Actually the mental model documented in the [rustc book](https://doc.rust-lang.org/rustc/lints/levels.html) is that `force-warn` and `forbid` still form the root of the tree, but cannot be overridden; I think the distinction is mostly academic.) > > That's almost all the expressive power one could want along this axis. One wrinkle is that `--forbid` is overridden by `--cap-lints`, while `--force-warn` is not. If we wanted full fine-grained control we could always add `--force-allow` and `--force-deny`. > > ### `warnings` > > Regarding the meaning of `warnings`, it _is_ a simpler mental model for this to mean "the set of things that are warn-by-default". But this ignores what I perceive to be a common (and valid) use case, which is to disallow _all_ warnings in a codebase: In other words, prevent code from being checked in that causes warnings to be printed to a user's screen. Of course, for this to be practical one must control the version of rustc being used to build a codebase, but that is common in monorepo setups. > > ### Conclusion > > Given that there is an existing use case that relies on documented behavior, I think we should continue to treat `warnings` as a "redirect" for all warnings that come out of a particular level of the tree. Interpreting `-Awarnings -Wfoo` in the way proposed by this PR would muddy the (already complicated) mental model and add inconsistency between CLI and the command line, as noted by @oli-obk. > > A different group, like `default-warnings`, could be used to mean "the set of things that are warn-by-default". The compiler could further warn users that specify `-Awarnings -Wfoo` on the command line to use `-Adefault-warnings -Wfoo` instead. TC: Where do we want to go from here? ### "`refining_impl_trait` only fires on public traits" rust#119535 **Link:** https://github.com/rust-lang/rust/issues/119535 TC: We recently in Rust 1.75 stabilized RPITIT/AFIT. Along with that, somewhat unusually, we stabilized two "please confirm you understand how Rust works" lints against the new feature. One lint is `async_fn_in_trait`: ```rust pub trait Foo { async fn foo() -> impl Sized; //~^ WARN use of `async fn` in public traits is discouraged as auto trait bounds cannot be specified //~| NOTE you can suppress this lint if you plan to use the trait only in your own code, or do not care about auto traits like `Send` on the `Future` //~| NOTE `#[warn(async_fn_in_trait)]` on by default //~| HELP you can alternatively desugar to a normal `fn` that returns `impl Future` and add any desired bounds such as `Send`, but these cannot be relaxed without a breaking API change } ``` The other is `refining_impl_trait`: ```rust pub trait Foo { fn foo() -> impl Sized; } impl Foo for () { fn foo() -> () {} //~^ WARN impl trait in impl method signature does not match trait method signature //~| NOTE add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate //~| NOTE `#[warn(refining_impl_trait)]` on by default //~| HELP replace the return type so that it matches the trait } ``` TC: We decided to make the first lint fire only when the trait is crate public. We did the same for the second lint but it was discussed less explicitly. TC: tmandry proposes that we make the second lint always fire: > - The `async fn` lint is only temporary to help avoid footguns created by missing language features, and we want to make non-footgunny uses more convenient. > - Refinement is a mechanism that will always exist and is fundamental to trait implementations. > - Refinement's ability to "punch through" abstraction boundaries can happen accidentally, even within a crate. TC: CE has advocated to keeping it so that the lint only fires for publicly-reachable traits: > My understanding was that private traits are always crate-local, and be always fixed in a non-semver-breaking way, so it makes no sense to bug people about things local to their crate. > > The refines lint being public-only has to do with the fact that refinement is a possibly-accidental over-promising of trait bounds on an implementation. when that implementation is published as part of a public (and reachable) trait in a library, then it becomes a breaking change to remove it. It doesn't make sense to enforce that internally within a crate, imo. TC: What do we think? ### "RFC: Syntax for embedding cargo-script manifests" rfcs#3503 **Link:** https://github.com/rust-lang/rfcs/pull/3503 TC: We discussed this for most of one triage meeting in November without reaching any consensus. There is a design meeting proposal, but we have not yet scheduled it for a date. At Josh's suggestion, Ed Page has renominated this for us. Earlier context included: > @**scottmcm** raised these interesting points: > > > My biggest question here is how much it should be thought of as tied to the script use, and thus to the `#!`. > > > > My instinct is that either > > > > 1. This is tied to the shebang, so there's only one of them, to be consumed only by whatever tool is in the shebang, and rustc completely ignores it, like we completely ignore the shebang line. And thus the "`` ``` `` right after the shebang" syntax seems entirely reasonable to me. > > 2. This is a general tool feature, for which there will be multiple of them, and for which they'd want something like tool attribute namespacing so there's a clear route to lots of them under understood namespaces, and are a full part of the parsed structure of the crate, maybe included in rustdoc, etc. (Like perhaps `--document-private-items` on a crate would show an embedded `rustfmt::config` block somewhere, one day.) > > @**nikomatsakis** noted that, even if it's tied to a shebang, he doesn't see a reason to limit it to only one. > > @**tmandry** suggested that: > > > With my lang hat on, I don't see a reason we should RFC a feature that only allows `cargo` front matter, without specifying a path to generalizing it to other tooling. If we want to be conservative in what we stabilize, let's approach that in the stabilization rather than in the RFC. > > In the meeting, @**nikomatsakis** suggested that we seem misaligned on the purpose of this. Others in the meeting suggested that the syntax should derive from a clear understanding of that purpose and the eventual goals for it. TC: We've since discussed this asynchronously here: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Syntax.20for.20embedded.20tooling.20metadata/near/409126434 We seemed to agree that: - `.rs` files should parse as valid Rust. - I.e., we don't want to expect the runner to have to strip out these blocks. - Rust itself should not validate the content of these blocks. The open questions include: - Should there be only one of these blocks or potentially many? - If we only support one block, tools that need many will define their own syntax for delineation. - It could be awkward to change our mind later on this, as tools will have already defined this delineation in their own SemVer commitments. - Supporting only one is simpler (for us) and gives tools flexibility. - But if we want IDEs to eventually support syntax highlighting for these blocks (e.g. based on the file type indicated in the info string), then we probably need to handle this ourselves. - tmandry: "Making that kind of editor integration possible is important to me, even though I expect that many editors won't support that level of generality in their syntax definitions today." - Relatedly, do we want to support info strings? - Should the shebang be optional or required when using these blocks? - It's more conventional for the shebang to be optional. - If it's required, people may end up writing e.g. `#!/bin/false` as a workaround. - The shebang is meaningless for Windows. - What syntax to use? - Triple (or more) backticks. - Upside: Beginners may prefer this, but of course they would due to Markdown familiarity. - Downside: Even figuring out how to encode those backticks literally in this document is difficult. Users would need to know advanced Markdown to encode these Rust files. Some markdown parsers (e.g. the one for Discord) are not sophisticated enough to allow this. - tmandry: "I think that is a serious quality of life hazard we should be cognizant of. If I were to boil it down to a principle I would say that Rust should feel pleasant to use, and that includes in places like github comments, chatrooms, and forums, where many people write Rust code every day!" - Downside: It's a new matched string literal syntax when Rust already uses `#` for this. - Triple (or more) hashes (`###`). - Upside: This would look natural with the shebang and would suggest association with the shebang. - Upside: Rust already uses matched `#`s for literals. - Downside: We may want a space before the info string. - Triple (or more) dashes (`---`). - Upside/downside: This is associated with YAML header blocks. - Downside: It's a new matched string literal syntax when Rust already uses `#` for this. - Downside: This may look less natural with an info string, or we may want a space before it. There is an open experiment on the `cargo` side that simulates the various syntax options, e.g.: - https://github.com/rust-lang/cargo/pull/13241 - https://github.com/rust-lang/cargo/pull/13247 TC: What do we think? ### "TAIT decision on whether nested inner items may define" rust#117860 **Link:** https://github.com/rust-lang/rust/issues/117860 TC: The question is whether this should be true: > Unless and until [RFC PR 3373](https://github.com/rust-lang/rfcs/pull/3373) is accepted and scheduled for stabilization in some future edition, items nested inside of other items may define the hidden type for opaques declared outside of those items without those items having to recursively be allowed to define the hidden type themselves. The context is that we allow this: ```rust trait Trait {} struct S; const _: () = { impl Trait for S {} // Allowed. }; ``` Should we accept spiritually-similar TAIT code unless and until we decide to go a different direction with the language? ### "TAIT decision on "may define implies must define"" rust#117861 **Link:** https://github.com/rust-lang/rust/issues/117861 **Link:** https://github.com/rust-lang/rust/pull/113169 TC: The question is whether this should be true: > At least until the new trait solver is stabilized, any item that is allowed to define the hidden type of some opaque type *must* define the hidden type of that opaque type. TC: This is important for the new trait solver. TC: Here's one reason for that. The new trait solver treats strictly more code as being a defining use. It's also more willing to reveal the hidden type during inference if that hidden type is defined within the same body. This rule helps to avoid inference changes when moving from the old solver to the new solver. Adding this restriction makes TAIT roughly equivalent to RPIT with respect to these challenges. TC: (This question is entirely orthogonal to how we notate whether an item is allowed to define the hidden type of an opaque.) ### "TAIT decision on "may not define may guide inference"" rust#117865 **Link:** https://github.com/rust-lang/rust/issues/117865 TC: The question is whether this should be true: > The compiler is allowed to rely on whether or not an item is allowed to define the hidden type of an opaque type to guide inference. Here's the door that this would close: > If this rule is adopted, then after TAIT is stabilized, it will not be possible in a fully backward compatible way to later change the rules that determine whether or not an item is allowed to define the hidden type in such a way that an item in existing code that uses an opaque type could switch (without any code changes) from being not allowed to define its hidden type to being allowed to define it. TC: This is of importance to the new trait solver. TC: Here's one reason for this. When we're type checking a body and we find an opaque type, we sometimes have to decide, should we infer this in such a way that this body would define the hidden type, or should we treat the type as opaque (other than auto trait leakage) and infer based on that? Depending on that, we can get different answers. TC: If we did not let inference rely on this, then we would be closing the door on later *allowing* inference to rely on this without provoking changes in inference. TC: (This question is entirely orthogonal to how we notate whether an item is allowed to define the hidden type of an opaque. Answering this question in the affirmative would update one element of the [#107645 FCP][].) [#107645 FCP]: https://github.com/rust-lang/rust/issues/107645#issuecomment-1571789814 ### "Uplift `clippy::precedence` lint" rust#117161 **Link:** https://github.com/rust-lang/rust/pull/117161 TC: The proposal is to lint against: ```rust -2.pow(2); // Equals -4. 1 << 2 + 3; // Equals 32. ``` These would instead be written: ```rust -(2.pow(2)); // Equals -4. 1 << (2 + 3); // Equals 32. ``` Prompts for discussion: - Is this an appropriate lint for `rustc`? - How do other languages handle precedence here? - Is minus special enough to treat differently than other unary operators? ### "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. ## 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 ## RFCs waiting to be merged None. ## `S-waiting-on-team` ### "Stabilize `anonymous_lifetime_in_impl_trait`" rust#107378 **Link:** https://github.com/rust-lang/rust/pull/107378 ### "make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern" rust#116284 **Link:** https://github.com/rust-lang/rust/pull/116284 ### "Fix `non_camel_case_types` for screaming single-words" rust#116389 **Link:** https://github.com/rust-lang/rust/pull/116389 ### "warn less about non-exhaustive in ffi" rust#116863 **Link:** https://github.com/rust-lang/rust/pull/116863 ### "Add lint against function pointer comparisons" rust#118833 **Link:** https://github.com/rust-lang/rust/pull/118833 ### "Deny braced macro invocations in let-else" rust#119062 **Link:** https://github.com/rust-lang/rust/pull/119062 ### "Rename `AsyncIterator` back to `Stream`, introduce an AFIT-based `AsyncIterator` trait" rust#119550 **Link:** https://github.com/rust-lang/rust/pull/119550 ## Proposed FCPs **Check your boxes!** ### "RFC: inherent trait implementation" rfcs#2375 **Link:** https://github.com/rust-lang/rfcs/pull/2375 ### "unsafe attributes" rfcs#3325 **Link:** https://github.com/rust-lang/rfcs/pull/3325 ### "MaybeDangling" rfcs#3336 **Link:** https://github.com/rust-lang/rfcs/pull/3336 ### "Avoid non-local definitions in functions" rfcs#3373 **Link:** https://github.com/rust-lang/rfcs/pull/3373 ### "Add text for the CFG OS Version RFC" rfcs#3379 **Link:** https://github.com/rust-lang/rfcs/pull/3379 ### "add float semantics RFC" rfcs#3514 **Link:** https://github.com/rust-lang/rfcs/pull/3514 ### "RFC: patchable-function-entry" rfcs#3543 **Link:** https://github.com/rust-lang/rfcs/pull/3543 ### "Stabilise inline_const" rust#104087 **Link:** https://github.com/rust-lang/rust/pull/104087 ### "Implement `PartialOrd` and `Ord` for `Discriminant`" rust#106418 **Link:** https://github.com/rust-lang/rust/pull/106418 ### "Stabilize `anonymous_lifetime_in_impl_trait`" rust#107378 **Link:** https://github.com/rust-lang/rust/pull/107378 ### "Report monomorphization time errors in dead code, too" rust#112879 **Link:** https://github.com/rust-lang/rust/pull/112879 ### "`c_unwind` full stabilization request: change in `extern "C"` behavior" rust#115285 **Link:** https://github.com/rust-lang/rust/issues/115285 ### "Decision: semantics of the `#[expect]` attribute" rust#115980 **Link:** https://github.com/rust-lang/rust/issues/115980 ### "Fix `non_camel_case_types` for screaming single-words" rust#116389 **Link:** https://github.com/rust-lang/rust/pull/116389 ### "References refer to allocated objects" rust#116677 **Link:** https://github.com/rust-lang/rust/pull/116677 ### "Prevent opaque types being instantiated twice with different regions within the same function" rust#116935 **Link:** https://github.com/rust-lang/rust/pull/116935 ### "Stabilize Wasm target features that are in phase 4 and 5" rust#117457 **Link:** https://github.com/rust-lang/rust/pull/117457 ### "Stabilize Wasm relaxed SIMD" rust#117468 **Link:** https://github.com/rust-lang/rust/pull/117468 ### "static mut: allow mutable reference to arbitrary types, not just slices and arrays" rust#117614 **Link:** https://github.com/rust-lang/rust/pull/117614 ### "Add `REDUNDANT_LIFETIMES` lint to detect lifetimes which are semantically redundant" rust#118391 **Link:** https://github.com/rust-lang/rust/pull/118391 ### "Undeprecate lint `unstable_features` and make use of it in the compiler" rust#118639 **Link:** https://github.com/rust-lang/rust/pull/118639 ### "Warn on references casting to bigger memory layout" rust#118983 **Link:** https://github.com/rust-lang/rust/pull/118983 ## Active FCPs ### "RFC: constants in patterns" rfcs#3535 **Link:** https://github.com/rust-lang/rfcs/pull/3535 ### "revert stabilization of const_intrinsic_copy" rust#117905 **Link:** https://github.com/rust-lang/rust/pull/117905 ### "const-eval interning: get rid of type-driven traversal" rust#119044 **Link:** https://github.com/rust-lang/rust/pull/119044 ### "Deny braced macro invocations in let-else" rust#119062 **Link:** https://github.com/rust-lang/rust/pull/119062 ## P-critical issues None.