Hide errors whose suggestions would contain error constants or types

This commit is contained in:
Oli Scherer 2024-12-05 16:57:30 +00:00
parent cb72b9bb37
commit 060cecba1a
2 changed files with 3 additions and 6 deletions

View file

@ -998,6 +998,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
self.lower_const_arg(ct, FeedConstTy::No).into()
}
};
if term.references_error() {
continue;
}
// FIXME(#97583): This isn't syntactically well-formed!
where_bounds.push(format!(
" T: {trait}::{assoc_name} = {term}",

View file

@ -26,12 +26,6 @@ LL | trait Parent2 { const C: &'static str; }
LL |
LL | fn take1(_: impl Trait1<C = "?">) {}
| ^^^^^^^ ambiguous associated constant `C`
|
= help: consider introducing a new type parameter `T` and adding `where` constraints:
where
T: Trait1,
T: Parent2::C = {const error},
T: Parent1::C = {const error}
error: aborting due to 2 previous errors