8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- // must-compile-successfully
12
11
#![ allow( dead_code, non_camel_case_types) ]
13
12
14
13
use std:: rc:: Rc ;
15
14
16
15
type SVec < T : Send +Send > = Vec < T > ;
17
- //~^ WARN bounds on generic type parameters are ignored in type aliases
16
+ //~^ WARN bounds on generic parameters are ignored in type aliases
18
17
type VVec < ' b , ' a : ' b +' b > = Vec < & ' a i32 > ;
19
- //~^ WARN bounds on generic lifetime parameters are ignored in type aliases
18
+ //~^ WARN bounds on generic parameters are ignored in type aliases
20
19
type WVec < ' b , T : ' b +' b > = Vec < T > ;
21
- //~^ WARN bounds on generic type parameters are ignored in type aliases
20
+ //~^ WARN bounds on generic parameters are ignored in type aliases
22
21
type W2Vec < ' b , T > where T : ' b , T : ' b = Vec < T > ;
23
22
//~^ WARN where clauses are ignored in type aliases
24
23
@@ -40,16 +39,16 @@ fn foo<'a>(y: &'a i32) {
40
39
fn bar1 < ' a , ' b > (
41
40
x : & ' a i32 ,
42
41
y : & ' b i32 ,
43
- f : for <' xa , ' xb : ' xa> fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32 )
44
- //~^ WARN bounds on generic lifetime parameters are ignored in higher-ranked function types
42
+ f : for <' xa , ' xb : ' xa+ ' xa > fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32 )
43
+ //~^ ERROR lifetime bounds cannot be used in this context
45
44
{
46
45
// If the bound in f's type would matter, the call below would (have to)
47
46
// be rejected.
48
47
f ( x, y) ;
49
48
}
50
49
51
50
fn bar2 < ' a , ' b , F : for < ' xa , ' xb : ' xa > Fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32 > (
52
- //~^ WARN bounds on generic lifetime parameters are ignored in higher-ranked trait bounds
51
+ //~^ ERROR lifetime bounds cannot be used in this context
53
52
x : & ' a i32 ,
54
53
y : & ' b i32 ,
55
54
f : F )
@@ -64,7 +63,7 @@ fn bar3<'a, 'b, F>(
64
63
y : & ' b i32 ,
65
64
f : F )
66
65
where F : for < ' xa , ' xb : ' xa > Fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32
67
- //~^ WARN bounds on generic lifetime parameters are ignored in higher-ranked trait bounds
66
+ //~^ ERROR lifetime bounds cannot be used in this context
68
67
{
69
68
// If the bound in f's type would matter, the call below would (have to)
70
69
// be rejected.
@@ -76,29 +75,29 @@ fn bar4<'a, 'b, F>(
76
75
y : & ' b i32 ,
77
76
f : F )
78
77
where for < ' xa , ' xb : ' xa > F : Fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32
79
- //~^ WARN bounds on generic lifetime parameters are ignored in higher-ranked trait bounds
78
+ //~^ ERROR lifetime bounds cannot be used in this context
80
79
{
81
80
// If the bound in f's type would matter, the call below would (have to)
82
81
// be rejected.
83
82
f ( x, y) ;
84
83
}
85
84
86
85
struct S1 < F : for < ' xa , ' xb : ' xa > Fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32 > ( F ) ;
87
- //~^ WARN bounds on generic lifetime parameters are ignored in higher-ranked trait bounds
86
+ //~^ ERROR lifetime bounds cannot be used in this context
88
87
struct S2 < F > ( F ) where F : for < ' xa , ' xb : ' xa > Fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32 ;
89
- //~^ WARN bounds on generic lifetime parameters are ignored in higher-ranked trait bounds
88
+ //~^ ERROR lifetime bounds cannot be used in this context
90
89
struct S3 < F > ( F ) where for < ' xa , ' xb : ' xa > F : Fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32 ;
91
- //~^ WARN bounds on generic lifetime parameters are ignored in higher-ranked trait bounds
90
+ //~^ ERROR lifetime bounds cannot be used in this context
92
91
93
92
struct S_fnty ( for <' xa , ' xb : ' xa> fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32 ) ;
94
- //~^ WARN bounds on generic lifetime parameters are ignored in higher-ranked function types
93
+ //~^ ERROR lifetime bounds cannot be used in this context
95
94
96
95
type T1 = Box < for <' xa , ' xb : ' xa> Fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32 > ;
97
- //~^ WARN bounds on generic lifetime parameters are ignored in higher-ranked trait bounds
96
+ //~^ ERROR lifetime bounds cannot be used in this context
98
97
99
98
fn main ( ) {
100
99
let _ : Option < for <' xa , ' xb : ' xa> fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32 > = None ;
101
- //~^ WARN bounds on generic lifetime parameters are ignored in higher-ranked function types
100
+ //~^ ERROR lifetime bounds cannot be used in this context
102
101
let _ : Option < Box < for <' xa , ' xb : ' xa> Fn ( & ' xa i32 , & ' xb i32 ) -> & ' xa i32 > > = None ;
103
- //~^ WARN bounds on generic lifetime parameters are ignored in higher-ranked trait bounds
102
+ //~^ ERROR lifetime bounds cannot be used in this context
104
103
}
0 commit comments