Closed
Description
rusti> enum Foo{Bar} Foo::doesnt_exist()
rust: ~"\"!!! (resolving module in lexical scope) module wasn\\\'t actually a module!\""
<anon>:16:0: 16:17 error: unresolved name
<anon>:16 Foo::doesnt_exist();
^~~~~~~~~~~~~~~~~
<anon>:16:0: 16:17 error: use of undeclared module `Foo`
<anon>:16 Foo::doesnt_exist();
^~~~~~~~~~~~~~~~~
<anon>:16:0: 16:17 error: unresolved name `Foo::doesnt_exist`.
<anon>:16 Foo::doesnt_exist();
^~~~~~~~~~~~~~~~~
error: aborting due to 3 previous errors
rust: task failed at 'explicit failure', /home/huon/rust/src/libsyntax/diagnostic.rs:96
rusti> enum Foo{Bar} impl Foo { fn exists() {} } Foo::doesnt_exist()
<anon>:19:0: 19:17 error: unresolved name `Foo::doesnt_exist`.
<anon>:19 Foo::doesnt_exist();
^~~~~~~~~~~~~~~~~
error: aborting due to previous error
This is pretty confusing, it'd be nice to at least mention that there isn't a static method with that name like in the second run where there is another static method.
I presume this is because static methods create a secret mod
with the same name as the type, one possible resolution would be to always create this mod
rather than only doing so when required.