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

don't suggest erroneous trailing comma after .. #81103

Merged
merged 1 commit into from
Jan 19, 2021

Commits on Jan 17, 2021

  1. don't suggest erroneous trailing comma after ..

    In rust-lang#76612, suggestions were added for missing fields in
    patterns. However, the suggestions are being inserted just at the end
    of the last field in the pattern—before any trailing comma after the
    last field. This resulted in the "if you don't care about missing
    fields" suggestion to recommend code with a trailing comma after the
    field ellipsis (`..,`), which is actually not legal ("`..` must be at
    the end and cannot have a trailing comma")!
    
    Incidentally, the doc-comment on `error_unmentioned_fields` was using
    `you_cant_use_this_field` as an example field name (presumably
    copy-paste inherited from the description of Issue rust-lang#76077), but
    the present author found this confusing, because unmentioned fields
    aren't necessarily unusable.
    
    The suggested code in the diff this commit introduces to
    `destructuring-assignment/struct_destructure_fail.stderr` doesn't
    work, but it didn't work beforehand, either (because of the "found
    reserved identifier `_`" thing), so you can't really call it a
    regression; it could be fixed in a separate PR.
    
    Resolves rust-lang#78511.
    zackmdavis committed Jan 17, 2021
    Configuration menu
    Copy the full SHA
    14eb94f View commit details
    Browse the repository at this point in the history