Skip to content

More pub use related link errors #9968

Closed
@SiegeLord

Description

@SiegeLord

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions