Skip to content

Commit 6b52a11

Browse files
committed
Auto merge of #42931 - arielb1:statement-visitor, r=eddyb
re-add the call to `super_statement` in EraseRegions The move gathering code is sensitive to type-equality - that is rather un-robust and I plan to fix it eventually, but that's a more invasive change. And we want to fix the visitor anyway. Fixes #42903. r? @eddyb
2 parents 5bc8941 + 71abfa7 commit 6b52a11

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/librustc_mir/transform/erase_regions.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ impl<'a, 'tcx> MutVisitor<'tcx> for EraseRegionsVisitor<'a, 'tcx> {
6767
}
6868

6969
fn visit_statement(&mut self,
70-
_block: BasicBlock,
70+
block: BasicBlock,
7171
statement: &mut Statement<'tcx>,
72-
_location: Location) {
72+
location: Location) {
7373
if let StatementKind::EndRegion(_) = statement.kind {
7474
statement.kind = StatementKind::Nop;
7575
}
76+
self.super_statement(block, statement, location);
7677
}
7778
}
7879

src/test/run-pass/dynamic-drop.rs

+15
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ fn struct_dynamic_drop(a: &Allocator, c0: bool, c1: bool, c: bool) {
106106
}
107107
}
108108

109+
fn field_assignment(a: &Allocator, c0: bool) {
110+
let mut x = (TwoPtrs(a.alloc(), a.alloc()), a.alloc());
111+
112+
x.1 = a.alloc();
113+
x.1 = a.alloc();
114+
115+
let f = (x.0).0;
116+
if c0 {
117+
(x.0).0 = f;
118+
}
119+
}
120+
109121
fn assignment2(a: &Allocator, c0: bool, c1: bool) {
110122
let mut _v = a.alloc();
111123
let mut _w = a.alloc();
@@ -207,5 +219,8 @@ fn main() {
207219
run_test(|a| struct_dynamic_drop(a, true, true, false));
208220
run_test(|a| struct_dynamic_drop(a, true, true, true));
209221

222+
run_test(|a| field_assignment(a, false));
223+
run_test(|a| field_assignment(a, true));
224+
210225
run_test_nopanic(|a| union1(a));
211226
}

0 commit comments

Comments
 (0)