Rollup merge of #111602 - tmiasko:erroneous-constant-used, r=oli-obk
Suppress "erroneous constant used" for constants tainted by errors When constant evaluation fails because its MIR is tainted by errors, suppress note indicating that erroneous constant was used, since those errors have to be fixed regardless of the constant being used or not. Fixes #110891.
This commit is contained in:
commit
3e34be004e
33 changed files with 76 additions and 248 deletions
|
@ -169,14 +169,14 @@ impl<'tcx> ConstEvalErr<'tcx> {
|
|||
// See <https://github.com/rust-lang/rust/pull/63152>.
|
||||
let mut err = struct_error(tcx, &self.error.to_string());
|
||||
self.decorate(&mut err, decorate);
|
||||
ErrorHandled::Reported(err.emit())
|
||||
ErrorHandled::Reported(err.emit().into())
|
||||
}
|
||||
_ => {
|
||||
// Report as hard error.
|
||||
let mut err = struct_error(tcx, message);
|
||||
err.span_label(self.span, self.error.to_string());
|
||||
self.decorate(&mut err, decorate);
|
||||
ErrorHandled::Reported(err.emit())
|
||||
ErrorHandled::Reported(err.emit().into())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -382,7 +382,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
|||
rustc_span::DUMMY_SP,
|
||||
"This is likely a const item that is missing from its impl",
|
||||
);
|
||||
throw_inval!(AlreadyReported(guar));
|
||||
throw_inval!(AlreadyReported(guar.into()));
|
||||
} else {
|
||||
// `find_mir_or_eval_fn` checks that this is a const fn before even calling us,
|
||||
// so this should be unreachable.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue