Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upcompiler suggests invalid code with ref pattern #54180
Comments
This comment has been minimized.
This comment has been minimized.
warning: unused variable: `f1`
--> src/main.rs:9:15
|
9 | let S{ref f1} = s;
- | ^^ help: tryignoring the field: `f1: _`
+ | ^^^^^^ help: try ignoring the field: `f1: _`
|
= note: #[warn(unused_variables)] on by defaultthe ambiguity in the lint caused by the wrong span. |
csmoe
added
the
A-diagnostics
label
Sep 13, 2018
This comment has been minimized.
This comment has been minimized.
ambaxter
commented
Dec 6, 2018
|
There is an issue regarding this with the 2018 edition. |
This comment has been minimized.
This comment has been minimized.
|
Just to be clear, AFAIK there are no lints for transitioning to default binding mode (edition idiom or otherwise), so the comment that it won't be an issue in 2018 isn't correct, this issue still applies to all editions. |
apiraino
referenced this issue
Dec 13, 2018
Closed
Cargo check - wrong warning about unused code (edition=2018, nightly 2018-12-7) #6430
ehuss
referenced this issue
Dec 25, 2018
Closed
cargo fix : failed to automatically apply fixes suggested by rustc to crate `cpclib` #6483
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ehuss commentedSep 13, 2018
The following example:
Gives the following suggestion:
When the suggestion is applied, the code does not compile:
I'm not sure what the best suggestion would be. Removing the
refmight be an option (I'm not sure if using a wildcard is equivalent in this case?). Suggesting..is another option.This suggestion was changed in 1.28 (previous versions gave a different, wrong suggestion). Tested up to rustc 1.30.0-nightly (2d4e34c 2018-09-09).