Closed
Description
Whether or not a struct is const is forgotten across crate boundaries. The compiler should reject this program:
const.rs:
use nonconst;
import nonconst::nonconst;
fn x<T: const>(_x: T) { }
fn main() { x(nonconst()) }
nonconst.rc:
#[crate_type = "lib"];
nonconst.rs:
struct nonconst { mut z: (); }
fn nonconst() -> nonconst { nonconst { mut z: () } }
If you change the type nonconst
to be e.g. an old-style record type, the program is correctly rejected.