Rollup merge of #32970 - taralx:patch-2, r=alexcrichton
Accommodate the case where dup lang items are entirely external. Fixes #32961
This commit is contained in:
commit
00d4ac32c5
@ -189,13 +189,19 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
|
||||
match self.items.items[item_index] {
|
||||
Some(original_def_id) if original_def_id != item_def_id => {
|
||||
let cstore = &self.session.cstore;
|
||||
let span = self.ast_map.span_if_local(item_def_id)
|
||||
.expect("we should have found local duplicate earlier");
|
||||
let mut err = struct_span_err!(self.session,
|
||||
span,
|
||||
E0152,
|
||||
"duplicate lang item found: `{}`.",
|
||||
LanguageItems::item_name(item_index));
|
||||
let name = LanguageItems::item_name(item_index);
|
||||
let mut err = match self.ast_map.span_if_local(item_def_id) {
|
||||
Some(span) => struct_span_err!(
|
||||
self.session,
|
||||
span,
|
||||
E0152,
|
||||
"duplicate lang item found: `{}`.",
|
||||
name),
|
||||
None => self.session.struct_err(&format!(
|
||||
"duplicate lang item in crate `{}`: `{}`.",
|
||||
cstore.crate_name(item_def_id.krate),
|
||||
name)),
|
||||
};
|
||||
if let Some(span) = self.ast_map.span_if_local(original_def_id) {
|
||||
span_note!(&mut err, span,
|
||||
"first defined here.");
|
||||
|
Loading…
Reference in New Issue
Block a user