-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Introduce a no-op PlaceMention
statement for let _ =
.
#102256
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
Changes from all commits
be758ef
4462bb5
e107194
a5ef6ba
b34a8a2
45f2a1a
09dc10c
2eccd52
684de04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -556,6 +556,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { | |
|
||
_ => { | ||
let place_builder = unpack!(block = self.as_place_builder(block, initializer)); | ||
|
||
if let Some(place) = place_builder.try_to_place(self) { | ||
|
||
let source_info = self.source_info(initializer.span); | ||
self.cfg.push_place_mention(block, source_info, place); | ||
} | ||
|
||
self.place_into_pattern(block, &irrefutable_pat, place_builder, true) | ||
} | ||
} | ||
|
@@ -576,6 +582,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { | |
false, | ||
&mut [&mut candidate], | ||
); | ||
|
||
// For matches and function arguments, the place that is being matched | ||
// can be set when creating the variables. But the place for | ||
// let PATTERN = ... might not even exist until we do the assignment. | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
we use
super_statement
here so if the place were to contain some operand which isn't allowed in const contexts this would change behavior. The only thing I was able to think of is the following which is already rejected, so this seems fine 🤷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.
You are right. This would introduce an extra diagnostic for "dereferencing raw mutable pointers in constant functions is unstable". Exactly like unsafeck.
As everything else around raw mutable pointers is already forbidden, I don't think this can break code. Can it?
Added a test.