rust/tests/ui/unsized/unsized-enum2.rs

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

75 lines
1.9 KiB
Rust
Raw Normal View History

2016-10-24 14:40:43 -05:00
use std::ops::Deref;
// Due to aggressive error message deduplication, we require 20 *different*
// unsized types (even Path and [u8] are considered the "same").
trait Foo {}
trait Bar {}
trait FooBar {}
trait BarFoo {}
trait PathHelper1 {}
trait PathHelper2 {}
trait PathHelper3 {}
trait PathHelper4 {}
2019-05-28 13:46:13 -05:00
struct Path1(dyn PathHelper1);
struct Path2(dyn PathHelper2);
struct Path3(dyn PathHelper3);
struct Path4(dyn PathHelper4);
2016-10-24 14:40:43 -05:00
enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> {
// parameter
VA(W),
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
VB{x: X},
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
VC(isize, Y),
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
VD{u: isize, x: Z},
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2016-10-24 14:40:43 -05:00
// slice / str
VE([u8]),
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
VF{x: str},
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
VG(isize, [f32]),
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
VH{u: isize, x: [u32]},
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2016-10-24 14:40:43 -05:00
// unsized struct
VI(Path1),
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
VJ{x: Path2},
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
VK(isize, Path3),
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
VL{u: isize, x: Path4},
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2016-10-24 14:40:43 -05:00
// plain trait
2019-05-28 13:46:13 -05:00
VM(dyn Foo),
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2019-05-28 13:46:13 -05:00
VN{x: dyn Bar},
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2019-05-28 13:46:13 -05:00
VO(isize, dyn FooBar),
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2019-05-28 13:46:13 -05:00
VP{u: isize, x: dyn BarFoo},
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2016-10-24 14:40:43 -05:00
// projected
VQ(<&'static [i8] as Deref>::Target),
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2016-10-24 14:40:43 -05:00
VR{x: <&'static [char] as Deref>::Target},
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2016-10-24 14:40:43 -05:00
VS(isize, <&'static [f64] as Deref>::Target),
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2016-10-24 14:40:43 -05:00
VT{u: isize, x: <&'static [i32] as Deref>::Target},
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2016-10-24 14:40:43 -05:00
}
fn main() { }