1 // Copyright 2018 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.
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.
13 // Check that tautalogically false bounds are accepted, and are used
15 #![feature(trivial_bounds)]
22 fn generic_function<X: Foo>(x: X) {}
24 enum E where i32: Foo { V }
26 struct S where i32: Foo;
28 trait T where i32: Foo {}
30 union U where i32: Foo { f: i32 }
32 type Y where i32: Foo = ();
34 impl Foo for () where i32: Foo {
38 generic_function(5i32);
42 fn f() where i32: Foo {
46 generic_function(5i32);
49 fn g() where &'static str: Foo {
52 generic_function("Foo");
59 struct Dst<X: ?Sized> {
63 struct TwoStrs(str, str) where str: Sized;
65 fn unsized_local() where for<'a> Dst<A + 'a>: Sized {
66 let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
69 fn return_str() -> str where str: Sized {
70 *"Sized".to_string().into_boxed_str()
73 fn use_op(s: String) -> String where String: ::std::ops::Neg<Output=String> {
77 fn use_for() where i32: Iterator {