Skip to content

Commit a9795db

Browse files
committed
Fix ICE from async closure variance
1 parent 401ae55 commit a9795db

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

compiler/rustc_middle/src/ty/diagnostics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for MakeSuggestableFolder<'tcx> {
698698
}
699699

700700
Closure(..)
701+
| CoroutineClosure(..)
701702
| FnDef(..)
702703
| Infer(..)
703704
| Coroutine(..)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ edition: 2024
2+
3+
struct T<'g>();
4+
//~^ ERROR lifetime parameter `'g` is never used
5+
6+
fn ord<a>() -> _ {
7+
//~^ WARN type parameter `a` should have an upper camel case name
8+
//~| ERROR the placeholder `_` is not allowed within types on item signatures for return types
9+
async || {}
10+
}
11+
12+
fn main() {}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
warning: type parameter `a` should have an upper camel case name
2+
--> $DIR/ice-async-closure-variance-issue-148488.rs:6:8
3+
|
4+
LL | fn ord<a>() -> _ {
5+
| ^ help: convert the identifier to upper camel case: `A`
6+
|
7+
= note: `#[warn(non_camel_case_types)]` (part of `#[warn(nonstandard_style)]`) on by default
8+
9+
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
10+
--> $DIR/ice-async-closure-variance-issue-148488.rs:6:16
11+
|
12+
LL | fn ord<a>() -> _ {
13+
| ^ not allowed in type signatures
14+
15+
error[E0392]: lifetime parameter `'g` is never used
16+
--> $DIR/ice-async-closure-variance-issue-148488.rs:3:10
17+
|
18+
LL | struct T<'g>();
19+
| ^^ unused lifetime parameter
20+
|
21+
= help: consider removing `'g`, referring to it in a field, or using a marker such as `PhantomData`
22+
23+
error: aborting due to 2 previous errors; 1 warning emitted
24+
25+
Some errors have detailed explanations: E0121, E0392.
26+
For more information about an error, try `rustc --explain E0121`.

0 commit comments

Comments
 (0)