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
#![feature(struct_variant)]pubmod en {pubenumMyEnum{Variant1(int),Variant2{pubname:String}}}
main.rs:
extern crate lib;
use lib::en;
fn main() {
let enu = en::Variant1(2i);
let enu2 = en::Variant2("Joe".to_string());
}
error:
main.rs:7:16: 7:28 error: unresolved name `en::Variant2`.
main.rs:7 let enu2 = en::Variant2("Joe".to_string());
^~~~~~~~~~~~
error: aborting due to previous error
But this works:
#![feature(struct_variant)]pubmod en {pubenumMyEnum{Variant1(int),Variant2{pubname:String}}}fnmain(){let enu = en::Variant1(2i);let enu2 = en::Variant2("Joe".to_string());}
The text was updated successfully, but these errors were encountered:
ghost
changed the title
struct variant constructors doesn't work with function call syntax when used in different crate
struct variants define a ctor function as if they were regular variants
Oct 24, 2014
lib.rs:
main.rs:
error:
But this works:
The text was updated successfully, but these errors were encountered: