about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-11-29 18:37:33 -0800
committerBrian Anderson <banderson@mozilla.com>2012-11-29 22:07:49 -0800
commit3ed9fbd63c6a3c6226bc466786e6d3c1bfec856d (patch)
tree3552c8b37426ce0763648cb056f37f03a7b777ed
parent78ee821154ba6034a86397d8540fec00c94e9282 (diff)
downloadrust-3ed9fbd63c6a3c6226bc466786e6d3c1bfec856d.tar.gz
rust-3ed9fbd63c6a3c6226bc466786e6d3c1bfec856d.zip
impls of traits cannot define methods on the anonymous trait
-rw-r--r--src/libcore/iter.rs1
-rw-r--r--src/libcore/path.rs3
-rw-r--r--src/libcore/pipes.rs23
-rw-r--r--src/libcore/reflect.rs7
-rw-r--r--src/librustc/middle/astencode.rs13
-rw-r--r--src/librustc/middle/typeck/check/mod.rs2
-rw-r--r--src/librustc/middle/typeck/collect.rs27
-rw-r--r--src/librustc/middle/typeck/infer/lub.rs8
-rw-r--r--src/libstd/map.rs4
-rw-r--r--src/libstd/net_tcp.rs3
-rw-r--r--src/libstd/smallintmap.rs1
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs3
-rw-r--r--src/libsyntax/ext/pipes/mod.rs1
-rw-r--r--src/libsyntax/ext/pipes/parse_proto.rs1
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs5
-rw-r--r--src/libsyntax/ext/trace_macros.rs1
-rw-r--r--src/libsyntax/parse/common.rs36
-rw-r--r--src/libsyntax/parse/mod.rs1
-rw-r--r--src/libsyntax/parse/obsolete.rs7
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/test/compile-fail/issue-3953.rs8
-rw-r--r--src/test/compile-fail/trait-impl-can-not-have-untraitful-methods.rs7
-rw-r--r--src/test/run-pass/reflect-visit-data.rs7
23 files changed, 87 insertions, 84 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index d318c279999..37491ae0b71 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -37,6 +37,7 @@ pub trait Times {
 pub trait CopyableIter<A:Copy> {
     pure fn filter_to_vec(pred: fn(a: A) -> bool) -> ~[A];
     pure fn map_to_vec<B>(op: fn(v: A) -> B) -> ~[B];
+    pure fn flat_map_to_vec<B:Copy,IB: BaseIter<B>>(op: fn(A) -> IB) -> ~[B];
     pure fn to_vec() -> ~[A];
     pure fn find(p: fn(a: A) -> bool) -> Option<A>;
 }
diff --git a/src/libcore/path.rs b/src/libcore/path.rs
index f0fefee9d06..a9a99565cf1 100644
--- a/src/libcore/path.rs
+++ b/src/libcore/path.rs
@@ -44,6 +44,9 @@ pub trait GenericPath {
     pure fn with_filestem((&str)) -> self;
     pure fn with_filetype((&str)) -> self;
 
+    pure fn dir_path() -> self;
+    pure fn file_path() -> self;
+
     pure fn push((&str)) -> self;
     pure fn push_rel((&self)) -> self;
     pure fn push_many((&[~str])) -> self;
diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs
index 561732057cf..a06564a470e 100644
--- a/src/libcore/pipes.rs
+++ b/src/libcore/pipes.rs
@@ -811,13 +811,22 @@ pub struct RecvPacketBuffered<T: Send, Tbuffer: Send> {
     }
 }
 
-impl<T: Send, Tbuffer: Send> RecvPacketBuffered<T, Tbuffer> : Selectable {
+impl<T: Send, Tbuffer: Send> RecvPacketBuffered<T, Tbuffer> {
     fn unwrap() -> *Packet<T> {
         let mut p = None;
         p <-> self.p;
         option::unwrap(move p)
     }
 
+    fn reuse_buffer() -> BufferResource<Tbuffer> {
+        //error!("recv reuse_buffer");
+        let mut tmp = None;
+        tmp <-> self.buffer;
+        option::unwrap(move tmp)
+    }
+}
+
+impl<T: Send, Tbuffer: Send> RecvPacketBuffered<T, Tbuffer> : Selectable {
     pure fn header() -> *PacketHeader {
         match self.p {
           Some(packet) => unsafe {
@@ -829,13 +838,6 @@ impl<T: Send, Tbuffer: Send> RecvPacketBuffered<T, Tbuffer> : Selectable {
           None => fail ~"packet already consumed"
         }
     }
-
-    fn reuse_buffer() -> BufferResource<Tbuffer> {
-        //error!("recv reuse_buffer");
-        let mut tmp = None;
-        tmp <-> self.buffer;
-        option::unwrap(move tmp)
-    }
 }
 
 pub fn RecvPacketBuffered<T: Send, Tbuffer: Send>(p: *Packet<T>)
@@ -1046,7 +1048,7 @@ pub fn PortSet<T: Send>() -> PortSet<T>{
     }
 }
 
-impl<T: Send> PortSet<T> : Recv<T> {
+impl<T: Send> PortSet<T> {
 
     fn add(port: pipes::Port<T>) {
         self.ports.push(move port)
@@ -1057,6 +1059,9 @@ impl<T: Send> PortSet<T> : Recv<T> {
         self.add(move po);
         move ch
     }
+}
+
+impl<T: Send> PortSet<T> : Recv<T> {
 
     fn try_recv() -> Option<T> {
         let mut result = None;
diff --git a/src/libcore/reflect.rs b/src/libcore/reflect.rs
index 3fa37a2fb8e..d9b18947779 100644
--- a/src/libcore/reflect.rs
+++ b/src/libcore/reflect.rs
@@ -34,9 +34,7 @@ pub fn MovePtrAdaptor<V: TyVisitor MovePtr>(v: V) -> MovePtrAdaptor<V> {
     MovePtrAdaptor { inner: move v }
 }
 
-/// Abstract type-directed pointer-movement using the MovePtr trait
-impl<V: TyVisitor MovePtr> MovePtrAdaptor<V>: TyVisitor {
-
+impl<V: TyVisitor MovePtr> MovePtrAdaptor<V> {
     #[inline(always)]
     fn bump(sz: uint) {
       do self.inner.move_ptr() |p| {
@@ -60,7 +58,10 @@ impl<V: TyVisitor MovePtr> MovePtrAdaptor<V>: TyVisitor {
     fn bump_past<T>() {
         self.bump(sys::size_of::<T>());
     }
+}
 
+/// Abstract type-directed pointer-movement using the MovePtr trait
+impl<V: TyVisitor MovePtr> MovePtrAdaptor<V>: TyVisitor {
     fn visit_bot() -> bool {
         self.align_to::<()>();
         if ! self.inner.visit_bot() { return false; }
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index 1c7338fe317..8ee50986a00 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -72,6 +72,10 @@ trait tr {
     fn tr(xcx: extended_decode_ctxt) -> self;
 }
 
+trait tr_intern {
+    fn tr_intern(xcx: extended_decode_ctxt) -> ast::def_id;
+}
+
 // ______________________________________________________________________
 // Top-level methods.
 
@@ -168,13 +172,16 @@ impl extended_decode_ctxt {
     }
 }
 
+impl ast::def_id: tr_intern {
+    fn tr_intern(xcx: extended_decode_ctxt) -> ast::def_id {
+        xcx.tr_intern_def_id(self)
+    }
+}
+
 impl ast::def_id: tr {
     fn tr(xcx: extended_decode_ctxt) -> ast::def_id {
         xcx.tr_def_id(self)
     }
-    fn tr_intern(xcx: extended_decode_ctxt) -> ast::def_id {
-        xcx.tr_intern_def_id(self)
-    }
 }
 
 impl span: tr {
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index 32d7181b40d..7be2f6bb9d3 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -549,7 +549,6 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
 }
 
 impl @fn_ctxt: ast_conv {
-    fn infcx() -> infer::infer_ctxt { self.inh.infcx }
     fn tcx() -> ty::ctxt { self.ccx.tcx }
     fn ccx() -> @crate_ctxt { self.ccx }
 
@@ -563,6 +562,7 @@ impl @fn_ctxt: ast_conv {
 }
 
 impl @fn_ctxt {
+    fn infcx() -> infer::infer_ctxt { self.inh.infcx }
     fn search_in_scope_regions(br: ty::bound_region)
         -> Result<ty::Region, ~str>
     {
diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs
index 0c6fe585768..9dda2da458a 100644
--- a/src/librustc/middle/typeck/collect.rs
+++ b/src/librustc/middle/typeck/collect.rs
@@ -465,22 +465,27 @@ fn check_methods_against_trait(ccx: @crate_ctxt,
         }
     }
 
-    for vec::each(*ty::trait_methods(tcx, did)) |trait_m| {
-        match vec::find(impl_ms, |impl_m| trait_m.ident == impl_m.mty.ident) {
-            Some(ref cm) => {
+    // Check that each method we impl is a method on the trait
+    // Trait methods we don't implement must be default methods, but if not
+    // we'll catch it in coherence
+    let trait_ms = ty::trait_methods(tcx, did);
+    for impl_ms.each |impl_m| {
+        match trait_ms.find(|trait_m| trait_m.ident == impl_m.mty.ident) {
+            Some(ref trait_m) => {
                 compare_impl_method(
-                    ccx.tcx, vec::len(tps), cm, trait_m,
+                    ccx.tcx, tps.len(), impl_m, trait_m,
                     &tpt.substs, selfty);
             }
             None => {
-                // If we couldn't find an implementation for trait_m in
-                // the impl, then either this method has a default
-                // implementation or we're using the trait-provided
-                // version. Either way, we handle this later, during the
-                // coherence phase.
+                // This method is not part of the trait
+                tcx.sess.span_err(
+                    impl_m.span,
+                    fmt!("method `%s` is not a member of trait `%s`",
+                         tcx.sess.str_of(impl_m.mty.ident),
+                         path_to_str(a_trait_ty.path, tcx.sess.intr())));
             }
-        } // match
-    } // |trait_m|
+        }
+    }
 } // fn
 
 fn convert_field(ccx: @crate_ctxt,
diff --git a/src/librustc/middle/typeck/infer/lub.rs b/src/librustc/middle/typeck/infer/lub.rs
index 8c3357190f7..80fcecb5d9e 100644
--- a/src/librustc/middle/typeck/infer/lub.rs
+++ b/src/librustc/middle/typeck/infer/lub.rs
@@ -7,6 +7,11 @@ fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export.
 
 enum Lub = combine_fields;  // "subtype", "subregion" etc
 
+impl Lub {
+    fn bot_ty(b: ty::t) -> cres<ty::t> { Ok(b) }
+    fn ty_bot(b: ty::t) -> cres<ty::t> { self.bot_ty(b) } // commutative
+}
+
 impl Lub: combine {
     fn infcx() -> infer_ctxt { self.infcx }
     fn tag() -> ~str { ~"lub" }
@@ -16,9 +21,6 @@ impl Lub: combine {
     fn lub() -> Lub { Lub(*self) }
     fn glb() -> Glb { Glb(*self) }
 
-    fn bot_ty(b: ty::t) -> cres<ty::t> { Ok(b) }
-    fn ty_bot(b: ty::t) -> cres<ty::t> { self.bot_ty(b) } // commutative
-
     fn mts(a: ty::mt, b: ty::mt) -> cres<ty::mt> {
         let tcx = self.infcx.tcx;
 
diff --git a/src/libstd/map.rs b/src/libstd/map.rs
index d68970679ad..b1909bfb067 100644
--- a/src/libstd/map.rs
+++ b/src/libstd/map.rs
@@ -390,7 +390,7 @@ pub mod chained {
         }
     }
 
-    impl<K:Eq IterBytes Hash Copy ToStr, V: ToStr Copy> T<K, V>: ToStr {
+    impl<K:Eq IterBytes Hash Copy ToStr, V: ToStr Copy> T<K, V> {
         fn to_writer(wr: io::Writer) {
             if self.count == 0u {
                 wr.write_str(~"{}");
@@ -410,7 +410,9 @@ pub mod chained {
             };
             wr.write_str(~" }");
         }
+    }
 
+    impl<K:Eq IterBytes Hash Copy ToStr, V: ToStr Copy> T<K, V>: ToStr {
         pure fn to_str() -> ~str unsafe {
             // Meh -- this should be safe
             do io::with_str_writer |wr| { self.to_writer(wr) }
diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs
index 96897790fcd..966cbbb6c14 100644
--- a/src/libstd/net_tcp.rs
+++ b/src/libstd/net_tcp.rs
@@ -824,9 +824,6 @@ impl TcpSocketBuf: io::Reader {
             bytes[0] as int
         }
     }
-    fn unread_byte(amt: int) {
-        self.data.buf.unshift(amt as u8);
-    }
     fn eof() -> bool {
         self.end_of_stream
     }
diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs
index 3f9d308584d..dd773d25687 100644
--- a/src/libstd/smallintmap.rs
+++ b/src/libstd/smallintmap.rs
@@ -101,7 +101,6 @@ impl<V: Copy> SmallIntMap<V>: map::Map<uint, V> {
     }
     pure fn get(key: uint) -> V { get(self, key) }
     pure fn find(key: uint) -> Option<V> { find(self, key) }
-    fn rehash() { fail }
 
     fn update_with_key(key: uint, val: V, ff: fn(uint, V, V) -> V) -> bool {
         match self.find(key) {
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 652ad5533c4..e9bb42aa2a1 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -79,7 +79,10 @@ trait ext_ctxt_ast_builder {
     fn stmt_let(ident: ident, e: @ast::expr) -> @ast::stmt;
     fn stmt_expr(e: @ast::expr) -> @ast::stmt;
     fn block_expr(b: ast::blk) -> @ast::expr;
+    fn move_expr(e: @ast::expr) -> @ast::expr;
     fn ty_option(ty: @ast::Ty) -> @ast::Ty;
+    fn ty_infer() -> @ast::Ty;
+    fn ty_nil_ast_builder() -> @ast::Ty;
 }
 
 impl ext_ctxt: ext_ctxt_ast_builder {
diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs
index b064f39eb3a..9f5c722afc3 100644
--- a/src/libsyntax/ext/pipes/mod.rs
+++ b/src/libsyntax/ext/pipes/mod.rs
@@ -38,7 +38,6 @@ use ext::base::ext_ctxt;
 use ast::tt_delim;
 use parse::lexer::{new_tt_reader, reader};
 use parse::parser::Parser;
-use parse::common::parser_common;
 
 use pipes::parse_proto::proto_parser;
 
diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs
index 8f2b92a720c..9db2c1e6733 100644
--- a/src/libsyntax/ext/pipes/parse_proto.rs
+++ b/src/libsyntax/ext/pipes/parse_proto.rs
@@ -8,6 +8,7 @@ use pipec::*;
 trait proto_parser {
     fn parse_proto(id: ~str) -> protocol;
     fn parse_state(proto: protocol);
+    fn parse_message(state: state);
 }
 
 impl parser::Parser: proto_parser {
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 907a193d05c..558e7d01259 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -24,6 +24,7 @@ mod syntax {
 
 trait gen_send {
     fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item;
+    fn to_ty(cx: ext_ctxt) -> @ast::Ty;
 }
 
 trait to_type_decls {
@@ -34,6 +35,10 @@ trait to_type_decls {
 trait gen_init {
     fn gen_init(cx: ext_ctxt) -> @ast::item;
     fn compile(cx: ext_ctxt) -> @ast::item;
+    fn buffer_ty_path(cx: ext_ctxt) -> @ast::Ty;
+    fn gen_buffer_type(cx: ext_ctxt) -> @ast::item;
+    fn gen_buffer_init(ext_cx: ext_ctxt) -> @ast::expr;
+    fn gen_init_bounded(ext_cx: ext_ctxt) -> @ast::expr;
 }
 
 impl message: gen_send {
diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs
index f8c85fa01b7..fb0d4bb128e 100644
--- a/src/libsyntax/ext/trace_macros.rs
+++ b/src/libsyntax/ext/trace_macros.rs
@@ -3,7 +3,6 @@ use ext::base::ext_ctxt;
 use ast::tt_delim;
 use parse::lexer::{new_tt_reader, reader};
 use parse::parser::Parser;
-use parse::common::parser_common;
 
 fn expand_trace_macros(cx: ext_ctxt, sp: span,
                        tt: ~[ast::token_tree]) -> base::mac_result
diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs
index 1811951fc0e..54ac776fb32 100644
--- a/src/libsyntax/parse/common.rs
+++ b/src/libsyntax/parse/common.rs
@@ -22,41 +22,7 @@ fn token_to_str(reader: reader, ++token: token::Token) -> ~str {
     token::to_str(reader.interner(), token)
 }
 
-trait parser_common {
-    fn unexpected_last(t: token::Token) -> !;
-    fn unexpected() -> !;
-    fn expect(t: token::Token);
-    fn parse_ident() -> ast::ident;
-    fn parse_path_list_ident() -> ast::path_list_ident;
-    fn parse_value_ident() -> ast::ident;
-    fn eat(tok: token::Token) -> bool;
-    // A sanity check that the word we are asking for is a known keyword
-    fn require_keyword(word: ~str);
-    fn token_is_keyword(word: ~str, ++tok: token::Token) -> bool;
-    fn is_keyword(word: ~str) -> bool;
-    fn is_any_keyword(tok: token::Token) -> bool;
-    fn eat_keyword(word: ~str) -> bool;
-    fn expect_keyword(word: ~str);
-    fn expect_gt();
-    fn parse_seq_to_before_gt<T: Copy>(sep: Option<token::Token>,
-                                       f: fn(Parser) -> T) -> ~[T];
-    fn parse_seq_to_gt<T: Copy>(sep: Option<token::Token>,
-                                f: fn(Parser) -> T) -> ~[T];
-    fn parse_seq_lt_gt<T: Copy>(sep: Option<token::Token>,
-                                f: fn(Parser) -> T) -> spanned<~[T]>;
-    fn parse_seq_to_end<T: Copy>(ket: token::Token, sep: seq_sep,
-                                 f: fn(Parser) -> T) -> ~[T];
-    fn parse_seq_to_before_end<T: Copy>(ket: token::Token, sep: seq_sep,
-                                        f: fn(Parser) -> T) -> ~[T];
-    fn parse_unspanned_seq<T: Copy>(bra: token::Token,
-                                    ket: token::Token,
-                                    sep: seq_sep,
-                                    f: fn(Parser) -> T) -> ~[T];
-    fn parse_seq<T: Copy>(bra: token::Token, ket: token::Token, sep: seq_sep,
-                          f: fn(Parser) -> T) -> spanned<~[T]>;
-}
-
-impl Parser: parser_common {
+impl Parser {
     fn unexpected_last(t: token::Token) -> ! {
         self.span_fatal(
             copy self.last_span,
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index c290e7cf307..c1afc43205c 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -27,7 +27,6 @@ export parse_from_source_str;
 
 use parser::Parser;
 use attr::parser_attr;
-use common::parser_common;
 use ast::node_id;
 use util::interner;
 use diagnostic::{span_handler, mk_span_handler, mk_handler, emitter};
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 89f2ef4d939..1407b56336c 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -52,12 +52,7 @@ impl ObsoleteSyntax: to_bytes::IterBytes {
     }
 }
 
-pub trait ObsoleteReporter {
-    fn obsolete(sp: span, kind: ObsoleteSyntax);
-    fn obsolete_expr(sp: span, kind: ObsoleteSyntax) -> @expr;
-}
-
-impl Parser : ObsoleteReporter {
+impl Parser {
     /// Reports an obsolete syntax non-fatal error.
     fn obsolete(sp: span, kind: ObsoleteSyntax) {
         let (kind_str, desc) = match kind {
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 96364790956..d8fd58b3d50 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -16,7 +16,7 @@ use common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed,
 use dvec::DVec;
 use vec::{push};
 use obsolete::{
-    ObsoleteReporter, ObsoleteSyntax,
+    ObsoleteSyntax,
     ObsoleteLowerCaseKindBounds, ObsoleteLet,
     ObsoleteFieldTerminator, ObsoleteStructCtor,
     ObsoleteWith, ObsoleteClassMethod, ObsoleteClassTraits,
diff --git a/src/test/compile-fail/issue-3953.rs b/src/test/compile-fail/issue-3953.rs
index 45fa00bd672..551c0bd2e36 100644
--- a/src/test/compile-fail/issue-3953.rs
+++ b/src/test/compile-fail/issue-3953.rs
@@ -9,9 +9,11 @@ trait Hahaha: 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 }
+pub impl Lol: Hahaha { }
+
+impl Lol: Eq {
+    pure fn eq(&self, other: &Lol) -> bool { **self != **other }
+    pure fn ne(&self, other: &Lol) -> bool { **self == **other }
 }
 
 fn main() {
diff --git a/src/test/compile-fail/trait-impl-can-not-have-untraitful-methods.rs b/src/test/compile-fail/trait-impl-can-not-have-untraitful-methods.rs
new file mode 100644
index 00000000000..b65b0d9d4ac
--- /dev/null
+++ b/src/test/compile-fail/trait-impl-can-not-have-untraitful-methods.rs
@@ -0,0 +1,7 @@
+trait A { }
+
+impl int: A {
+    fn foo() { } //~ ERROR method `foo` is not a member of trait `A`
+}
+
+fn main() { }
\ No newline at end of file
diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs
index 24ae16f25e1..733679efc61 100644
--- a/src/test/run-pass/reflect-visit-data.rs
+++ b/src/test/run-pass/reflect-visit-data.rs
@@ -21,7 +21,8 @@ fn align(size: uint, align: uint) -> uint {
 enum ptr_visit_adaptor<V: TyVisitor movable_ptr> = {
     inner: V
 };
-impl<V: TyVisitor movable_ptr> ptr_visit_adaptor<V>: TyVisitor {
+
+impl<V: TyVisitor movable_ptr> ptr_visit_adaptor<V> {
 
     #[inline(always)]
     fn bump(sz: uint) {
@@ -47,6 +48,10 @@ impl<V: TyVisitor movable_ptr> ptr_visit_adaptor<V>: TyVisitor {
         self.bump(sys::size_of::<T>());
     }
 
+}
+
+impl<V: TyVisitor movable_ptr> ptr_visit_adaptor<V>: TyVisitor {
+
     fn visit_bot() -> bool {
         self.align_to::<()>();
         if ! self.inner.visit_bot() { return false; }