mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Flood place on drop
This commit is contained in:
parent
2113e45488
commit
904adcac0f
@ -199,11 +199,15 @@ pub trait ValueAnalysis<'tcx> {
|
||||
self.super_terminator(terminator, state)
|
||||
}
|
||||
|
||||
fn super_terminator(&self, terminator: &Terminator<'tcx>, _state: &mut State<Self::Value>) {
|
||||
fn super_terminator(&self, terminator: &Terminator<'tcx>, state: &mut State<Self::Value>) {
|
||||
match &terminator.kind {
|
||||
TerminatorKind::Call { .. } | TerminatorKind::InlineAsm { .. } => {
|
||||
// Effect is applied by `handle_call_return`.
|
||||
}
|
||||
TerminatorKind::Drop { place, .. } => {
|
||||
// Place can still be accessed after drop, and drop has mutable access to it.
|
||||
state.flood(place.as_ref(), self.map());
|
||||
}
|
||||
TerminatorKind::DropAndReplace { .. } | TerminatorKind::Yield { .. } => {
|
||||
// They would have an effect, but are not allowed in this phase.
|
||||
bug!("encountered disallowed terminator");
|
||||
|
Loading…
Reference in New Issue
Block a user