Skip to content

Suggestions in errors ignore move before closure arguments #55891

Closed
@ghost

Description

Source: https://travis-ci.org/rust-lang/cargo/jobs/453802414#L938-L949

error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
   --> src/cargo/core/compiler/job_queue.rs:412:23
    |
399 |         let doit = move || {
    |                    ------- takes 0 arguments
...
412 |                 scope.spawn(doit);
    |                       ^^^^^ expected closure that takes 1 argument
help: consider changing the closure to take and ignore the expected argument
    |
399 |         let doit = |_| {
    |                    ^^^

The suggestion is to use: let doit = |_| {
But I think it should be: let doit = move |_| {

We should probably respect other modifiers like static and async, too.

Activity

added
A-diagnosticsArea: Messages for errors, warnings, and lints
on Nov 13, 2018
csmoe

csmoe commented on Nov 13, 2018

@csmoe
Member

cc #52647
@estebank that's a bit strange, why the prefix is missed in suggestions?

estebank

estebank commented on Nov 13, 2018

@estebank
Contributor

The closure span includes everything between the pipes, the pipes and any prefix modifier. In the suggestion, we replace the entire span. We should probably add a new way of obtaining closure spans to account for this, to be used in suggestions. The fix itself will be fairly small.

added a commit that references this issue on Nov 22, 2018

Rollup merge of rust-lang#55980 - csmoe:issue-55891, r=estebank

636f0a9
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 lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @estebank@csmoe

        Issue actions

          Suggestions in errors ignore `move` before closure arguments · Issue #55891 · rust-lang/rust