Make duplicate lang items fatal
Prevents terminal spam.
This commit is contained in:
parent
88189a71e4
commit
ad1e6298ed
@ -149,7 +149,9 @@ impl<'ast, 'tcx> LanguageItemCollector<'ast, 'tcx> {
|
||||
}
|
||||
};
|
||||
|
||||
self.tcx.dcx().emit_err(DuplicateLangItem {
|
||||
// When there's a duplicate lang item, something went very wrong and there's no value in recovering or doing anything.
|
||||
// Give the user the one message to let them debug the mess they created and then wish them farewell.
|
||||
self.tcx.dcx().emit_fatal(DuplicateLangItem {
|
||||
local_span: item_span,
|
||||
lang_item_name,
|
||||
crate_name,
|
||||
|
@ -7,7 +7,6 @@ trait Sized { } //~ ERROR found duplicate lang item `sized`
|
||||
fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
|
||||
//~^ ERROR `self` parameter is only allowed in associated functions
|
||||
//~| ERROR cannot find type `Struct` in this scope
|
||||
//~| ERROR mismatched types
|
||||
let x = x << 1;
|
||||
//~^ ERROR cannot find value `x` in this scope
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
|
||||
| ^^^^^^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-102989.rs:11:13
|
||||
--> $DIR/issue-102989.rs:10:13
|
||||
|
|
||||
LL | let x = x << 1;
|
||||
| ^ help: a local variable with a similar name exists: `f`
|
||||
@ -28,21 +28,7 @@ LL | trait Sized { }
|
||||
= note: first definition in `core` loaded from SYSROOT/libcore-*.rlib
|
||||
= note: second definition in the local crate (`issue_102989`)
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-102989.rs:7:42
|
||||
|
|
||||
LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
|
||||
| ---------- ^^^^ expected `&u32`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
|
|
||||
help: consider returning the local binding `f`
|
||||
|
|
||||
LL ~ let x = x << 1;
|
||||
LL + f
|
||||
|
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0152, E0308, E0412, E0425.
|
||||
Some errors have detailed explanations: E0152, E0412, E0425.
|
||||
For more information about an error, try `rustc --explain E0152`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user