Skip to content

Commit 060cecb

Browse files
committed
Hide errors whose suggestions would contain error constants or types
1 parent cb72b9b commit 060cecb

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Diff for: compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
998998
self.lower_const_arg(ct, FeedConstTy::No).into()
999999
}
10001000
};
1001+
if term.references_error() {
1002+
continue;
1003+
}
10011004
// FIXME(#97583): This isn't syntactically well-formed!
10021005
where_bounds.push(format!(
10031006
" T: {trait}::{assoc_name} = {term}",

Diff for: tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr

-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ LL | trait Parent2 { const C: &'static str; }
2626
LL |
2727
LL | fn take1(_: impl Trait1<C = "?">) {}
2828
| ^^^^^^^ ambiguous associated constant `C`
29-
|
30-
= help: consider introducing a new type parameter `T` and adding `where` constraints:
31-
where
32-
T: Trait1,
33-
T: Parent2::C = {const error},
34-
T: Parent1::C = {const error}
3529

3630
error: aborting due to 2 previous errors
3731

0 commit comments

Comments
 (0)