Skip to content

More pub use related link errors #9968

Closed

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'

Activity

  1. alexcrichton commented on Oct 20, 2013

    @alexcrichton
    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.

  2. added a commit that references this issue on Oct 21, 2013
    a25bbcc
  3. added a commit that references this issue on Aug 21, 2026
    337ccc7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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