-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #104216 - Nilstrieb:dont-ice-invalid-operator-traits,…
… r=estebank Don't ICE on operator trait methods with generic methods Emit a fatal error instead. fixes #104213
- Loading branch information
Showing
5 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#![crate_type = "lib"] | ||
#![feature(lang_items)] | ||
#![feature(no_core)] | ||
#![no_core] | ||
|
||
#[lang="sized"] | ||
pub trait Sized { | ||
// Empty. | ||
} | ||
|
||
#[lang = "add"] | ||
trait Add<RHS=Self> { | ||
type Output; | ||
|
||
fn add<Y>(self, _: RHS) -> Self::Output; | ||
//~^ ERROR `add` must not have any generic parameters | ||
} | ||
|
||
#[allow(unreachable_code)] | ||
fn ice(a: usize) { | ||
let r = loop {}; | ||
r = r + a; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: `add` must not have any generic parameters | ||
--> $DIR/invalid_operator_trait.rs:15:5 | ||
| | ||
LL | fn add<Y>(self, _: RHS) -> Self::Output; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|