Skip to content

'extern mod foo(name = "bar")' is not equivalent to 'extern mod foo = "bar"'  #10265

Closed
@tautologico

Description

@tautologico

I'm trying to tackle #9543 but under the impression that 'extern mod foo(name = "bar")' should be equivalent to 'extern mod foo = "bar"'. After trying to change occurrences of the first form, I noticed rustc does not treat them equally. A minimal test shows this easily:

// world.rs
#[link(name = "world", vers="1.0")];
pub fn explore() -> &str { "world" }

This is used by

// main.rs
extern mod w(name = "world");
fn main() {
    println("hello " + w::explore());
}

And it all works if I compile world.rs as a lib and then compile main.rs passing -L . to rustc. If I change the first line in main.rs to extern mod w = "world", it does not work ("can't find crate for 'w')".

While trying to find out if the two forms should be equivalent I looked at view items in the manual; by the specification there maybe the two forms are not meant to be equivalent, but I was informed on IRC that this is probably a rustc bug, so I'm filing it.

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