1
Fork 0

Use ensure for UnusedBrokenConst.

This commit is contained in:
Camille GILLOT 2022-06-19 09:44:23 +02:00
parent dae1d97468
commit 47b8d26eff
2 changed files with 36 additions and 5 deletions

View file

@ -1610,13 +1610,11 @@ impl<'tcx> LateLintPass<'tcx> for UnusedBrokenConst {
hir::ItemKind::Const(_, body_id) => {
let def_id = cx.tcx.hir().body_owner_def_id(body_id).to_def_id();
// trigger the query once for all constants since that will already report the errors
// FIXME: Use ensure here
let _ = cx.tcx.const_eval_poly(def_id);
cx.tcx.ensure().const_eval_poly(def_id);
}
hir::ItemKind::Static(_, _, body_id) => {
let def_id = cx.tcx.hir().body_owner_def_id(body_id).to_def_id();
// FIXME: Use ensure here
let _ = cx.tcx.eval_static_initializer(def_id);
cx.tcx.ensure().eval_static_initializer(def_id);
}
_ => {}
}