Skip to content

Commit a79925d

Browse files
authored
Rollup merge of #109193 - spastorino:new-rpitit-11, r=compiler-errors
Add revisions for -Zlower-impl-trait-in-trait-to-assoc-ty fixed tests Needs to go on top of #109198 r? ``@compiler-errors``
2 parents 7ebf2cd + e0302bb commit a79925d

20 files changed

+339
-20
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
error[E0706]: functions in traits cannot be declared `async`
2+
--> $DIR/async-trait-fn.rs:6:5
3+
|
4+
LL | async fn foo() {}
5+
| -----^^^^^^^^^
6+
| |
7+
| `async` because of this
8+
|
9+
= note: `async` trait functions are not currently supported
10+
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
11+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
12+
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
13+
14+
error[E0706]: functions in traits cannot be declared `async`
15+
--> $DIR/async-trait-fn.rs:7:5
16+
|
17+
LL | async fn bar(&self) {}
18+
| -----^^^^^^^^^^^^^^
19+
| |
20+
| `async` because of this
21+
|
22+
= note: `async` trait functions are not currently supported
23+
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
24+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
25+
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
26+
27+
error[E0706]: functions in traits cannot be declared `async`
28+
--> $DIR/async-trait-fn.rs:8:5
29+
|
30+
LL | async fn baz() {
31+
| -----^^^^^^^^^
32+
| |
33+
| `async` because of this
34+
|
35+
= note: `async` trait functions are not currently supported
36+
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
37+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
38+
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
39+
40+
error: aborting due to 3 previous errors
41+
42+
For more information about this error, try `rustc --explain E0706`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
error[E0706]: functions in traits cannot be declared `async`
2+
--> $DIR/async-trait-fn.rs:6:5
3+
|
4+
LL | async fn foo() {}
5+
| -----^^^^^^^^^
6+
| |
7+
| `async` because of this
8+
|
9+
= note: `async` trait functions are not currently supported
10+
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
11+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
12+
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
13+
14+
error[E0706]: functions in traits cannot be declared `async`
15+
--> $DIR/async-trait-fn.rs:7:5
16+
|
17+
LL | async fn bar(&self) {}
18+
| -----^^^^^^^^^^^^^^
19+
| |
20+
| `async` because of this
21+
|
22+
= note: `async` trait functions are not currently supported
23+
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
24+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
25+
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
26+
27+
error[E0706]: functions in traits cannot be declared `async`
28+
--> $DIR/async-trait-fn.rs:8:5
29+
|
30+
LL | async fn baz() {
31+
| -----^^^^^^^^^
32+
| |
33+
| `async` because of this
34+
|
35+
= note: `async` trait functions are not currently supported
36+
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
37+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
38+
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
39+
40+
error: aborting due to 3 previous errors
41+
42+
For more information about this error, try `rustc --explain E0706`.

tests/ui/async-await/async-trait-fn.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// edition:2018
2+
23
trait T {
34
async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
45
async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async`

tests/ui/async-await/async-trait-fn.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0706]: functions in traits cannot be declared `async`
2-
--> $DIR/async-trait-fn.rs:3:5
2+
--> $DIR/async-trait-fn.rs:4:5
33
|
44
LL | async fn foo() {}
55
| -----^^^^^^^^^
@@ -12,7 +12,7 @@ LL | async fn foo() {}
1212
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
1313

1414
error[E0706]: functions in traits cannot be declared `async`
15-
--> $DIR/async-trait-fn.rs:4:5
15+
--> $DIR/async-trait-fn.rs:5:5
1616
|
1717
LL | async fn bar(&self) {}
1818
| -----^^^^^^^^^^^^^^
@@ -25,7 +25,7 @@ LL | async fn bar(&self) {}
2525
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
2626

2727
error[E0706]: functions in traits cannot be declared `async`
28-
--> $DIR/async-trait-fn.rs:5:5
28+
--> $DIR/async-trait-fn.rs:6:5
2929
|
3030
LL | async fn baz() {
3131
| -----^^^^^^^^^

tests/ui/async-await/edition-deny-async-fns-2015.stderr renamed to tests/ui/async-await/edition-deny-async-fns-2015.current.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0670]: `async fn` is not permitted in Rust 2015
2-
--> $DIR/edition-deny-async-fns-2015.rs:3:1
2+
--> $DIR/edition-deny-async-fns-2015.rs:5:1
33
|
44
LL | async fn foo() {}
55
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -8,7 +8,7 @@ LL | async fn foo() {}
88
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
99

1010
error[E0670]: `async fn` is not permitted in Rust 2015
11-
--> $DIR/edition-deny-async-fns-2015.rs:5:12
11+
--> $DIR/edition-deny-async-fns-2015.rs:7:12
1212
|
1313
LL | fn baz() { async fn foo() {} }
1414
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -17,7 +17,7 @@ LL | fn baz() { async fn foo() {} }
1717
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
1818

1919
error[E0670]: `async fn` is not permitted in Rust 2015
20-
--> $DIR/edition-deny-async-fns-2015.rs:7:1
20+
--> $DIR/edition-deny-async-fns-2015.rs:9:1
2121
|
2222
LL | async fn async_baz() {
2323
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -26,7 +26,7 @@ LL | async fn async_baz() {
2626
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
2727

2828
error[E0670]: `async fn` is not permitted in Rust 2015
29-
--> $DIR/edition-deny-async-fns-2015.rs:8:5
29+
--> $DIR/edition-deny-async-fns-2015.rs:10:5
3030
|
3131
LL | async fn bar() {}
3232
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -35,7 +35,7 @@ LL | async fn bar() {}
3535
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
3636

3737
error[E0670]: `async fn` is not permitted in Rust 2015
38-
--> $DIR/edition-deny-async-fns-2015.rs:14:5
38+
--> $DIR/edition-deny-async-fns-2015.rs:16:5
3939
|
4040
LL | async fn foo() {}
4141
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -44,7 +44,7 @@ LL | async fn foo() {}
4444
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
4545

4646
error[E0670]: `async fn` is not permitted in Rust 2015
47-
--> $DIR/edition-deny-async-fns-2015.rs:18:5
47+
--> $DIR/edition-deny-async-fns-2015.rs:20:5
4848
|
4949
LL | async fn foo() {}
5050
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -53,7 +53,7 @@ LL | async fn foo() {}
5353
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
5454

5555
error[E0670]: `async fn` is not permitted in Rust 2015
56-
--> $DIR/edition-deny-async-fns-2015.rs:36:9
56+
--> $DIR/edition-deny-async-fns-2015.rs:38:9
5757
|
5858
LL | async fn bar() {}
5959
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -62,7 +62,7 @@ LL | async fn bar() {}
6262
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
6363

6464
error[E0670]: `async fn` is not permitted in Rust 2015
65-
--> $DIR/edition-deny-async-fns-2015.rs:26:9
65+
--> $DIR/edition-deny-async-fns-2015.rs:28:9
6666
|
6767
LL | async fn foo() {}
6868
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -71,7 +71,7 @@ LL | async fn foo() {}
7171
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
7272

7373
error[E0670]: `async fn` is not permitted in Rust 2015
74-
--> $DIR/edition-deny-async-fns-2015.rs:31:13
74+
--> $DIR/edition-deny-async-fns-2015.rs:33:13
7575
|
7676
LL | async fn bar() {}
7777
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -80,7 +80,7 @@ LL | async fn bar() {}
8080
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
8181

8282
error[E0706]: functions in traits cannot be declared `async`
83-
--> $DIR/edition-deny-async-fns-2015.rs:18:5
83+
--> $DIR/edition-deny-async-fns-2015.rs:20:5
8484
|
8585
LL | async fn foo() {}
8686
| -----^^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
error[E0670]: `async fn` is not permitted in Rust 2015
2+
--> $DIR/edition-deny-async-fns-2015.rs:5:1
3+
|
4+
LL | async fn foo() {}
5+
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
6+
|
7+
= help: pass `--edition 2021` to `rustc`
8+
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
9+
10+
error[E0670]: `async fn` is not permitted in Rust 2015
11+
--> $DIR/edition-deny-async-fns-2015.rs:7:12
12+
|
13+
LL | fn baz() { async fn foo() {} }
14+
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
15+
|
16+
= help: pass `--edition 2021` to `rustc`
17+
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
18+
19+
error[E0670]: `async fn` is not permitted in Rust 2015
20+
--> $DIR/edition-deny-async-fns-2015.rs:9:1
21+
|
22+
LL | async fn async_baz() {
23+
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
24+
|
25+
= help: pass `--edition 2021` to `rustc`
26+
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
27+
28+
error[E0670]: `async fn` is not permitted in Rust 2015
29+
--> $DIR/edition-deny-async-fns-2015.rs:10:5
30+
|
31+
LL | async fn bar() {}
32+
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
33+
|
34+
= help: pass `--edition 2021` to `rustc`
35+
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
36+
37+
error[E0670]: `async fn` is not permitted in Rust 2015
38+
--> $DIR/edition-deny-async-fns-2015.rs:16:5
39+
|
40+
LL | async fn foo() {}
41+
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
42+
|
43+
= help: pass `--edition 2021` to `rustc`
44+
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
45+
46+
error[E0670]: `async fn` is not permitted in Rust 2015
47+
--> $DIR/edition-deny-async-fns-2015.rs:20:5
48+
|
49+
LL | async fn foo() {}
50+
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
51+
|
52+
= help: pass `--edition 2021` to `rustc`
53+
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
54+
55+
error[E0670]: `async fn` is not permitted in Rust 2015
56+
--> $DIR/edition-deny-async-fns-2015.rs:38:9
57+
|
58+
LL | async fn bar() {}
59+
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
60+
|
61+
= help: pass `--edition 2021` to `rustc`
62+
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
63+
64+
error[E0670]: `async fn` is not permitted in Rust 2015
65+
--> $DIR/edition-deny-async-fns-2015.rs:28:9
66+
|
67+
LL | async fn foo() {}
68+
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
69+
|
70+
= help: pass `--edition 2021` to `rustc`
71+
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
72+
73+
error[E0670]: `async fn` is not permitted in Rust 2015
74+
--> $DIR/edition-deny-async-fns-2015.rs:33:13
75+
|
76+
LL | async fn bar() {}
77+
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
78+
|
79+
= help: pass `--edition 2021` to `rustc`
80+
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
81+
82+
error[E0706]: functions in traits cannot be declared `async`
83+
--> $DIR/edition-deny-async-fns-2015.rs:20:5
84+
|
85+
LL | async fn foo() {}
86+
| -----^^^^^^^^^
87+
| |
88+
| `async` because of this
89+
|
90+
= note: `async` trait functions are not currently supported
91+
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
92+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
93+
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
94+
95+
error: aborting due to 10 previous errors
96+
97+
Some errors have detailed explanations: E0670, E0706.
98+
For more information about an error, try `rustc --explain E0670`.

tests/ui/async-await/edition-deny-async-fns-2015.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// edition:2015
2+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3+
// revisions: current next
24

35
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
46

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
2+
--> $DIR/generics-mismatch.rs:13:18
3+
|
4+
LL | trait Foo {
5+
| ---
6+
LL | async fn foo<T>();
7+
| - expected type parameter
8+
...
9+
LL | impl Foo for () {
10+
| ---------------
11+
LL | async fn foo<const N: usize>() {}
12+
| ^^^^^^^^^^^^^^ found const parameter of type `usize`
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0053`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
2+
--> $DIR/generics-mismatch.rs:13:18
3+
|
4+
LL | trait Foo {
5+
| ---
6+
LL | async fn foo<T>();
7+
| - expected type parameter
8+
...
9+
LL | impl Foo for () {
10+
| ---------------
11+
LL | async fn foo<const N: usize>() {}
12+
| ^^^^^^^^^^^^^^ found const parameter of type `usize`
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0053`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// edition: 2021
2+
3+
#![feature(async_fn_in_trait)]
4+
#![allow(incomplete_features)]
5+
6+
trait Foo {
7+
async fn foo<T>();
8+
}
9+
10+
impl Foo for () {
11+
async fn foo<const N: usize>() {}
12+
//~^ ERROR: method `foo` has an incompatible generic parameter for trait `Foo` [E0053]
13+
}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
2+
--> $DIR/generics-mismatch.rs:11:18
3+
|
4+
LL | trait Foo {
5+
| ---
6+
LL | async fn foo<T>();
7+
| - expected type parameter
8+
...
9+
LL | impl Foo for () {
10+
| ---------------
11+
LL | async fn foo<const N: usize>() {}
12+
| ^^^^^^^^^^^^^^ found const parameter of type `usize`
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0053`.

tests/ui/async-await/in-trait/return-type-suggestion.stderr renamed to tests/ui/async-await/in-trait/return-type-suggestion.current.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/return-type-suggestion.rs:3:12
2+
--> $DIR/return-type-suggestion.rs:5:12
33
|
44
LL | #![feature(async_fn_in_trait)]
55
| ^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(async_fn_in_trait)]
88
= note: `#[warn(incomplete_features)]` on by default
99

1010
error[E0308]: mismatched types
11-
--> $DIR/return-type-suggestion.rs:8:9
11+
--> $DIR/return-type-suggestion.rs:10:9
1212
|
1313
LL | Ok(())
1414
| ^^^^^^- help: consider using a semicolon here: `;`

0 commit comments

Comments
 (0)