impls of traits cannot define methods on the anonymous trait

This commit is contained in:
Brian Anderson 2012-11-29 18:37:33 -08:00
parent 78ee821154
commit 3ed9fbd63c
23 changed files with 87 additions and 84 deletions

View file

@ -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() {

View file

@ -0,0 +1,7 @@
trait A { }
impl int: A {
fn foo() { } //~ ERROR method `foo` is not a member of trait `A`
}
fn main() { }

View file

@ -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; }