]> git.lizzy.rs Git - rust.git/blob - src/test/ui/maybe-bounds-where.rs
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / maybe-bounds-where.rs
1 // Copyright 2016 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 struct S1<T>(T) where (T): ?Sized;
12 //~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
13
14 struct S2<T>(T) where u8: ?Sized;
15 //~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
16
17 struct S3<T>(T) where &'static T: ?Sized;
18 //~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
19
20 trait Trait<'a> {}
21
22 struct S4<T>(T) where for<'a> T: ?Trait<'a>;
23 //~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
24
25 struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
26 //~^ ERROR type parameter has more than one relaxed default bound
27 //~| WARN default bound relaxed for a type parameter
28
29 impl<T> S1<T> {
30     fn f() where T: ?Sized {}
31     //~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
32 }
33
34 fn main() {
35     let u = vec![1, 2, 3];
36     let _s: S5<[u8]> = S5(&u[..]); // OK
37 }