Don't leak unnameable types in -> _ recover
This commit is contained in:
parent
78bc0a5656
commit
b09c177743
4 changed files with 37 additions and 17 deletions
13
tests/ui/variance/leaking-unnameables.rs
Normal file
13
tests/ui/variance/leaking-unnameables.rs
Normal 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() {}
|
||||
12
tests/ui/variance/leaking-unnameables.stderr
Normal file
12
tests/ui/variance/leaking-unnameables.stderr
Normal 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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue