-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Dont suggest use<impl Trait>
when we have an edition-2024-related borrowck issue
#132816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7e98aa5
to
a1f9d5b
Compare
@@ -1792,6 +1793,130 @@ impl Subdiagnostic for AddPreciseCapturingAndParams { | |||
self.suggs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cribbed a lot of the diagnostics logic from this subdiagnostic I previously implemented; unfortunately, not enough logic is common enough for this to be shared :/
LL | fn apit2<U, T: Sized>(_: &T, _: U) -> impl Sized + use<U, T> {} | ||
| ++++++++++ ~ +++++++++++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T: Sized
is a bit meh but also I literally dgaf b/c it's still valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks like a reasonable suggestion to me, it's perfectly fine (heh) if it's not perfect.
@bors r+ rollup |
…iaskrgr Rollup of 2 pull requests Successful merges: - rust-lang#132136 (ABI compatibility: remove section on target features) - rust-lang#132816 (Dont suggest `use<impl Trait>` when we have an edition-2024-related borrowck issue) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132816 - compiler-errors:2024-apit, r=jieyouxu Dont suggest `use<impl Trait>` when we have an edition-2024-related borrowck issue rust-lang#131186 implements some machinery to detect in borrowck when we may have RPIT overcaptures due to edition 2024, and suggests adding `+ use<'a, T>` to go back to the edition 2021 capture rules. However, we weren't filtering out cases when there are APITs in scope. This PR implements a more sophisticated diagnostic where we will suggest turning any APITs in scope into type parameters, and applies this to both the borrowck error note, and to the `impl_trait_overcaptures` migration lint. cc rust-lang#132809
Dont suggest `use<impl Trait>` when we have an edition-2024-related borrowck issue rust-lang#131186 implements some machinery to detect in borrowck when we may have RPIT overcaptures due to edition 2024, and suggests adding `+ use<'a, T>` to go back to the edition 2021 capture rules. However, we weren't filtering out cases when there are APITs in scope. This PR implements a more sophisticated diagnostic where we will suggest turning any APITs in scope into type parameters, and applies this to both the borrowck error note, and to the `impl_trait_overcaptures` migration lint. cc rust-lang#132809
…iaskrgr Rollup of 2 pull requests Successful merges: - rust-lang#132136 (ABI compatibility: remove section on target features) - rust-lang#132816 (Dont suggest `use<impl Trait>` when we have an edition-2024-related borrowck issue) r? `@ghost` `@rustbot` modify labels: rollup
#131186 implements some machinery to detect in borrowck when we may have RPIT overcaptures due to edition 2024, and suggests adding
+ use<'a, T>
to go back to the edition 2021 capture rules. However, we weren't filtering out cases when there are APITs in scope.This PR implements a more sophisticated diagnostic where we will suggest turning any APITs in scope into type parameters, and applies this to both the borrowck error note, and to the
impl_trait_overcaptures
migration lint.cc #132809