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

More pub use related link errors #9968

Closed
SiegeLord opened this issue Oct 20, 2013 · 1 comment
Closed

More pub use related link errors #9968

SiegeLord opened this issue Oct 20, 2013 · 1 comment
Labels
A-linkage Area: linking into static, shared libraries and binaries I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@SiegeLord
Copy link
Contributor

I found two more cases when a pub use of a private item results in link-time errors.

lib.rs

pub use internal::core::{Trait, Struct};

mod internal
{
    pub mod core
    {
        pub struct Struct;
        impl Struct
        {
            pub fn init() -> Struct
            {
                Struct
            }
        }

        pub trait Trait
        {
            fn test(&self)
            {
                private();
            }
        }

        impl Trait for Struct {}

        fn private()
        {
        }
    }
}

test.rs

extern mod lib;

use lib::{Trait, Struct};

fn main()
{
    Struct::init().test();
}

commands:

rustc --lib lib.rs
rustc test.rs -L.

Current output:

test.rc:(.text+0x3d): undefined reference to `internal::core::Struct::init::h168b469d58ae6141v5a1::v0.0'
test.o: In function `internal::core::Trait::test::h265f5d5a4f11b6da2::v0.0':
test.rc:(.text+0xf5): undefined reference to `internal::core::private::he344781a19bc4532aJ::v0.0'
@alexcrichton
Copy link
Member

This is another case of reachability not propagating public-ness through the re-exported traits. This may be something that middle::privacy needs to take into account. I will think about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

2 participants