3 // Check that tautalogically false bounds are accepted, and are used
5 #![feature(trivial_bounds)]
12 fn generic_function<X: Foo>(x: X) {}
14 enum E where i32: Foo { V } //~ WARNING trivial_bounds
16 struct S where i32: Foo; //~ WARNING trivial_bounds
18 trait T where i32: Foo {} //~ WARNING trivial_bounds
20 union U where i32: Foo { f: i32 } //~ WARNING trivial_bounds
22 type Y where i32: Foo = ();
23 //~^ WARNING type_alias_bounds
24 //~| WARNING trivial_bounds
26 impl Foo for () where i32: Foo { //~ WARNING trivial_bounds
30 generic_function(5i32);
34 fn f() where i32: Foo { //~ WARNING trivial_bounds
38 generic_function(5i32);
41 fn g() where &'static str: Foo { //~ WARNING trivial_bounds
44 generic_function("Foo");
51 struct Dst<X: ?Sized> {
55 struct TwoStrs(str, str) where str: Sized; //~ WARNING trivial_bounds
57 fn unsized_local() where for<'a> Dst<dyn A + 'a>: Sized { //~ WARNING trivial_bounds
58 let x: Dst<dyn A> = *(Box::new(Dst { x: 1 }) as Box<Dst<dyn A>>);
61 fn return_str() -> str where str: Sized { //~ WARNING trivial_bounds
62 *"Sized".to_string().into_boxed_str()
65 fn use_op(s: String) -> String where String: ::std::ops::Neg<Output=String> {
66 //~^ WARNING trivial_bounds
70 fn use_for() where i32: Iterator { //~ WARNING trivial_bounds