Skip to content

Resolve error when initializing a struct with explicit module #3846

Closed
@burg

Description

@burg

This doesn't make any sense to me.

Test case

mod buildings {
    struct Tower { height: uint }
}

fn main() {
    let sears = buildings::Tower { height: 1451 };
    io::println(sears.height.to_str());
}

Output

[burg@host-7-150 Desktop]# rustc test.rs
test.rs:6:16: 6:32 error: `buildings::Tower` does not name a structure
test.rs:6     let sears = buildings::Tower { height: 1451 };
                          ^~~~~~~~~~~~~~~~
error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions