diff options
| author | xizheyin <xizheyin@smail.nju.edu.cn> | 2025-04-01 14:19:40 +0800 |
|---|---|---|
| committer | xizheyin <xizheyin@smail.nju.edu.cn> | 2025-04-01 14:32:17 +0800 |
| commit | 12604fa071b01f7342520224507e43e432294c2c (patch) | |
| tree | 6e040727db2ab973a5109b27b2a606d69c8252f8 /compiler | |
| parent | 27b866d59a3e5ccbaf9723a37d353db6d2079f16 (diff) | |
| download | rust-12604fa071b01f7342520224507e43e432294c2c.tar.gz rust-12604fa071b01f7342520224507e43e432294c2c.zip | |
Skip suggest impl or dyn when poly trait is not a real trait
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs index 55886312284..8e62dce2191 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs @@ -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) { |
