1
Fork 0

Rollup merge of #120020 - oli-obk:long_const_eval_err_taint, r=compiler-errors

Gracefully handle missing typeck information if typeck errored

fixes #116893

I created some logs and the typeck of `fn main` is exactly the same, no matter whether the constant's body is what it is, or if it is replaced with `panic!()`. The latter will cause the ICE not to be emitted though. The reason for that is that we abort compilation if *errors* were emitted, but not if *lint errors* were emitted. This took me way too long to debug, and is another reason why I would have liked https://github.com/rust-lang/compiler-team/issues/633
This commit is contained in:
Matthias Krüger 2024-01-17 20:21:21 +01:00 committed by GitHub
commit 6ca77ff722
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 11 deletions

View file

@ -1526,13 +1526,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.check_repeat_element_needs_copy_bound(element, count, element_ty);
self.register_wf_obligation(
Ty::new_array_with_const_len(tcx, t, count).into(),
expr.span,
traits::WellFormed(None),
);
let ty = Ty::new_array_with_const_len(tcx, t, count);
Ty::new_array_with_const_len(tcx, t, count)
self.register_wf_obligation(ty.into(), expr.span, traits::WellFormed(None));
ty
}
fn check_repeat_element_needs_copy_bound(

View file

@ -128,7 +128,10 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
if let Some(def_id) = self.typeck_results().type_dependent_def_id(id) {
self.check_def_id(def_id);
} else {
bug!("no type-dependent def for method");
assert!(
self.typeck_results().tainted_by_errors.is_some(),
"no type-dependent def for method"
);
}
}