diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-09-24 01:14:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-24 01:14:06 +0200 |
| commit | 8c9e516e6e97bd8a03f6d171ee3f678e43ee7858 (patch) | |
| tree | 03f137a6d9c01f4702b8f16636163f219a8e8b36 /compiler/rustc_infer/src/infer | |
| parent | d92a1bd7ccc42f4d8502f988974c3bac667f0058 (diff) | |
| parent | 82e7cec16d7143907f145c895f7208c0a3906e03 (diff) | |
| download | rust-8c9e516e6e97bd8a03f6d171ee3f678e43ee7858.tar.gz rust-8c9e516e6e97bd8a03f6d171ee3f678e43ee7858.zip | |
Rollup merge of #116082 - compiler-errors:default-assoc-ty-msg, r=estebank
Tweak expected message to explain what it's actually signifying r? ``@estebank`` since you added this
Diffstat (limited to 'compiler/rustc_infer/src/infer')
| -rw-r--r-- | compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs index 445f68160d2..b34900da83b 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs @@ -616,9 +616,13 @@ fn foo(&self) -> Self::T { String::new() } for item in &items[..] { if let hir::AssocItemKind::Type = item.kind { let assoc_ty = tcx.type_of(item.id.owner_id).instantiate_identity(); - - if self.infcx.can_eq(param_env, assoc_ty, found) { - diag.span_label(item.span, "expected this associated type"); + if let hir::Defaultness::Default { has_value: true } = tcx.defaultness(item.id.owner_id) + && self.infcx.can_eq(param_env, assoc_ty, found) + { + diag.span_label( + item.span, + format!("associated type is `default` and may be overridden"), + ); return true; } } |
