Check for duplicate supertraits and forbid them

As per #3953
This commit is contained in:
Tim Chevalier 2012-11-15 16:36:16 -08:00
parent 82017b8416
commit 2f83baf857
2 changed files with 36 additions and 3 deletions

View file

@ -0,0 +1,23 @@
use cmp::Eq;
trait Hahaha: Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, //~ ERROR Duplicate supertrait in trait declaration
Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq,
Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq,
Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq,
Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq,
Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq, Eq {}
enum Lol = int;
pub impl Lol: Hahaha {
pure fn eq(other: &Lol) -> bool { *self != **other }
pure fn ne(other: &Lol) -> bool { *self == **other }
}
fn main() {
if Lol(2) == Lol(4) {
io::println("2 == 4");
} else {
io::println("2 != 4");
}
}