Skip to content

Instantly share code, notes, and snippets.

@Mr-Byte
Created September 4, 2013 03:01
Show Gist options
  • Save Mr-Byte/6432320 to your computer and use it in GitHub Desktop.
Save Mr-Byte/6432320 to your computer and use it in GitHub Desktop.
struct Blorp
{
bar: ~int
}
impl Blorp
{
fn wrap(value: ~int) -> Blorp
{
Blorp { bar: value }
}
}
type Blurp = Blorp;
struct Foo<T>
{
bar: ~T
}
impl<T> Foo<T>
{
fn wrap(value: ~T) -> Foo<T>
{
Foo { bar: value }
}
}
type Baz = Foo<int>;
fn main()
{
let blorpA = Blorp::wrap(~50); //Compiles
let blorpB = Blurp::wrap(~50); //Fails
let bazA: Baz = Foo::wrap(~50); //Compiles
let bazB: Baz = Foo::<int>::wrap(~50); //Compiles
let bazC: Baz = Baz::wrap(~50); //Fails
}
@Mr-Byte
Copy link
Author

Mr-Byte commented Sep 4, 2013

.\test.rs:34:17: 34:28 error: unresolved name
.\test.rs:34     let blorpB = Blurp::wrap(~50);  //Fails
                              ^~~~~~~~~~~
.\test.rs:34:17: 34:28 error: use of undeclared module `Blurp`
.\test.rs:34     let blorpB = Blurp::wrap(~50);  //Fails
                              ^~~~~~~~~~~
.\test.rs:34:17: 34:28 error: unresolved name `Blurp::wrap`.
.\test.rs:34     let blorpB = Blurp::wrap(~50);  //Fails
                              ^~~~~~~~~~~
.\test.rs:38:20: 38:29 error: unresolved name
.\test.rs:38     let bazC: Baz = Baz::wrap(~50);         //Fails
                                 ^~~~~~~~~
.\test.rs:38:20: 38:29 error: use of undeclared module `Baz`
.\test.rs:38     let bazC: Baz = Baz::wrap(~50);         //Fails
                                 ^~~~~~~~~
.\test.rs:38:20: 38:29 error: unresolved name `Baz::wrap`.
.\test.rs:38     let bazC: Baz = Baz::wrap(~50);         //Fails
                                 ^~~~~~~~~
error: aborting due to 6 previous errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment