about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-02-14 21:17:26 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-02-15 16:59:56 -0800
commitbb833ca0f0e878d381c3dc0c9afe958a810e4427 (patch)
tree7766fd3354b2b0f0418c5ff317df0696b41dbcc1 /src/libsyntax
parent566bcf2225634ee4d4698247fe89364440eb534c (diff)
downloadrust-bb833ca0f0e878d381c3dc0c9afe958a810e4427.tar.gz
rust-bb833ca0f0e878d381c3dc0c9afe958a810e4427.zip
librustc: Stop parsing `impl Type : Trait` and fix several declarations that slipped through. r=tjc
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs48
-rw-r--r--src/libsyntax/ast_map.rs2
-rw-r--r--src/libsyntax/ast_util.rs4
-rw-r--r--src/libsyntax/codemap.rs30
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs4
-rw-r--r--src/libsyntax/ext/pipes/check.rs2
-rw-r--r--src/libsyntax/ext/pipes/parse_proto.rs2
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs7
-rw-r--r--src/libsyntax/ext/pipes/proto.rs5
-rw-r--r--src/libsyntax/fold.rs2
-rw-r--r--src/libsyntax/parse/lexer.rs2
-rw-r--r--src/libsyntax/parse/obsolete.rs9
-rw-r--r--src/libsyntax/parse/parser.rs14
-rw-r--r--src/libsyntax/util/interner.rs2
14 files changed, 67 insertions, 66 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 053df524bf7..14a66a49df3 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -32,7 +32,7 @@ macro_rules! interner_key (
 #[deriving_eq]
 pub struct ident { repr: uint }
 
-pub impl<S: Encoder> ident: Encodable<S> {
+pub impl<S: Encoder> Encodable<S> for ident {
     fn encode(&self, s: &S) {
         let intr = match unsafe {
             task::local_data::local_data_get(interner_key!())
@@ -45,7 +45,7 @@ pub impl<S: Encoder> ident: Encodable<S> {
     }
 }
 
-pub impl<D: Decoder> ident: Decodable<D> {
+pub impl<D: Decoder> Decodable<D> for ident {
     static fn decode(d: &D) -> ident {
         let intr = match unsafe {
             task::local_data::local_data_get(interner_key!())
@@ -58,7 +58,7 @@ pub impl<D: Decoder> ident: Decodable<D> {
     }
 }
 
-pub impl ident: to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for ident {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         self.repr.iter_bytes(lsb0, f)
     }
@@ -211,7 +211,7 @@ pub enum binding_mode {
     bind_infer
 }
 
-pub impl binding_mode : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for binding_mode {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         match *self {
           bind_by_copy => 0u8.iter_bytes(lsb0, f),
@@ -256,7 +256,7 @@ pub enum pat_ {
 #[deriving_eq]
 pub enum mutability { m_mutbl, m_imm, m_const, }
 
-pub impl mutability : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for mutability {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as u8).iter_bytes(lsb0, f)
     }
@@ -269,13 +269,13 @@ pub enum Abi {
     RustAbi
 }
 
-pub impl Abi : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for Abi {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as uint).iter_bytes(lsb0, f)
     }
 }
 
-pub impl Abi : ToStr {
+pub impl ToStr for Abi {
     pure fn to_str(&self) -> ~str {
         match *self {
             RustAbi => ~"\"rust\""
@@ -292,13 +292,13 @@ pub enum Sigil {
     ManagedSigil
 }
 
-pub impl Sigil : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for Sigil {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as uint).iter_bytes(lsb0, f)
     }
 }
 
-pub impl Sigil : ToStr {
+pub impl ToStr for Sigil {
     pure fn to_str(&self) -> ~str {
         match *self {
             BorrowedSigil => ~"&",
@@ -377,7 +377,7 @@ pub enum inferable<T> {
     infer(node_id)
 }
 
-pub impl<T: to_bytes::IterBytes> inferable<T> : to_bytes::IterBytes {
+pub impl<T: to_bytes::IterBytes> to_bytes::IterBytes for inferable<T> {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         match *self {
           expl(ref t) =>
@@ -395,7 +395,7 @@ pub impl<T: to_bytes::IterBytes> inferable<T> : to_bytes::IterBytes {
 #[deriving_eq]
 pub enum rmode { by_ref, by_val, by_copy }
 
-pub impl rmode : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for rmode {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as u8).iter_bytes(lsb0, f)
     }
@@ -736,13 +736,13 @@ pub enum trait_method {
 #[deriving_eq]
 pub enum int_ty { ty_i, ty_char, ty_i8, ty_i16, ty_i32, ty_i64, }
 
-pub impl int_ty : ToStr {
+pub impl ToStr for int_ty {
     pure fn to_str(&self) -> ~str {
         ::ast_util::int_ty_to_str(*self)
     }
 }
 
-pub impl int_ty : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for int_ty {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as u8).iter_bytes(lsb0, f)
     }
@@ -753,13 +753,13 @@ pub impl int_ty : to_bytes::IterBytes {
 #[deriving_eq]
 pub enum uint_ty { ty_u, ty_u8, ty_u16, ty_u32, ty_u64, }
 
-pub impl uint_ty : ToStr {
+pub impl ToStr for uint_ty {
     pure fn to_str(&self) -> ~str {
         ::ast_util::uint_ty_to_str(*self)
     }
 }
 
-pub impl uint_ty : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for uint_ty {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as u8).iter_bytes(lsb0, f)
     }
@@ -770,13 +770,13 @@ pub impl uint_ty : to_bytes::IterBytes {
 #[deriving_eq]
 pub enum float_ty { ty_f, ty_f32, ty_f64, }
 
-pub impl float_ty : ToStr {
+pub impl ToStr for float_ty {
     pure fn to_str(&self) -> ~str {
         ::ast_util::float_ty_to_str(*self)
     }
 }
 
-pub impl float_ty : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for float_ty {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as u8).iter_bytes(lsb0, f)
     }
@@ -830,7 +830,7 @@ pub enum Onceness {
     Many
 }
 
-pub impl Onceness : ToStr {
+pub impl ToStr for Onceness {
     pure fn to_str(&self) -> ~str {
         match *self {
             Once => ~"once",
@@ -839,7 +839,7 @@ pub impl Onceness : ToStr {
     }
 }
 
-pub impl Onceness : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for Onceness {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as uint).iter_bytes(lsb0, f);
     }
@@ -889,7 +889,7 @@ pub enum ty_ {
     ty_infer,
 }
 
-pub impl Ty : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for Ty {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         to_bytes::iter_bytes_2(&self.span.lo, &self.span.hi, lsb0, f);
     }
@@ -925,7 +925,7 @@ pub enum purity {
     extern_fn, // declared with "extern fn"
 }
 
-pub impl purity : ToStr {
+pub impl ToStr for purity {
     pure fn to_str(&self) -> ~str {
         match *self {
             impure_fn => ~"impure",
@@ -936,7 +936,7 @@ pub impl purity : ToStr {
     }
 }
 
-pub impl purity : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for purity {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as u8).iter_bytes(lsb0, f)
     }
@@ -951,7 +951,7 @@ pub enum ret_style {
     return_val, // everything else
 }
 
-pub impl ret_style : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for ret_style {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as u8).iter_bytes(lsb0, f)
     }
@@ -1232,7 +1232,7 @@ pub enum item_ {
 #[deriving_eq]
 pub enum struct_mutability { struct_mutable, struct_immutable }
 
-pub impl struct_mutability : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for struct_mutability {
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as u8).iter_bytes(lsb0, f)
     }
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index 9eeee943f8b..108a0dfc5e0 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -34,7 +34,7 @@ pub enum path_elt {
     path_name(ident)
 }
 
-pub impl path_elt : cmp::Eq {
+pub impl cmp::Eq for path_elt {
     pure fn eq(&self, other: &path_elt) -> bool {
         match (*self) {
             path_mod(e0a) => {
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 335dd4e3fa2..f7ae2058095 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -198,7 +198,7 @@ pub pure fn is_call_expr(e: @expr) -> bool {
 }
 
 // This makes def_id hashable
-pub impl def_id : to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for def_id {
     #[inline(always)]
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         to_bytes::iter_bytes_2(&self.crate, &self.node, lsb0, f);
@@ -303,7 +303,7 @@ pub trait inlined_item_utils {
     fn accept<E>(&self, e: E, v: visit::vt<E>);
 }
 
-pub impl inlined_item: inlined_item_utils {
+pub impl inlined_item_utils for inlined_item {
     fn ident(&self) -> ident {
         match *self {
             ii_item(i) => /* FIXME (#2543) */ copy i.ident,
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 3c61e834af6..851b35ca3bd 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -46,71 +46,71 @@ pub enum CharPos = uint;
 // XXX: Lots of boilerplate in these impls, but so far my attempts to fix
 // have been unsuccessful
 
-pub impl BytePos: Pos {
+pub impl Pos for BytePos {
     static pure fn from_uint(n: uint) -> BytePos { BytePos(n) }
     pure fn to_uint(&self) -> uint { **self }
 }
 
-pub impl BytePos: cmp::Eq {
+pub impl cmp::Eq for BytePos {
     pure fn eq(&self, other: &BytePos) -> bool { **self == **other }
     pure fn ne(&self, other: &BytePos) -> bool { !(*self).eq(other) }
 }
 
-pub impl BytePos: cmp::Ord {
+pub impl cmp::Ord for BytePos {
     pure fn lt(&self, other: &BytePos) -> bool { **self < **other }
     pure fn le(&self, other: &BytePos) -> bool { **self <= **other }
     pure fn ge(&self, other: &BytePos) -> bool { **self >= **other }
     pure fn gt(&self, other: &BytePos) -> bool { **self > **other }
 }
 
-pub impl BytePos: Add<BytePos, BytePos> {
+pub impl Add<BytePos, BytePos> for BytePos {
     pure fn add(&self, rhs: &BytePos) -> BytePos {
         BytePos(**self + **rhs)
     }
 }
 
-pub impl BytePos: Sub<BytePos, BytePos> {
+pub impl Sub<BytePos, BytePos> for BytePos {
     pure fn sub(&self, rhs: &BytePos) -> BytePos {
         BytePos(**self - **rhs)
     }
 }
 
-pub impl BytePos: to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for BytePos {
     pure fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) {
         (**self).iter_bytes(lsb0, f)
     }
 }
 
-pub impl CharPos: Pos {
+pub impl Pos for CharPos {
     static pure fn from_uint(n: uint) -> CharPos { CharPos(n) }
     pure fn to_uint(&self) -> uint { **self }
 }
 
-pub impl CharPos: cmp::Eq {
+pub impl cmp::Eq for CharPos {
     pure fn eq(&self, other: &CharPos) -> bool { **self == **other }
     pure fn ne(&self, other: &CharPos) -> bool { !(*self).eq(other) }
 }
 
-pub impl CharPos: cmp::Ord {
+pub impl cmp::Ord for CharPos {
     pure fn lt(&self, other: &CharPos) -> bool { **self < **other }
     pure fn le(&self, other: &CharPos) -> bool { **self <= **other }
     pure fn ge(&self, other: &CharPos) -> bool { **self >= **other }
     pure fn gt(&self, other: &CharPos) -> bool { **self > **other }
 }
 
-pub impl CharPos: to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for CharPos {
     pure fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) {
         (**self).iter_bytes(lsb0, f)
     }
 }
 
-pub impl CharPos: Add<CharPos, CharPos> {
+pub impl Add<CharPos,CharPos> for CharPos {
     pure fn add(&self, rhs: &CharPos) -> CharPos {
         CharPos(**self + **rhs)
     }
 }
 
-pub impl CharPos: Sub<CharPos, CharPos> {
+pub impl Sub<CharPos,CharPos> for CharPos {
     pure fn sub(&self, rhs: &CharPos) -> CharPos {
         CharPos(**self - **rhs)
     }
@@ -133,19 +133,19 @@ pub struct span {
 #[deriving_eq]
 pub struct spanned<T> { node: T, span: span }
 
-pub impl span : cmp::Eq {
+pub impl cmp::Eq for span {
     pure fn eq(&self, other: &span) -> bool {
         return (*self).lo == (*other).lo && (*self).hi == (*other).hi;
     }
     pure fn ne(&self, other: &span) -> bool { !(*self).eq(other) }
 }
 
-pub impl<S: Encoder> span: Encodable<S> {
+pub impl<S: Encoder> Encodable<S> for span {
     /* Note #1972 -- spans are encoded but not decoded */
     fn encode(&self, _s: &S) { }
 }
 
-pub impl<D: Decoder> span: Decodable<D> {
+pub impl<D: Decoder> Decodable<D> for span {
     static fn decode(_d: &D) -> span {
         dummy_sp()
     }
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 58ab05987a6..12e5f1891aa 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -54,7 +54,7 @@ pub trait append_types {
     fn add_tys(+tys: ~[@ast::Ty]) -> @ast::path;
 }
 
-pub impl @ast::path: append_types {
+pub impl append_types for @ast::path {
     fn add_ty(ty: @ast::Ty) -> @ast::path {
         @ast::path { types: vec::append_one(self.types, ty),
                      .. *self}
@@ -112,7 +112,7 @@ pub trait ext_ctxt_ast_builder {
     fn strip_bounds(bounds: &[ast::ty_param]) -> ~[ast::ty_param];
 }
 
-pub impl ext_ctxt: ext_ctxt_ast_builder {
+pub impl ext_ctxt_ast_builder for ext_ctxt {
     fn ty_option(ty: @ast::Ty) -> @ast::Ty {
         self.ty_path_ast_builder(path_global(~[
             self.ident_of(~"core"),
diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs
index cde6a581dce..a8e0b3ba934 100644
--- a/src/libsyntax/ext/pipes/check.rs
+++ b/src/libsyntax/ext/pipes/check.rs
@@ -37,7 +37,7 @@ use ext::base::ext_ctxt;
 use ext::pipes::proto::{state, protocol, next_state};
 use ext::pipes::proto;
 
-pub impl ext_ctxt: proto::visitor<(), (), ()>  {
+pub impl proto::visitor<(), (), ()> for ext_ctxt {
     fn visit_proto(_proto: protocol,
                    _states: &[()]) { }
 
diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs
index 6a1708b8e2b..87561047470 100644
--- a/src/libsyntax/ext/pipes/parse_proto.rs
+++ b/src/libsyntax/ext/pipes/parse_proto.rs
@@ -22,7 +22,7 @@ pub trait proto_parser {
     fn parse_message(state: state);
 }
 
-pub impl parser::Parser: proto_parser {
+pub impl proto_parser for parser::Parser {
     fn parse_proto(id: ~str) -> protocol {
         let proto = protocol(id, self.span);
 
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 0f596e66158..68d18a2937c 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -45,7 +45,7 @@ pub trait gen_init {
     fn gen_init_bounded(ext_cx: ext_ctxt) -> @ast::expr;
 }
 
-pub impl message: gen_send {
+pub impl gen_send for message {
     fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item {
         debug!("pipec: gen_send");
         match self {
@@ -201,7 +201,7 @@ pub impl message: gen_send {
     }
 }
 
-pub impl state: to_type_decls {
+pub impl to_type_decls for state {
     fn to_type_decls(cx: ext_ctxt) -> ~[@ast::item] {
         debug!("pipec: to_type_decls");
         // This compiles into two different type declarations. Say the
@@ -305,8 +305,7 @@ pub impl state: to_type_decls {
     }
 }
 
-pub impl protocol: gen_init {
-
+pub impl gen_init for protocol {
     fn gen_init(cx: ext_ctxt) -> @ast::item {
         let ext_cx = cx;
 
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index 1d6534aef34..027375b6326 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -21,7 +21,7 @@ use core::to_str::ToStr;
 
 pub enum direction { send, recv }
 
-pub impl direction : cmp::Eq {
+pub impl cmp::Eq for direction {
     pure fn eq(&self, other: &direction) -> bool {
         match ((*self), (*other)) {
             (send, send) => true,
@@ -33,7 +33,7 @@ pub impl direction : cmp::Eq {
     pure fn ne(&self, other: &direction) -> bool { !(*self).eq(other) }
 }
 
-pub impl direction: ToStr {
+pub impl ToStr for direction {
     pure fn to_str(&self) -> ~str {
         match *self {
           send => ~"Send",
@@ -156,7 +156,6 @@ pub struct protocol_ {
 }
 
 pub impl protocol_ {
-
     /// Get a state.
     fn get_state(name: ~str) -> state {
         self.states.find(|i| i.name == name).get()
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index ff9a353ee92..dc5d7916c7e 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -692,7 +692,7 @@ pub fn default_ast_fold() -> ast_fold_fns {
           new_span: noop_span};
 }
 
-pub impl ast_fold_fns: ast_fold {
+pub impl ast_fold for ast_fold_fns {
     /* naturally, a macro to write these would be nice */
     fn fold_crate(c: crate) -> crate {
         let (n, s) = (self.fold_crate)(c.node, c.span, self as ast_fold);
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index cb9382ebbb6..92c4f1e828f 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -127,7 +127,7 @@ impl reader for StringReader {
     fn dup(@mut self) -> reader { dup_string_reader(self) as reader }
 }
 
-pub impl TtReader: reader {
+pub impl reader for TtReader {
     fn is_eof(@mut self) -> bool { self.cur_tok == token::EOF }
     fn next_token(@mut self) -> TokenAndSpan { tt_next_token(self) }
     fn fatal(@mut self, m: ~str) -> ! {
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 1b4493b7ec9..bf04996838c 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -45,10 +45,11 @@ pub enum ObsoleteSyntax {
     ObsoleteMoveInit,
     ObsoleteBinaryMove,
     ObsoleteUnsafeBlock,
-    ObsoleteUnenforcedBound
+    ObsoleteUnenforcedBound,
+    ObsoleteImplSyntax
 }
 
-pub impl ObsoleteSyntax: to_bytes::IterBytes {
+pub impl to_bytes::IterBytes for ObsoleteSyntax {
     #[inline(always)]
     pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
         (*self as uint).iter_bytes(lsb0, f);
@@ -115,6 +116,10 @@ pub impl Parser {
                 "unenforced type parameter bound",
                 "use trait bounds on the functions that take the type as \
                  arguments, not on the types themselves"
+            ),
+            ObsoleteImplSyntax => (
+                "colon-separated impl syntax",
+                "write `impl Trait for Type`"
             )
         };
 
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index b4fd7a5d2e8..15258a6bbee 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -74,7 +74,7 @@ use parse::obsolete::{ObsoleteLet, ObsoleteFieldTerminator};
 use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove};
 use parse::obsolete::{ObsoleteStructCtor, ObsoleteWith};
 use parse::obsolete::{ObsoleteSyntax, ObsoleteLowerCaseKindBounds};
-use parse::obsolete::{ObsoleteUnsafeBlock};
+use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax};
 use parse::prec::{as_prec, token_to_binop};
 use parse::token::{can_begin_expr, is_ident, is_ident_or_path};
 use parse::token::{is_plain_ident, INTERPOLATED, special_idents};
@@ -2829,16 +2829,11 @@ pub impl Parser {
         // XXX: clownshoes
         let ident = special_idents::clownshoes_extensions;
 
-        // Parse the type. (If this is `impl trait for type`, however, this
-        // actually parses the trait.)
+        // Parse the trait.
         let mut ty = self.parse_ty(false);
 
         // Parse traits, if necessary.
-        let opt_trait = if self.token == token::COLON {
-            // Old-style trait.
-            self.bump();
-            Some(self.parse_trait_ref())
-        } else if self.eat_keyword(~"for") {
+        let opt_trait = if self.eat_keyword(~"for") {
             // New-style trait. Reinterpret the type as a trait.
             let opt_trait_ref = match ty.node {
                 ty_path(path, node_id) => {
@@ -2855,6 +2850,9 @@ pub impl Parser {
 
             ty = self.parse_ty(false);
             opt_trait_ref
+        } else if self.eat(token::COLON) {
+            self.obsolete(copy self.span, ObsoleteImplSyntax);
+            Some(self.parse_trait_ref())
         } else {
             None
         };
diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs
index 0677e25a3fe..657e6ee59fa 100644
--- a/src/libsyntax/util/interner.rs
+++ b/src/libsyntax/util/interner.rs
@@ -42,7 +42,7 @@ pub trait Interner<T:Eq IterBytes Hash Const Copy> {
     fn len() -> uint;
 }
 
-pub impl <T:Eq IterBytes Hash Const Copy> hash_interner<T>: Interner<T> {
+pub impl<T:Eq IterBytes Hash Const Copy> Interner<T> for hash_interner<T> {
     fn intern(val: T) -> uint {
         match self.map.find(&val) {
           Some(idx) => return idx,