-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't leak unnameable types in -> _ recover
- Loading branch information
1 parent
78bc0a5
commit aaad71b
Showing
4 changed files
with
37 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |