-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggest type param when encountering _
in item signatures
#67597
Conversation
r? @davidtwco (rust_highfive has picked a reviewer for you, use r? to override) |
src/test/ui/error-codes/E0121.stderr
Outdated
@@ -5,7 +5,7 @@ LL | fn foo() -> _ { 5 } | |||
| ^ | |||
| | | |||
| not allowed in type signatures | |||
| help: replace `_` with the correct return type: `i32` | |||
| help: replace this with the correct return type: `i32` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was better before imo -- more obvious
This comment has been minimized.
This comment has been minimized.
r? @oli-obk |
af2338d
to
1c07fcc
Compare
This comment has been minimized.
This comment has been minimized.
1c07fcc
to
859fc20
Compare
This comment has been minimized.
This comment has been minimized.
859fc20
to
4b4a132
Compare
b3df95e
to
63f3488
Compare
done |
r=me with the comments resolved |
63f3488
to
d3f79fc
Compare
@bors r=oli-obk |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
When encountering `_` type placeholder in fn arguments and return type, suggest using generic type parameters. Expand what counts as an inferable return type to slice, array and tuples of `_`.
d3f79fc
to
261b606
Compare
@bors r=oli-obk |
📌 Commit 261b606 has been approved by |
Suggest type param when encountering `_` in item signatures Fix #27435.
☀️ Test successful - checks-azure |
Extend support of `_` in type parameters - Account for `impl Trait<_>`. - Provide a reasonable `Span` for empty `Generics` in `impl`s. - Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`. - Fix rust-lang#67995. Follow up to rust-lang#67597.
Extend support of `_` in type parameters - Account for `impl Trait<_>`. - Provide a reasonable `Span` for empty `Generics` in `impl`s. - Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`. - Fix rust-lang#67995. Follow up to rust-lang#67597.
Account for bounds and asociated items when denying `_` Fix rust-lang#68801, rust-lang#69204. Follow up to rust-lang#67597 and rust-lang#68071. Output for the original ICE report: ``` Checking vinoteca v5.0.0 (/Users/ekuber/workspace/vinoteca) error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> src/producers.rs:43:70 | 43 | pub fn top<Table: diesel::Table + diesel::query_dsl::InternalJoinDsl<_, diesel::query_source::joins::Inner, _>>(table: Table, limit: usize, connection: DbConn) -> RestResult<Vec<TopWineType>> { | ^ not allowed in type signatures ^ not allowed in type signatures error: aborting due to previous error ```
Account for bounds and asociated items when denying `_` Fix #68801, #69204. Follow up to #67597 and #68071. Output for the original ICE report: ``` Checking vinoteca v5.0.0 (/Users/ekuber/workspace/vinoteca) error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> src/producers.rs:43:70 | 43 | pub fn top<Table: diesel::Table + diesel::query_dsl::InternalJoinDsl<_, diesel::query_source::joins::Inner, _>>(table: Table, limit: usize, connection: DbConn) -> RestResult<Vec<TopWineType>> { | ^ not allowed in type signatures ^ not allowed in type signatures error: aborting due to previous error ```
Fix #27435.