Skip to content

Commit 7731cdc

Browse files
committed
Rollup merge of rust-lang#31818 - GuillaumeGomez:error_display, r=brson
Fixes rust-lang#31788
2 parents db86810 + dfe72fa commit 7731cdc

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/librustc/middle/lang_items.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,13 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
184184
// Check for duplicates.
185185
match self.items.items[item_index] {
186186
Some(original_def_id) if original_def_id != item_def_id => {
187+
let cstore = &self.session.cstore;
187188
span_err!(self.session, span, E0152,
188-
"duplicate entry for `{}`", LanguageItems::item_name(item_index));
189+
"duplicate entry for `{}`, first definition found in `{}`",
190+
LanguageItems::item_name(item_index),
191+
cstore.crate_name(item_def_id.krate));
189192
}
190-
Some(_) | None => {
193+
_ => {
191194
// OK.
192195
}
193196
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Test for issue #31788
12+
13+
// error-pattern: duplicate entry for `panic_fmt`, first definition found in `std`
14+
15+
#![feature(lang_items)]
16+
17+
#[lang = "panic_fmt"]
18+
fn panic_fmt() -> ! {
19+
loop {}
20+
}
21+
22+
fn main() {}

0 commit comments

Comments
 (0)