1
Fork 0

Skip suggest impl or dyn when poly trait is not a real trait

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
xizheyin 2025-04-01 14:19:40 +08:00
parent 27b866d59a
commit 12604fa071
No known key found for this signature in database
GPG key ID: 0A0D90BE99CEDEAD
2 changed files with 1 additions and 15 deletions

View file

@ -86,6 +86,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
"expected a type, found a trait"
);
if self_ty.span.can_be_used_for_suggestions()
&& poly_trait_ref.trait_ref.trait_def_id().is_some()
&& !self.maybe_suggest_impl_trait(self_ty, &mut diag)
&& !self.maybe_suggest_dyn_trait(self_ty, sugg, &mut diag)
{