Change:
Given the following test and nightly 2020-01-12: I get that this is not supposed to work without const generics, but the error message suggestion is very funny: With const generics:
Weird suggestion is on current stable as well.
The ICE component is fixed by , the diagnostics issue remains ()
I think it's another example of now.

Discussion:
} else { sp }; <del> // FIXME: contrast `t.def_id` against `param.bounds` to not suggest // traits already there. That can happen when the cause is that // we're in a const scope or associated function used as a method. err.span_suggestions( sp, &message(format!( "restrict type parameter `{}` with", param.name.ident(), )), candidates.iter().map(|t| { format!( "{}{} {}{}", </del> <ins> let trait_def_ids: FxHashSet<DefId> = param .bounds .iter() .filter_map(|bound| bound.trait_def_id()) .collect(); if !candidates.iter().any(|t| trait_def_ids.contains(&t.def_id)) { err.span_suggestions( sp, &message(format!( "restrict type parameter `{}` with", </ins> param.name.ident(), <del> if impl_trait { " +" } else { ":" }, self.tcx.def_path_str(t.def_id), if has_bounds.is_some() { " + " } else { "" }, ) }), Applicability::MaybeIncorrect, ); </del> <ins> )), candidates.iter().map(|t| { format!( "{}{} {}{}", param.name.ident(), if impl_trait { " +" } else { ":" }, self.tcx.def_path_str(t.def_id), if has_bounds.is_some() { " + " } else { "" }, ) }), Applicability::MaybeIncorrect, ); } </ins> suggested = true; } Node::Item(hir::Item {

<ins> trait Adapter { const LINKS: usize; } struct Foo<A: Adapter> { adapter: A, links: [u32; A::LINKS], // Shouldn't suggest bounds already there. //~^ ERROR: no associated item named `LINKS` found } fn main() {} </ins>

<ins> error[E0599]: no associated item named `LINKS` found for type parameter `A` in the current scope --> $DIR/associated-item-duplicate-bounds.rs:7:21 | LL |     links: [u32; A::LINKS], // Shouldn't suggest bounds already there. |                     ^^^^^ associated item not found in `A` | = help: items from traits can only be used if the type parameter is bounded by the trait error: aborting due to previous error For more information about this error, try `rustc --explain E0599`. </ins>

|                     ^^^ function or associated item not found in `D` | = help: items from traits can only be used if the type parameter is bounded by the trait <del> help: the following trait defines an item `dim`, perhaps you need to restrict type parameter `D` with it: | LL | pub struct Vector<T, D: Dim + Dim> { |                      ^^^^^^^^ </del> error: aborting due to previous error

--> $DIR/issue-7575.rs:70:7 | LL |     t.is_str() <del> |       ^^^^^^ this is an associated function, not a method </del> <ins> |     --^^^^^^-- |     | | |     | this is an associated function, not a method |     help: disambiguate the method call for the candidate: `ManyImplTrait::is_str(t)` </ins> | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in the trait `ManyImplTrait`

LL |     fn is_str() -> bool { |     ^^^^^^^^^^^^^^^^^^^ = help: items from traits can only be used if the type parameter is bounded by the trait <del> help: disambiguate the method call for the candidate | LL |     ManyImplTrait::is_str(t) | help: the following trait defines an item `is_str`, perhaps you need to restrict type parameter `T` with it: | LL | fn param_bound<T: ManyImplTrait + ManyImplTrait>(t: T) -> bool { |                ^^^^^^^^^^^^^^^^^^ </del> error: aborting due to 3 previous errors