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.
11 // ignore-test FIXME(#50825)
12 #![feature(trivial_bounds)]
14 #![deny(trivial_bounds)]
16 struct A where i32: Copy; //~ ERROR
26 // Check only the bound the user writes trigger the lint
27 fn trivial_elaboration<T>() where T: X<i32> + Z<S = i32>, i32: Y<T> {} // OK
29 fn global_param() where i32: X<()> {} //~ ERROR
31 // Should only error on the trait bound, not the implicit
32 // projection bound <i32 as Z>::S == i32.
33 fn global_projection() where i32: Z<S = i32> {} //~ ERROR
39 // Lifetime bounds should be linted as well
40 fn global_lifetimes() where i32: 'static, &'static str: 'static {}
44 fn local_lifetimes<'a>() where i32: 'a, &'a str: 'a {} // OK
46 fn global_outlives() where 'static: 'static {} //~ ERROR
48 // Check that each bound is checked individually
49 fn mixed_bounds<T: Copy>() where i32: X<T> + Copy {} //~ ERROR