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.
12 #![allow(type_alias_bounds)]
18 fn generic_function<X: Foo>(x: X) {}
20 enum E where i32: Foo { V } //~ ERROR
22 struct S where i32: Foo; //~ ERROR
24 trait T where i32: Foo {} //~ ERROR
26 union U where i32: Foo { f: i32 } //~ ERROR
28 type Y where i32: Foo = (); // OK - bound is ignored
30 impl Foo for () where i32: Foo { //~ ERROR
31 fn test(&self) { //~ ERROR
34 generic_function(5i32);
38 fn f() where i32: Foo //~ ERROR
43 generic_function(5i32);
46 fn use_op(s: String) -> String where String: ::std::ops::Neg<Output=String> { //~ ERROR
50 fn use_for() where i32: Iterator { //~ ERROR
58 struct Dst<X: ?Sized> {
62 struct TwoStrs(str, str) where str: Sized; //~ ERROR
65 fn unsized_local() where Dst<A>: Sized { //~ ERROR
66 let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
69 fn return_str() -> str where str: Sized { //~ ERROR
70 *"Sized".to_string().into_boxed_str()
73 // This is currently accepted because the function pointer isn't
75 fn global_hr(x: fn(&())) where fn(&()): Foo { // OK