Skip to content

Commit 845ff73

Browse files
committed
address review
1 parent 8e59e3b commit 845ff73

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

compiler/rustc_passes/src/dead.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
367367
continue;
368368
}
369369

370-
let visit_result = self.visit_node(self.tcx.hir_node_by_def_id(id));
371-
if visit_result.is_break() {
372-
return visit_result;
373-
}
370+
self.visit_node(self.tcx.hir_node_by_def_id(id))?;
374371
}
375372

376373
ControlFlow::Continue(())
@@ -1167,11 +1164,12 @@ impl<'tcx> DeadVisitor<'tcx> {
11671164
}
11681165

11691166
fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModDefId) {
1170-
let live_symbols_result = tcx.live_symbols_and_ignored_derived_traits(());
1171-
if live_symbols_result.is_err() {
1167+
let Ok((live_symbols, ignored_derived_traits)) =
1168+
tcx.live_symbols_and_ignored_derived_traits(()).as_ref()
1169+
else {
11721170
return;
1173-
}
1174-
let (live_symbols, ignored_derived_traits) = live_symbols_result.as_ref().unwrap();
1171+
};
1172+
11751173
let mut visitor = DeadVisitor { tcx, live_symbols, ignored_derived_traits };
11761174

11771175
let module_items = tcx.hir_module_items(module);

tests/ui/consts/do-not-ice-long-constant-evaluation-in-for-loop.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// The test confirms ICE-125323 is fixed.
22
//
3-
// This warning makes sure the fix doesn't throw everything with errors to dead.
3+
// This warning tests there is no warning about dead code
4+
// when there is a constant evaluation error.
45
#![warn(unused)]
56
fn should_not_be_dead() {}
67

tests/ui/consts/do-not-ice-long-constant-evaluation-in-for-loop.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error: constant evaluation is taking a long time
2-
--> $DIR/do-not-ice-long-constant-evaluation-in-for-loop.rs:9:14
2+
--> $DIR/do-not-ice-long-constant-evaluation-in-for-loop.rs:10:14
33
|
44
LL | [(); loop {}];
55
| ^^^^^^^
66
|
77
= note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
88
If your compilation actually takes a long time, you can safely allow the lint.
99
help: the constant being evaluated
10-
--> $DIR/do-not-ice-long-constant-evaluation-in-for-loop.rs:9:14
10+
--> $DIR/do-not-ice-long-constant-evaluation-in-for-loop.rs:10:14
1111
|
1212
LL | [(); loop {}];
1313
| ^^^^^^^

0 commit comments

Comments
 (0)