]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_middle/ty/error.rs
Rollup merge of #72149 - estebank:icemation, r=eddyb
[rust.git] / src / librustc_middle / ty / error.rs
index cf63a659e6c0f652e656c8300e1e01f0e73a5e21..480420dfdcf5e0a67df8dac6ecc4538b8a0b4e23 100644 (file)
@@ -815,19 +815,18 @@ fn point_at_associated_type(
                 for item in &items[..] {
                     match item.kind {
                         hir::AssocItemKind::Type | hir::AssocItemKind::OpaqueTy => {
-                            if self.type_of(self.hir().local_def_id(item.id.hir_id)) == found {
-                                if let hir::Defaultness::Default { has_value: true } =
-                                    item.defaultness
-                                {
+                            // FIXME: account for returning some type in a trait fn impl that has
+                            // an assoc type as a return type (#72076).
+                            if let hir::Defaultness::Default { has_value: true } = item.defaultness
+                            {
+                                if self.type_of(self.hir().local_def_id(item.id.hir_id)) == found {
                                     db.span_label(
                                         item.span,
                                         "associated type defaults can't be assumed inside the \
                                             trait defining them",
                                     );
-                                } else {
-                                    db.span_label(item.span, "expected this associated type");
+                                    return true;
                                 }
-                                return true;
                             }
                         }
                         _ => {}