rust/tests/ui/unsized/unchanged-param.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
411 B
Rust
Raw Normal View History

2021-01-05 09:33:10 -06:00
// run-pass
// Test that we allow unsizing even if there is an unchanged param in the
// field getting unsized.
2022-07-25 15:36:03 -05:00
struct A<T, U: ?Sized + 'static>(#[allow(unused_tuple_struct_fields)] T, B<T, U>);
struct B<T, U: ?Sized>(#[allow(unused_tuple_struct_fields)] T, U);
2021-01-05 09:33:10 -06:00
fn main() {
let x: A<[u32; 1], [u32; 1]> = A([0; 1], B([0; 1], [0; 1]));
let y: &A<[u32; 1], [u32]> = &x;
assert_eq!(y.1.1.len(), 1);
}