]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unsized/param-mentioned-by-different-field.rs
Rollup merge of #98665 - ChrisDenton:deprecated-suggestion, r=compiler-errors
[rust.git] / src / test / ui / unsized / param-mentioned-by-different-field.rs
1 // We must not allow this with our current setup as `T`
2 // is mentioned both in the tail of `Foo` and by another
3 // field.
4 struct Foo<T: ?Sized>(Box<T>, T);
5
6 fn main() {
7     let x: Foo<[u8; 1]> = Foo(Box::new([2]), [3]);
8     let y: &Foo<[u8]> = &x; //~ ERROR mismatched types
9     assert_eq!(y.0.len(), 1);
10 }