-
-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Labels
The Language Could Change I GuessA change in the language could always potentially invalidate old codeA change in the language could always potentially invalidate old code
Description
I came across google/zerocopy#388 (comment) by chance. The same applies to this crate:
type S = &'static str;
#[derive(Copy, Clone, Debug, AnyBitPattern)]
#[insert_field(x = "S")]
struct X {
}
fn main() {
let x: &X = bytemuck::cast_ref(&[0usize, 1usize]);
println!("{}", x.x);
}
Segfaults. Solutions might involve generating a function that asserts (by compiling) that the types seen by the proc macro are the same as the types in the final type and that the final type contains no additional fields.
joseluis
Metadata
Metadata
Assignees
Labels
The Language Could Change I GuessA change in the language could always potentially invalidate old codeA change in the language could always potentially invalidate old code