Skip to content

static variable + debuginfo causes link error #13258

Closed
@klutzy

Description

@klutzy

a.rs:

#![crate_type = "lib"]

pub use private::P;

pub struct S {
    p: P,
}

mod private { // `pub mod` solves problem
    pub struct P {
        p: i32,
    }
    pub static THREE: P = P { p: 3 };
}

pub static A: S = S { p: private::THREE };

b.rs:

extern crate a;

fn main() {
    let B: a::S = a::A;
}

Building b.rs with --debuginfo=1 causes link error:

note: b.o:(.debug_info+0xb3): undefined reference to `private::THREE::ha5edf056fc0d59b6oaa::v0.0'

I have no idea if this is sub-bug of #11685 or not: is it illegal to use private::THREE in pub static A?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions