File tree 5 files changed +189
-0
lines changed
5 files changed +189
-0
lines changed Original file line number Diff line number Diff line change
1
+ // check-pass
2
+ #![ feature( generic_const_exprs) ]
3
+ #![ allow( incomplete_features) ]
4
+
5
+ pub trait First {
6
+ const CONST : usize ;
7
+ }
8
+ pub trait Second { }
9
+
10
+ impl < ' a > First for dyn Second
11
+ where
12
+ & ' a Self : First ,
13
+ {
14
+ const CONST : usize = <& Self >:: CONST ;
15
+ }
16
+
17
+ trait Third : First
18
+ where
19
+ [ u8 ; Self :: CONST ] :
20
+ {
21
+ const VAL : [ u8 ; Self :: CONST ] = [ 0 ; Self :: CONST ] ;
22
+ }
23
+
24
+ fn main ( ) { }
Original file line number Diff line number Diff line change 1
1
// build-pass
2
+ // compiler-opts: -Zmir-opt-level=2
3
+
2
4
#![ allow( dead_code) ]
3
5
trait Foo {
4
6
fn foo ( & self ) ;
Original file line number Diff line number Diff line change
1
+ warning: trait bound for<'any> &'any mut (): Clone does not depend on any type or lifetime parameters
2
+ --> $DIR/issue-73021-impossible-inline.rs:20:29
3
+ |
4
+ LL | for<'any> &'any mut (): Clone,
5
+ | ^^^^^
6
+ |
7
+ = note: `#[warn(trivial_bounds)]` on by default
8
+
9
+ warning: trait bound i32: Foo does not depend on any type or lifetime parameters
10
+ --> $DIR/issue-73021-impossible-inline.rs:28:21
11
+ |
12
+ LL | struct S where i32: Foo;
13
+ | ^^^
14
+
15
+ warning: trait bound i32: Foo does not depend on any type or lifetime parameters
16
+ --> $DIR/issue-73021-impossible-inline.rs:31:28
17
+ |
18
+ LL | impl Foo for () where i32: Foo {
19
+ | ^^^
20
+
21
+ warning: trait bound i32: Foo does not depend on any type or lifetime parameters
22
+ --> $DIR/issue-73021-impossible-inline.rs:40:19
23
+ |
24
+ LL | fn f() where i32: Foo {
25
+ | ^^^
26
+
27
+ warning: trait bound &'static str: Foo does not depend on any type or lifetime parameters
28
+ --> $DIR/issue-73021-impossible-inline.rs:48:28
29
+ |
30
+ LL | fn g() where &'static str: Foo {
31
+ | ^^^
32
+
33
+ warning: trait bound String: Neg does not depend on any type or lifetime parameters
34
+ --> $DIR/issue-73021-impossible-inline.rs:57:13
35
+ |
36
+ LL | String: ::std::ops::Neg<Output = String>,
37
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38
+
39
+ warning: trait bound i32: Iterator does not depend on any type or lifetime parameters
40
+ --> $DIR/issue-73021-impossible-inline.rs:65:10
41
+ |
42
+ LL | i32: Iterator,
43
+ | ^^^^^^^^
44
+
45
+ warning: 7 warnings emitted
46
+
Original file line number Diff line number Diff line change
1
+ warning: trait bound for<'any> &'any mut (): Clone does not depend on any type or lifetime parameters
2
+ --> $DIR/issue-73021-impossible-inline.rs:20:29
3
+ |
4
+ LL | for<'any> &'any mut (): Clone,
5
+ | ^^^^^
6
+ |
7
+ = note: `#[warn(trivial_bounds)]` on by default
8
+
9
+ warning: trait bound i32: Foo does not depend on any type or lifetime parameters
10
+ --> $DIR/issue-73021-impossible-inline.rs:28:21
11
+ |
12
+ LL | struct S where i32: Foo;
13
+ | ^^^
14
+
15
+ warning: trait bound i32: Foo does not depend on any type or lifetime parameters
16
+ --> $DIR/issue-73021-impossible-inline.rs:31:28
17
+ |
18
+ LL | impl Foo for () where i32: Foo {
19
+ | ^^^
20
+
21
+ warning: trait bound i32: Foo does not depend on any type or lifetime parameters
22
+ --> $DIR/issue-73021-impossible-inline.rs:40:19
23
+ |
24
+ LL | fn f() where i32: Foo {
25
+ | ^^^
26
+
27
+ warning: trait bound &'static str: Foo does not depend on any type or lifetime parameters
28
+ --> $DIR/issue-73021-impossible-inline.rs:48:28
29
+ |
30
+ LL | fn g() where &'static str: Foo {
31
+ | ^^^
32
+
33
+ warning: trait bound String: Neg does not depend on any type or lifetime parameters
34
+ --> $DIR/issue-73021-impossible-inline.rs:57:13
35
+ |
36
+ LL | String: ::std::ops::Neg<Output = String>,
37
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38
+
39
+ warning: trait bound i32: Iterator does not depend on any type or lifetime parameters
40
+ --> $DIR/issue-73021-impossible-inline.rs:65:10
41
+ |
42
+ LL | i32: Iterator,
43
+ | ^^^^^^^^
44
+
45
+ warning: 7 warnings emitted
46
+
Original file line number Diff line number Diff line change
1
+ // build-pass
2
+ // revisions: no-opt inline
3
+ // [inline]compile-flags: -Zmir-opt-level=3 --emit=mir
4
+ #![ feature( trivial_bounds) ]
5
+ #![ allow( unused) ]
6
+
7
+ trait Foo {
8
+ fn test ( & self ) ;
9
+ }
10
+
11
+ fn foo < ' a > ( s : & ' a mut ( ) )
12
+ where
13
+ & ' a mut ( ) : Foo ,
14
+ {
15
+ s. test ( ) ;
16
+ }
17
+
18
+ fn clone ( it : & mut ( ) ) -> & mut ( )
19
+ where
20
+ for < ' any > & ' any mut ( ) : Clone ,
21
+ //~^ WARN trait bound for<'any> &'any mut (): Clone does not depend on any type or lifetime parameters
22
+ {
23
+ it. clone ( )
24
+ }
25
+
26
+ fn generic_function < X : Foo > ( x : X ) { }
27
+
28
+ struct S where i32 : Foo ;
29
+ //~^ WARN trait bound i32: Foo does not depend on any type or lifetime parameters
30
+
31
+ impl Foo for ( ) where i32 : Foo {
32
+ //~^ WARN trait bound i32: Foo does not depend on any type or lifetime parameters
33
+ fn test ( & self ) {
34
+ 3i32 . test ( ) ;
35
+ Foo :: test ( & 4i32 ) ;
36
+ generic_function ( 5i32 ) ;
37
+ }
38
+ }
39
+
40
+ fn f ( ) where i32 : Foo {
41
+ //~^ WARN trait bound i32: Foo does not depend on any type or lifetime parameters
42
+ let s = S ;
43
+ 3i32 . test ( ) ;
44
+ Foo :: test ( & 4i32 ) ;
45
+ generic_function ( 5i32 ) ;
46
+ }
47
+
48
+ fn g ( ) where & ' static str : Foo {
49
+ //~^ WARN trait bound &'static str: Foo does not depend on any type or lifetime parameters
50
+ "Foo" . test ( ) ;
51
+ Foo :: test ( & "Foo" ) ;
52
+ generic_function ( "Foo" ) ;
53
+ }
54
+
55
+ fn use_op ( s : String ) -> String
56
+ where
57
+ String : :: std:: ops:: Neg < Output = String > ,
58
+ //~^ WARN trait bound String: Neg does not depend on any type or lifetime parameters
59
+ {
60
+ -s
61
+ }
62
+
63
+ fn use_for ( )
64
+ where
65
+ i32 : Iterator ,
66
+ //~^ WARN trait bound i32: Iterator does not depend on any type or lifetime parameters
67
+ {
68
+ for _ in 2i32 { }
69
+ }
70
+
71
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments