-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Make PlaceMention a non-mutating use. #110826
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
@@ -1251,6 +1251,8 @@ pub enum NonMutatingUseContext { | |||
UniqueBorrow, | |||
/// AddressOf for *const pointer. | |||
AddressOf, | |||
/// PlaceMention statement. |
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.
Might be worth adding a clarifying comment on why this is here, given that it used to be in the wrong category.
Inspect | Copy | Move | SharedBorrow | ShallowBorrow | UniqueBorrow | AddressOf | ||
| Projection, | ||
Inspect | Copy | Move | PlaceMention | SharedBorrow | ShallowBorrow | UniqueBorrow | ||
| AddressOf | Projection, |
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.
Looks like we're going from invariant to covariant here? If intentional, probably a behavior change that would need a types FCP?
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'd consider this more of a bugfix for #104844, which is still on nightly.
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.
Ok, I'm going to cc @rust-lang/types here to get some eyes on this. From my understanding it's probably fine, but I'm definitely not a qualified reviewer
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.
being covariant is fine here 👍
I'd be very happy to do that if we can. My concern is just that |
a82e082
to
4ec76df
Compare
lgtm modulo the variance change |
@bors r=JakobDegen,lcnr |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#108865 (Add a `sysroot` crate to represent the standard library crates) - rust-lang#110651 (libtest: include test output in junit xml reports) - rust-lang#110826 (Make PlaceMention a non-mutating use.) - rust-lang#110982 (Do not recurse into const generic args when resolving self lifetime elision.) - rust-lang#111009 (Add `ascii::Char` (ACP#179)) - rust-lang#111100 (check array type of repeat exprs is wf) - rust-lang#111186 (Add `is_positive` method for signed non-zero integers.) - rust-lang#111201 (bootstrap: add .gitmodules to the sources) Failed merges: - rust-lang#110954 (Reject borrows of projections in ConstProp.) r? `@ghost` `@rustbot` modify labels: rollup
Fixes #110781
r? @JakobDegen
I don't agree with your statement in #110781 (comment). I suggest that we start fixing
PlaceContext
to be accurate enough for optimizations to use it. This structure is very convenient to use in visitors, and we perhaps have an opportunity to make it less of a footgun.