diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/traits/invalid_operator_trait.rs | 23 | ||||
| -rw-r--r-- | src/test/ui/traits/invalid_operator_trait.stderr | 8 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/traits/invalid_operator_trait.rs b/src/test/ui/traits/invalid_operator_trait.rs new file mode 100644 index 00000000000..7ea3b0d5bac --- /dev/null +++ b/src/test/ui/traits/invalid_operator_trait.rs @@ -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; +} diff --git a/src/test/ui/traits/invalid_operator_trait.stderr b/src/test/ui/traits/invalid_operator_trait.stderr new file mode 100644 index 00000000000..8c6e3695905 --- /dev/null +++ b/src/test/ui/traits/invalid_operator_trait.stderr @@ -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 + |
