Remove `LintDiagnostic::msg` · rust-lang/rust@06bc4fc

@@ -1164,33 +1164,28 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {

11641164

let ty = self.lower_assoc_ty(span, assoc_ty_did, assoc_segment, bound);

1165116511661166

if let Some(variant_def_id) = variant_resolution {

1167-

tcx.node_span_lint(

1168-

AMBIGUOUS_ASSOCIATED_ITEMS,

1169-

hir_ref_id,

1170-

span,

1171-

"ambiguous associated item",

1172-

|lint| {

1173-

let mut could_refer_to = |kind: DefKind, def_id, also| {

1174-

let note_msg = format!(

1175-

"`{}` could{} refer to the {} defined here",

1176-

assoc_ident,

1177-

also,

1178-

tcx.def_kind_descr(kind, def_id)

1179-

);

1180-

lint.span_note(tcx.def_span(def_id), note_msg);

1181-

};

1167+

tcx.node_span_lint(AMBIGUOUS_ASSOCIATED_ITEMS, hir_ref_id, span, |lint| {

1168+

lint.primary_message("ambiguous associated item");

1169+

let mut could_refer_to = |kind: DefKind, def_id, also| {

1170+

let note_msg = format!(

1171+

"`{}` could{} refer to the {} defined here",

1172+

assoc_ident,

1173+

also,

1174+

tcx.def_kind_descr(kind, def_id)

1175+

);

1176+

lint.span_note(tcx.def_span(def_id), note_msg);

1177+

};

118211781183-

could_refer_to(DefKind::Variant, variant_def_id, "");

1184-

could_refer_to(DefKind::AssocTy, assoc_ty_did, " also");

1179+

could_refer_to(DefKind::Variant, variant_def_id, "");

1180+

could_refer_to(DefKind::AssocTy, assoc_ty_did, " also");

118511811186-

lint.span_suggestion(

1187-

span,

1188-

"use fully-qualified syntax",

1189-

format!("<{} as {}>::{}", qself_ty, tcx.item_name(trait_did), assoc_ident),

1190-

Applicability::MachineApplicable,

1191-

);

1192-

},

1193-

);

1182+

lint.span_suggestion(

1183+

span,

1184+

"use fully-qualified syntax",

1185+

format!("<{} as {}>::{}", qself_ty, tcx.item_name(trait_did), assoc_ident),

1186+

Applicability::MachineApplicable,

1187+

);

1188+

});

11941189

}

11951190

Ok((ty, DefKind::AssocTy, assoc_ty_did))

11961191

}