]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/associated-types/bound-lifetime-in-binding-only.rs
1 // revisions: angle paren ok elision
4 #![feature(rustc_attrs)]
5 #![feature(unboxed_closures)]
12 fn angle
<T
: for<'a
> Foo
<Item
=&'a
i32>>() {
13 //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
17 fn angle1
<T
>() where T
: for<'a
> Foo
<Item
=&'a
i32> {
18 //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
22 fn angle2
<T
>() where for<'a
> T
: Foo
<Item
=&'a
i32> {
23 //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
27 fn angle3(_
: &dyn for<'a
> Foo
<Item
=&'a
i32>) {
28 //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
32 fn paren
<T
: for<'a
> Fn() -> &'a
i32>() {
33 //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
37 fn paren1
<T
>() where T
: for<'a
> Fn() -> &'a
i32 {
38 //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
42 fn paren2
<T
>() where for<'a
> T
: Fn() -> &'a
i32 {
43 //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
47 fn paren3(_
: &dyn for<'a
> Fn() -> &'a
i32) {
48 //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
52 fn elision
<T
: Fn() -> &i32>() {
53 //[elision]~^ ERROR E0106
56 struct Parameterized
<'a
> { x: &'a str }
59 fn ok1
<T
: for<'a
> Fn(&Parameterized
<'a
>) -> &'a
i32>() {
63 fn ok2
<T
: for<'a
,'b
> Fn
<(&'b Parameterized
<'a
>,), Output
=&'a
i32>>() {
67 fn ok3
<T
>() where for<'a
> Parameterized
<'a
>: Foo
<Item
=&'a
i32> {
71 fn main() { }
//[ok]~ ERROR fatal error triggered by #[rustc_error]