Skip to content
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

Merged
merged 8 commits into from
Dec 31, 2019

Conversation

estebank
Copy link
Contributor

Fix #27435.

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 24, 2019
src/librustc_typeck/astconv.rs Outdated Show resolved Hide resolved
src/librustc_typeck/astconv.rs Outdated Show resolved Hide resolved
src/librustc_typeck/collect.rs Outdated Show resolved Hide resolved
src/librustc_typeck/collect.rs Outdated Show resolved Hide resolved
src/librustc_typeck/collect.rs Outdated Show resolved Hide resolved
src/librustc_typeck/collect.rs Outdated Show resolved Hide resolved
@@ -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`
Copy link
Contributor

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

@bors

This comment has been minimized.

@davidtwco
Copy link
Member

r? @oli-obk

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

src/librustc_typeck/check/mod.rs Outdated Show resolved Hide resolved
src/librustc_typeck/collect.rs Outdated Show resolved Hide resolved
src/librustc_typeck/collect.rs Outdated Show resolved Hide resolved
src/librustc_typeck/collect.rs Outdated Show resolved Hide resolved
src/librustc_typeck/collect.rs Outdated Show resolved Hide resolved
@estebank
Copy link
Contributor Author

done

@oli-obk
Copy link
Contributor

oli-obk commented Dec 28, 2019

r=me with the comments resolved

@estebank
Copy link
Contributor Author

@bors r=oli-obk

@bors

This comment has been minimized.

@bors

This comment has been minimized.

@estebank
Copy link
Contributor Author

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Dec 30, 2019

📌 Commit 261b606 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 30, 2019
@bors
Copy link
Contributor

bors commented Dec 31, 2019

⌛ Testing commit 261b606 with merge 71bb0ff...

bors added a commit that referenced this pull request Dec 31, 2019
Suggest type param when encountering `_` in item signatures

Fix #27435.
@bors
Copy link
Contributor

bors commented Dec 31, 2019

☀️ Test successful - checks-azure
Approved by: oli-obk
Pushing 71bb0ff to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 31, 2019
@bors bors merged commit 261b606 into rust-lang:master Dec 31, 2019
Centril added a commit to Centril/rust that referenced this pull request Jan 10, 2020
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.
Centril added a commit to Centril/rust that referenced this pull request Jan 10, 2020
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.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Feb 28, 2020
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
```
bors added a commit that referenced this pull request Feb 28, 2020
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
```
@estebank estebank deleted the placeholder-type branch November 9, 2023 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

the type placeholder _ is not allowed within types on item signatures should hint at generics
6 participants