-
Notifications
You must be signed in to change notification settings - Fork 64
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
Fix mutable aliasing uncovered by MIR borrow-checking #61
Conversation
To reproduce, build on Nightly with `RUSTFLAGS=-Znll`
Sorry, I thought this was already fixed in |
Will this be necessary in the long run? Is |
Yes, I can use However this particular compiler behavior change was ruled in rust-lang/rust#47707 as not a bug, but rather fixing a previous soundness bug. So this change (or something like it) will be needed when NLL is enabled in Nightly by default. Why wait? |
Telling a soundess fix like this apart from a NLL bug requires manual triaging. Fixing them as we find them will likely help reduce such manual work in future NLL crater runs. |
Er sorry yeah I didn't realize that this was going to become a hard error in the future! I'm ok merging this for that alone yeah. I'm mostly surprised that this wasn't discovered in the previous PR? I think |
I’ve been trying NLL by running After seeing that this crate’s build errors was not a rust bug I reproduced it in this repo (not with |
The pinned version does not compile anymore because of mutable aliasing: * rust-lang/getopts#61 * rust-lang/getopts#110 This was achieved by temporarily setting the getopts version to "0.2.21" in Cargo.toml, and running `cargo check`. Note that this also converts the Cargo.lock to a new format.
* Fix getopts version The pinned version does not compile anymore because of mutable aliasing: * rust-lang/getopts#61 * rust-lang/getopts#110 This was achieved by temporarily setting the getopts version to "0.2.21" in Cargo.toml, and running `cargo check`. Note that this also converts the Cargo.lock to a new format. * Fix warning: Instead of deprecated macro try!, use question mark operator * Fix warning: Avoid anonymous parameters * Fix warning: Use dyn on trait objects * Fix warning: Avoid unneeded mutability * Fix warning: Avoid redundant format in panic or assert * Fix lint: Avoid redundant field names in initializers * Fix lint: Avoid redundant clone * Fix lint: Avoid literal cast * Fix lint: Collapse if/else where applicable I left some if/else branches in place, if there was a certain symmetry between the branches. * Fix lint: Avoid needless borrow I left some if/else branches in place, if there was a certain symmetry between the branches. * Fix lint: Use cloned instead of custom closure * Fix lint: Avoid unneeded trait bound * Fix lint: Avoid unneeded trait bound (2) avoid redundant clone * Fix lint: Use &[T] instead of &Vec<T> * Fix lint: Avoid & on each pattern * Fix lint: Avoid manual assign * Fix lint: Use implicit return * Fix lint: Merge if/else branches with same value I left one complicated branch in place. * Fix lint: Use is_empty instead of comparing len against 0 * Fix lint: Use sum instead of fold * Fix lint: Avoid clone on Copy types
To reproduce, build on Nightly with
RUSTFLAGS=-Znll