File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ trait Trait { }
2
+ impl Trait for ( ) { }
3
+
4
+ fn foo < T : Trait , U : Trait > ( ) -> impl Trait {
5
+ //~^ WARN function cannot return without recursing [unconditional_recursion]
6
+ let a: T = foo :: < T , U > ( ) ;
7
+ //~^ ERROR concrete type differs from previous defining opaque type use
8
+ loop { }
9
+ let _: T = foo :: < U , T > ( ) ;
10
+ }
11
+
12
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ warning: function cannot return without recursing
2
+ --> $DIR/multiple-defining-usages-in-body.rs:4:1
3
+ |
4
+ LL | fn foo<T: Trait, U: Trait>() -> impl Trait {
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
6
+ LL |
7
+ LL | let a: T = foo::<T, U>();
8
+ | ------------- recursive call site
9
+ |
10
+ = help: a `loop` may express intention better if this is on purpose
11
+ = note: `#[warn(unconditional_recursion)]` on by default
12
+
13
+ error: concrete type differs from previous defining opaque type use
14
+ --> $DIR/multiple-defining-usages-in-body.rs:6:16
15
+ |
16
+ LL | let a: T = foo::<T, U>();
17
+ | ^^^^^^^^^^^^^ expected `U`, got `T`
18
+ |
19
+ note: previous use here
20
+ --> $DIR/multiple-defining-usages-in-body.rs:9:16
21
+ |
22
+ LL | let _: T = foo::<U, T>();
23
+ | ^^^^^^^^^^^^^
24
+
25
+ error: aborting due to previous error; 1 warning emitted
26
+
You can’t perform that action at this time.
0 commit comments