Skip to content

Commit

Permalink
Hide errors whose suggestions would contain error constants or types
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Dec 6, 2024
1 parent cb72b9b commit 060cecb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
6 changes: 0 additions & 6 deletions tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 060cecb

Please sign in to comment.