address review

This commit is contained in:
Shunpoco
2025-10-17 06:57:41 +01:00
parent 8e59e3ba33
commit 845ff73d39
3 changed files with 10 additions and 11 deletions
+6 -8
View File
@@ -367,10 +367,7 @@ fn mark_live_symbols(&mut self) -> <MarkSymbolVisitor<'tcx> as Visitor<'tcx>>::R
continue;
}
let visit_result = self.visit_node(self.tcx.hir_node_by_def_id(id));
if visit_result.is_break() {
return visit_result;
}
self.visit_node(self.tcx.hir_node_by_def_id(id))?;
}
ControlFlow::Continue(())
@@ -1167,11 +1164,12 @@ fn is_live_code(&self, def_id: LocalDefId) -> bool {
}
fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModDefId) {
let live_symbols_result = tcx.live_symbols_and_ignored_derived_traits(());
if live_symbols_result.is_err() {
let Ok((live_symbols, ignored_derived_traits)) =
tcx.live_symbols_and_ignored_derived_traits(()).as_ref()
else {
return;
}
let (live_symbols, ignored_derived_traits) = live_symbols_result.as_ref().unwrap();
};
let mut visitor = DeadVisitor { tcx, live_symbols, ignored_derived_traits };
let module_items = tcx.hir_module_items(module);
@@ -1,6 +1,7 @@
// The test confirms ICE-125323 is fixed.
//
// This warning makes sure the fix doesn't throw everything with errors to dead.
// This warning tests there is no warning about dead code
// when there is a constant evaluation error.
#![warn(unused)]
fn should_not_be_dead() {}
@@ -1,5 +1,5 @@
error: constant evaluation is taking a long time
--> $DIR/do-not-ice-long-constant-evaluation-in-for-loop.rs:9:14
--> $DIR/do-not-ice-long-constant-evaluation-in-for-loop.rs:10:14
|
LL | [(); loop {}];
| ^^^^^^^
@@ -7,7 +7,7 @@ LL | [(); loop {}];
= note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
If your compilation actually takes a long time, you can safely allow the lint.
help: the constant being evaluated
--> $DIR/do-not-ice-long-constant-evaluation-in-for-loop.rs:9:14
--> $DIR/do-not-ice-long-constant-evaluation-in-for-loop.rs:10:14
|
LL | [(); loop {}];
| ^^^^^^^