rust/tests/ui/unsized/unsized5.rs

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

35 lines
628 B
Rust
Raw Normal View History

// Test `?Sized` types not allowed in fields (except the last one).
2015-01-05 21:16:49 +00:00
struct S1<X: ?Sized> {
f1: X,
2018-07-10 21:10:13 +00:00
//~^ ERROR the size for values of type
f2: isize,
}
2015-01-05 21:16:49 +00:00
struct S2<X: ?Sized> {
f: isize,
g: X,
2018-07-10 21:10:13 +00:00
//~^ ERROR the size for values of type
h: isize,
}
struct S3 {
f: str,
2018-07-10 21:10:13 +00:00
//~^ ERROR the size for values of type
g: [usize]
}
struct S4 {
f: [u8],
2018-07-10 21:10:13 +00:00
//~^ ERROR the size for values of type
g: usize
}
2015-01-05 21:16:49 +00:00
enum E<X: ?Sized> {
V1(X, isize),
2018-07-10 21:10:13 +00:00
//~^ ERROR the size for values of type
}
2015-01-05 21:16:49 +00:00
enum F<X: ?Sized> {
V2{f1: X, f: isize},
2018-07-10 21:10:13 +00:00
//~^ ERROR the size for values of type
}
pub fn main() {
}