]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type/type-check-defaults.rs
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / type / type-check-defaults.rs
1 // Copyright 2017 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::iter::FromIterator;
12 use std::vec::IntoIter;
13 use std::ops::Add;
14
15 struct Foo<T, U: FromIterator<T>>(T, U);
16 struct WellFormed<Z = Foo<i32, i32>>(Z);
17 //~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32`
18 struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z);
19 //~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32`
20
21 struct Bounds<T:Copy=String>(T);
22 //~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277]
23
24 struct WhereClause<T=String>(T) where T: Copy;
25 //~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277]
26
27 trait TraitBound<T:Copy=String> {}
28 //~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277]
29
30 trait Super<T: Copy> { }
31 trait Base<T = String>: Super<T> { }
32 //~^ ERROR the trait bound `T: std::marker::Copy` is not satisfied [E0277]
33
34 trait ProjectionPred<T:Iterator = IntoIter<i32>> where T::Item : Add<u8> {}
35 //~^ ERROR cannot add `u8` to `i32` [E0277]
36
37 fn main() { }