Skip to content

Commit 347570b

Browse files
committed
---
yaml --- r: 28445 b: refs/heads/try c: 6957af7 h: refs/heads/master i: 28443: e19feaa v: v3
1 parent f3ae349 commit 347570b

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 9869d071d101c580e1b54f077a30af8ee0fc960c
5+
refs/heads/try: 6957af770bb92b71485f852beb9071733e5f178b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/libsyntax/parse/obsolete.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub enum ObsoleteSyntax {
2020
ObsoleteStructCtor,
2121
ObsoleteWith,
2222
ObsoleteClassMethod,
23+
ObsoleteClassTraits
2324
}
2425

2526
impl ObsoleteSyntax : cmp::Eq {
@@ -76,6 +77,11 @@ impl parser : ObsoleteReporter {
7677
"class method",
7778
"methods should be defined inside impls"
7879
),
80+
ObsoleteClassTraits => (
81+
"class traits",
82+
"implemented traits are specified on the impl, as in \
83+
`impl foo : bar {`"
84+
),
7985
};
8086

8187
self.report(sp, kind, kind_str, desc);

branches/try/src/libsyntax/parse/parser.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use obsolete::{
1919
ObsoleteReporter, ObsoleteSyntax,
2020
ObsoleteLowerCaseKindBounds, ObsoleteLet,
2121
ObsoleteFieldTerminator, ObsoleteStructCtor,
22-
ObsoleteWith, ObsoleteClassMethod
22+
ObsoleteWith, ObsoleteClassMethod, ObsoleteClassTraits
2323
};
2424
use ast::{_mod, add, alt_check, alt_exhaustive, arg, arm, attribute,
2525
bind_by_ref, bind_by_implicit_ref, bind_by_value, bind_by_move,
@@ -2648,8 +2648,10 @@ impl parser {
26482648
let class_name = self.parse_value_ident();
26492649
self.parse_region_param();
26502650
let ty_params = self.parse_ty_params();
2651-
let traits : ~[@trait_ref] = if self.eat(token::COLON)
2652-
{ self.parse_trait_ref_list(token::LBRACE) }
2651+
let traits : ~[@trait_ref] = if self.eat(token::COLON) {
2652+
self.obsolete(copy self.span, ObsoleteClassTraits);
2653+
self.parse_trait_ref_list(token::LBRACE)
2654+
}
26532655
else { ~[] };
26542656

26552657
let mut fields: ~[@struct_field];

branches/try/src/test/compile-fail/class-method-missing.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ trait animal {
33
fn eat();
44
}
55

6-
struct cat : animal {
6+
struct cat {
77
meows: uint,
88
}
99

10+
impl cat : animal {
11+
}
12+
1013
fn cat(in_x : uint) -> cat {
1114
cat {
1215
meows: in_x

branches/try/src/test/compile-fail/obsolete-syntax.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ struct ss {
2727
//~^ ERROR obsolete syntax: class method
2828
}
2929

30+
struct q : r {
31+
//~^ ERROR obsolete syntax: class traits
32+
}
33+
3034
fn obsolete_with() {
3135
struct S {
3236
foo: (),

0 commit comments

Comments
 (0)