Skip to content

Commit

Permalink
Trait constraints are separated by space, not comma
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Dec 7, 2012
1 parent ecdc8aa commit 10c9d79
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2826,7 +2826,7 @@ impl Parser {

fn parse_trait_ref_list(ket: token::Token) -> ~[@trait_ref] {
self.parse_seq_to_before_end(
ket, seq_sep_trailing_disallowed(token::COMMA),
ket, seq_sep_none(),
|p| p.parse_trait_ref())
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/auxiliary/trait_inheritance_auto_xc_aux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ trait Foo { fn f() -> int; }
trait Bar { fn g() -> int; }
trait Baz { fn h() -> int; }

trait Quux: Foo, Bar, Baz { }
trait Quux: Foo Bar Baz { }

impl<T: Foo Bar Baz> T: Quux { }
12 changes: 6 additions & 6 deletions src/test/compile-fail/issue-3953.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
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 {}
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;

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/trait-inheritance-auto-xc-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extern mod aux(name = "trait_inheritance_auto_xc_2_aux");
use aux::{Foo, Bar, Baz, A};

// We want to extend all Foo, Bar, Bazes to Quuxes
pub trait Quux: Foo, Bar, Baz { }
pub trait Quux: Foo Bar Baz { }
impl<T: Foo Bar Baz> T: Quux { }

fn f<T: Quux>(a: &T) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/trait-inheritance-auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ trait Foo { fn f() -> int; }
trait Bar { fn g() -> int; }
trait Baz { fn h() -> int; }

trait Quux: Foo, Bar, Baz { }
trait Quux: Foo Bar Baz { }

struct A { x: int }

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/trait-inheritance-diamond.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
trait A { fn a(&self) -> int; }
trait B: A { fn b(&self) -> int; }
trait C: A { fn c(&self) -> int; }
trait D: B, C { fn d(&self) -> int; }
trait D: B C { fn d(&self) -> int; }

struct S { bogus: () }

Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/trait-inheritance-num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use num::from_int;
extern mod std;
use std::cmp::FuzzyEq;

pub trait NumExt: Num, Eq, Ord {}
pub trait NumExt: Num Eq Ord {}

pub trait FloatExt: NumExt, FuzzyEq {}
pub trait FloatExt: NumExt FuzzyEq {}

fn greater_than_one<T:NumExt>(n: &T) -> bool { *n > from_int(1) }
fn greater_than_one_float<T:FloatExt>(n: &T) -> bool { *n > from_int(1) }
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/trait-inheritance-num1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use cmp::Ord;
use num::from_int;

pub trait NumExt: Num, Ord { }
pub trait NumExt: Num Ord { }

fn greater_than_one<T:NumExt>(n: &T) -> bool {
*n > from_int(1)
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/trait-inheritance-num2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub impl f64: TypeExt {}
pub impl float: TypeExt {}


pub trait NumExt: TypeExt, Eq, Ord, Num {}
pub trait NumExt: TypeExt Eq Ord Num {}

pub impl u8: NumExt {}
pub impl u16: NumExt {}
Expand Down Expand Up @@ -82,7 +82,7 @@ pub impl i64: IntegerExt {}
pub impl int: IntegerExt {}


pub trait FloatExt: NumExt , FuzzyEq {}
pub trait FloatExt: NumExt FuzzyEq {}

pub impl f32: FloatExt {}
pub impl f64: FloatExt {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/trait-inheritance-num3.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cmp::{Eq, Ord};
use num::from_int;

pub trait NumExt: Eq, Ord, Num {}
pub trait NumExt: Eq Ord Num {}

pub impl f32: NumExt {}

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/trait-inheritance-num5.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cmp::{Eq, Ord};
use num::from_int;

pub trait NumExt: Eq, Num {}
pub trait NumExt: Eq Num {}

pub impl f32: NumExt {}
pub impl int: NumExt {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/trait-inheritance-overloading.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cmp::Eq;

trait MyNum : Add<self,self>, Sub<self,self>, Mul<self,self>, Eq { }
trait MyNum : Add<self,self> Sub<self,self> Mul<self,self> Eq { }

struct MyInt { val: int }

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/trait-inheritance-static2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ trait MyNum {
static fn from_int(int) -> self;
}

pub trait NumExt: MyEq, MyNum { }
pub trait NumExt: MyEq MyNum { }

struct S { v: int }

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/trait-inheritance2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ trait Foo { fn f() -> int; }
trait Bar { fn g() -> int; }
trait Baz { fn h() -> int; }

trait Quux: Foo, Bar, Baz { }
trait Quux: Foo Bar Baz { }

struct A { x: int }

Expand Down

0 comments on commit 10c9d79

Please sign in to comment.