Skip to content

E0121 suggests the use of the unique type of a generator #80844

Closed

Description

@PatchMixolydic

cc #80179

This still fails on generators (playground):

#![feature(generators)]

fn foo() -> _ {
    || yield 4i32
}
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> src/lib.rs:3:13
  |
3 | fn foo() -> _ {
  |             ^
  |             |
  |             not allowed in type signatures
  |             help: replace with the correct return type: [generator@src/lib.rs:4:5: 4:18 {i32, ()}]

Tested on:

cargo 1.50.0-nightly (75d5d8cff 2020-12-22)
release: 1.50.0
commit-hash: 75d5d8cffe3464631f82dcd3c470b78dc1dda8bb
commit-date: 2020-12-22

I'm working on a PR to fix this as well as making this suggestion and E0308's try adding a return type suggestion use the same mechanism for checking if a type is suggestable directly.

@rustbot claim
@rustbot modify labels: +A-diagnostics +D-invalid-suggestion +F-generators +T-compiler

Activity

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.
    F-coroutines`#![feature(coroutines)]`
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jan 9, 2021
  2. camelid commented on Jan 9, 2021

    @camelid
    Member

    @PatchMixolydic By the way, you don't need to open an issue if you're immediately going to open a PR.

  3. PatchMixolydic commented on Jan 9, 2021

    @PatchMixolydic
    ContributorAuthor

    My mistake 😅

  4. camelid commented on Jan 9, 2021

    @camelid
    Member

    Don't worry about it! It's not a problem; I was just letting you know that you shouldn't feel obliged to do it :)

  5. PatchMixolydic commented on Mar 20, 2021

    @PatchMixolydic
    ContributorAuthor

    Status update: I'm not certain I'm the right person for the job due to my warped schedule, among other things. You can find the progress I made at #80847, but note that a rebase caused important tests to fail. The commits might be usable as a basis for a new PR, but they're probably useless directly. I might come back to this when I have more time/control over my life.

  6. removed their assignment
    on Mar 20, 2021
  7. compiler-errors commented on Jun 7, 2022

    @compiler-errors
    Contributor

    This seems to be resolved on nightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.F-coroutines`#![feature(coroutines)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions