You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've been giving rust a try and hit my first compiler bug today. I was playing around with traits and ran into an error with the following code:
trait A{
fn as_A(&self) -> &A {self}
}
impl<T> A for T {}
trait B: A {
fn as_B(&self) -> &B {self}
}
impl<T> B for T{}
fn main() {
let i = 5i;
let a: &A = i.as_A();
let b: &B = a.as_B();
}
In particular it seems it's the last line in main that breaks things, if I comment that out it compiles (and runs) without issue.
bad2.rs:2:27: 2:31 error: the trait `core::marker::Sized` is not implemented for the type `Self`
bad2.rs:2 fn as_A(&self) -> &A {self}
^~~~
bad2.rs:7:27: 7:31 error: the trait `core::marker::Sized` is not implemented for the type `Self`
bad2.rs:7 fn as_B(&self) -> &B {self}
^~~~
Which seems like the right error message. Please reopen if you are still having trouble.
Please reopen if you are still
Hi, I've been giving rust a try and hit my first compiler bug today. I was playing around with traits and ran into an error with the following code:
In particular it seems it's the last line in
main
that breaks things, if I comment that out it compiles (and runs) without issue.Here's output from rustc:
I am using
rustc 0.12.0-nightly (94b0aace1 2014-09-27 23:12:54 +0000)
on OS X 10.9.4The text was updated successfully, but these errors were encountered: