]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsized/unsized-struct.rs
Auto merge of #107618 - chriswailes:linker-arg, r=albertlarsan68
[rust.git] / tests / ui / unsized / unsized-struct.rs
1 fn is_sized<T:Sized>() { }
2 fn not_sized<T: ?Sized>() { }
3
4 struct Foo<T> { data: T }
5 fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
6 fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
7 //~^ ERROR the size for values of type
8 //
9 // Not OK: `T` is not sized.
10
11 struct Bar<T: ?Sized> { data: T }
12 fn bar1<T: ?Sized>() { not_sized::<Bar<T>>() }
13 fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
14 //~^ ERROR the size for values of type
15 //
16 // Not OK: `Bar<T>` is not sized, but it should be.
17
18 fn main() { }