Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking error when using a public inherent method on a value of an unnameable type in an external crate. #31568

Closed
jseyfried opened this issue Feb 11, 2016 · 2 comments

Comments

@jseyfried
Copy link
Contributor

For example, consider a crate demo:

pub fn f() -> foo::Bar { foo::Bar }

mod foo {
    pub struct Bar;
    impl Bar {
        pub fn baz(&self) {}
    }
}

and another crate that uses demo:

extern crate demo;

fn main() {
    demo::f().baz();
}

Here, demo::foo::Bar is unnameable in the other crate.
Compiling the other crate will cause an error:

error: linking with `cc` failed: exit code: 1
note: /home/ubuntu/demo/target/debug/examples/example.0.o: In function `example::main':
/home/ubuntu/demo/examples/example.rs:4: undefined reference to `foo::Bar::baz::h2fcc0e6532120868paa'
collect2: error: ld returned 1 exit status
@petrochenkov
Copy link
Contributor

Duplicate of #16734

@jseyfried
Copy link
Contributor Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants