Don't ICE on operator trait methods with generic methods

Emit a fatal error instead.
This commit is contained in:
Nilstrieb 2022-11-09 22:00:13 +01:00
parent cc9b259b5e
commit cedaaa640e
No known key found for this signature in database
5 changed files with 50 additions and 1 deletions

View file

@ -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;
}

View file

@ -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