Skip to content

Invalid machine-applicable suggestion for unused variables in pattern matching when the ref specifier is present #59918

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

Closed
SiebenCorgie opened this issue Apr 12, 2019 · 4 comments

Comments

@SiebenCorgie
Copy link

Hi,

I found out about Cargo's cargo fix command recently and tried it on one of my crates. Apparently either rustc or cargo ran into some kind of bug which it asked me to report.

First things first, I'm on (Arch) Linux 5.0 if that matters, my rustup show output is the following:

Default host: x86_64-unknown-linux-gnu

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.35.0-nightly (3de010678 2019-04-11)

rustc --version --verbose

rustc 1.35.0-nightly (3de010678 2019-04-11)
binary: rustc
commit-hash: 3de0106789468b211bcc3a25c09c0cf07119186d
commit-date: 2019-04-11
host: x86_64-unknown-linux-gnu
release: 1.35.0-nightly
LLVM version: 8.0

The error it reported

after fixes were automatically applied the compiler reported errors within these files:

  * widkan/src/rendering/mod.rs

This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see 
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag

The following errors were reported:
error: expected `,`
   --> widkan/src/rendering/mod.rs:509:41
    |
509 |                     Primitive::Text{ref content: _, ref size: _} => texts.push(p),
    |                                         ^^^^^^^

error: aborting due to previous error

Original diagnostics will follow.

The rest of that command is a list of usual "unused imports/variable". If you need those just let me know.
The crate can be found here if you want to have a look at the specific line the error was reported on.

Cheers

@meithecatte
Copy link
Contributor

Here is a much smaller test case, not sure if it's minimal:

pub enum Enum {
    Variant { field: String },
}

pub fn frob(arg: &Enum) {
    match arg {
        Enum::Variant { ref field } => (),
    }
}

Could you please make the issue title more descriptive? I'd suggest "Invalid machine-applicable suggestion for unused variables in pattern matching when the ref specifier is present".

@ehuss
Copy link
Contributor

ehuss commented Apr 12, 2019

I believe this is #54180.

@SiebenCorgie SiebenCorgie changed the title cargo fix Invalid machine-applicable suggestion for unused variables in pattern matching when the ref specifier is present Apr 12, 2019
@SiebenCorgie
Copy link
Author

Hi, thanks for the fast response and sorry for the title, that was actually only a placeholder I forgot to update to something meaningful.

@ehuss Should I close the issues since this might be a duplicate?

@estebank
Copy link
Contributor

Closing as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants