Skip to content

Commit db03257

Browse files
committed
add new test case
1 parent d22f706 commit db03257

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright 206 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use std::ops::Deref;
12+
13+
// Due to aggressive error message deduplication, we require 20 *different*
14+
// unsized types (even Path and [u8] are considered the "same").
15+
16+
trait Foo {}
17+
trait Bar {}
18+
trait FooBar {}
19+
trait BarFoo {}
20+
21+
trait PathHelper1 {}
22+
trait PathHelper2 {}
23+
trait PathHelper3 {}
24+
trait PathHelper4 {}
25+
26+
struct Path1(PathHelper1);
27+
struct Path2(PathHelper2);
28+
struct Path3(PathHelper3);
29+
struct Path4(PathHelper4);
30+
31+
enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> {
32+
// parameter
33+
VA(W), //~ ERROR `W: std::marker::Sized` is not satisfied
34+
VB{x: X}, //~ ERROR `X: std::marker::Sized` is not satisfied
35+
VC(isize, Y), //~ ERROR `Y: std::marker::Sized` is not satisfied
36+
VD{u: isize, x: Z}, //~ ERROR `Z: std::marker::Sized` is not satisfied
37+
38+
// slice / str
39+
VE([u8]), //~ ERROR `[u8]: std::marker::Sized` is not satisfied
40+
VF{x: str}, //~ ERROR `str: std::marker::Sized` is not satisfied
41+
VG(isize, [f32]), //~ ERROR `[f32]: std::marker::Sized` is not satisfied
42+
VH{u: isize, x: [u32]}, //~ ERROR `[u32]: std::marker::Sized` is not satisfied
43+
44+
// unsized struct
45+
VI(Path1), //~ ERROR `PathHelper1 + 'static: std::marker::Sized` is not satisfied
46+
VJ{x: Path2}, //~ ERROR `PathHelper2 + 'static: std::marker::Sized` is not satisfied
47+
VK(isize, Path3), //~ ERROR `PathHelper3 + 'static: std::marker::Sized` is not satisfied
48+
VL{u: isize, x: Path4}, //~ ERROR `PathHelper4 + 'static: std::marker::Sized` is not satisfied
49+
50+
// plain trait
51+
VM(Foo), //~ ERROR `Foo + 'static: std::marker::Sized` is not satisfied
52+
VN{x: Bar}, //~ ERROR `Bar + 'static: std::marker::Sized` is not satisfied
53+
VO(isize, FooBar), //~ ERROR `FooBar + 'static: std::marker::Sized` is not satisfied
54+
VP{u: isize, x: BarFoo}, //~ ERROR `BarFoo + 'static: std::marker::Sized` is not satisfied
55+
56+
// projected
57+
VQ(<&'static [i8] as Deref>::Target), //~ ERROR `[i8]: std::marker::Sized` is not satisfied
58+
VR{x: <&'static [char] as Deref>::Target},
59+
//~^ ERROR `[char]: std::marker::Sized` is not satisfied
60+
VS(isize, <&'static [f64] as Deref>::Target),
61+
//~^ ERROR `[f64]: std::marker::Sized` is not satisfied
62+
VT{u: isize, x: <&'static [i32] as Deref>::Target},
63+
//~^ ERROR `[i32]: std::marker::Sized` is not satisfied
64+
}
65+
66+
67+
fn main() { }
68+

0 commit comments

Comments
 (0)