Don't leak unnameable types in -> _ recover

This commit is contained in:
Michael Goulet 2024-04-14 11:36:37 -04:00
parent 78bc0a5656
commit b09c177743
4 changed files with 37 additions and 17 deletions

View file

@ -0,0 +1,13 @@
// Test variance computation doesn't explode when we leak unnameable
// types due to `-> _` recovery.
pub struct Type<'a>(&'a ());
pub fn g() {}
pub fn f<T>() -> _ {
//~^ ERROR the placeholder `_` is not allowed within types on item signatures
g
}
fn main() {}

View file

@ -0,0 +1,12 @@
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/leaking-unnameables.rs:8:18
|
LL | pub fn f<T>() -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `fn()`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0121`.