Change:
Issues with this diagnostic: method is not being invoked on a trait object; it's invoked on the concrete value . note suggests importing the same trait that is already being reported about.
/cc also looks relevant based on the title, but appears to have a different enough error message.
Is the following output from enough?
I don't feel like it's at the usual amazing quality . My points still appear to exist: In some magical world, I might hope for something like this (and I'm very flexible in that): I tried to address my points via the s.

Discussion:
let rcvr_substs = self.fresh_receiver_substs(self_ty, &pick); let all_substs = self.instantiate_method_substs(&pick, segment, rcvr_substs); <del> debug!("all_substs={:?}", all_substs); </del> <ins> debug!("rcvr_substs={rcvr_substs:?}, all_substs={all_substs:?}"); </ins> // Create the final signature for the method, replacing late-bound regions. let (method_sig, method_predicates) = self.instantiate_method_sig(&pick, all_substs); <ins> // If there is a `Self: Sized` bound and `Self` is a trait object, it is possible that // something which derefs to `Self` actually implements the trait and the caller // wanted to make a static dispatch on it but forgot to import the trait. // See test `src/test/ui/issue-35976.rs`. // // In that case, we'll error anyway, but we'll also re-run the search with all traits // in scope, and if we find another method which can be used, we'll output an // appropriate hint suggesting to import the trait. let filler_substs = rcvr_substs .extend_to(self.tcx, pick.item.def_id, |def, _| self.tcx.mk_param_from_def(def)); let illegal_sized_bound = self.predicates_require_illegal_sized_bound( &self.tcx.predicates_of(pick.item.def_id).instantiate(self.tcx, filler_substs), ); </ins> // Unify the (adjusted) self type with what the method expects. // // SUBTLE: if we want good error messages, because of "guessing" while matching

// Make sure nobody calls `drop()` explicitly. self.enforce_illegal_method_limitations(&pick); <del> // If there is a `Self: Sized` bound and `Self` is a trait object, it is possible that // something which derefs to `Self` actually implements the trait and the caller // wanted to make a static dispatch on it but forgot to import the trait. // See test `src/test/ui/issue-35976.rs`. // // In that case, we'll error anyway, but we'll also re-run the search with all traits // in scope, and if we find another method which can be used, we'll output an // appropriate hint suggesting to import the trait. let illegal_sized_bound = self.predicates_require_illegal_sized_bound(&method_predicates); </del> // Add any trait/regions obligations specified on the method's type parameters. // We won't add these if we encountered an illegal sized bound, so that we can use // a custom error in that case.

use rustc_infer::infer::{self, InferOk}; use rustc_middle::ty::subst::Subst; use rustc_middle::ty::subst::{InternalSubsts, SubstsRef}; <del> use rustc_middle::ty::GenericParamDefKind; </del> use rustc_middle::ty::{self, ToPredicate, Ty, TypeVisitable}; <ins> use rustc_middle::ty::{DefIdTree, GenericParamDefKind}; </ins> use rustc_span::symbol::Ident; use rustc_span::Span; use rustc_trait_selection::traits;

} // We probe again, taking all traits into account (not only those in scope). <del> let candidates = match self.lookup_probe( </del> <ins> let mut candidates = match self.lookup_probe( </ins> span, segment.ident, self_ty,

.collect(), _ => Vec::new(), }; <ins> candidates.retain(|candidate| *candidate != self.tcx.parent(result.callee.def_id)); </ins> return Err(IllegalSizedBound(candidates, needs_mut, span)); }

... LL |     arg.wait(); |         ^^^^ <del> | help: another candidate was found in the following trait, perhaps add a `use` for it: | LL | use private::Future; | </del> error: aborting due to previous error

<ins> pub trait Example { fn query<Q>(self, q: Q); } impl Example for i32 { fn query<Q>(self, _: Q) { unimplemented!() } } mod nested { use super::Example; fn example() { 1.query::<dyn ToString>("") //~^ ERROR the size for values of type `dyn ToString` cannot be known at compilation time //~| ERROR mismatched types } } fn main() {} </ins>

<ins> error[E0277]: the size for values of type `dyn ToString` cannot be known at compilation time --> $DIR/issue-61525.rs:14:33 | LL |         1.query::<dyn ToString>("") |           -----                 ^^ doesn't have a size known at compile-time |           | |           required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `dyn ToString` note: required by a bound in `Example::query` --> $DIR/issue-61525.rs:2:14 | LL |     fn query<Q>(self, q: Q); |              ^ required by this bound in `Example::query` help: consider relaxing the implicit `Sized` restriction | LL |     fn query<Q: ?Sized>(self, q: Q); |               ++++++++ error[E0308]: mismatched types --> $DIR/issue-61525.rs:14:33 | LL |         1.query::<dyn ToString>("") |           --------------------- ^^ expected trait object `dyn ToString`, found `&str` |           | |           arguments to this function are incorrect | = note: expected trait object `dyn ToString` found reference `&'static str` note: associated function defined here --> $DIR/issue-61525.rs:2:8 | LL |     fn query<Q>(self, q: Q); |        ^^^^^ error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. </ins>