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

[regression - rust2018]: unused_mut lint false positives on nightly #55758

Merged
merged 1 commit into from Nov 9, 2018

Conversation

Projects
None yet
4 participants
@davidtwco
Member

davidtwco commented Nov 7, 2018

Fixes #55344.

This commit filters out locals that have never been initialized for
consideration in the unused_mut lint.

This is intended to detect when the statement that would have
initialized the local was removed as unreachable code. In these cases,
we would not want to lint. This is the same behaviour as the AST borrow
checker.

This is achieved by taking advantage of an existing pass over the MIR
for the unused_mut lint and creating a set of those locals that were
never initialized.

r? @pnkfelix

Ignore never-initialized locals for `unused_mut`.
This commit filters out locals that have never been initialized for
consideration in the `unused_mut` lint.

This is intended to detect when the statement that would have
initialized the local was removed as unreachable code. In these cases,
we would not want to lint. This is the same behaviour as the AST borrow
checker.

This is achieved by taking advantage of an existing pass over the MIR
for the `unused_mut` lint and creating a set of those locals that were
never initialized.
@pnkfelix

This comment has been minimized.

Member

pnkfelix commented Nov 7, 2018

@bors r+ rollup

@bors

This comment has been minimized.

Contributor

bors commented Nov 7, 2018

📌 Commit 299a452 has been approved by pnkfelix

kennytm added a commit to kennytm/rust that referenced this pull request Nov 8, 2018

Rollup merge of rust-lang#55758 - davidtwco:issue-55344, r=pnkfelix
[regression - rust2018]: unused_mut lint false positives on nightly

Fixes rust-lang#55344.

This commit filters out locals that have never been initialized for
consideration in the `unused_mut` lint.

This is intended to detect when the statement that would have
initialized the local was removed as unreachable code. In these cases,
we would not want to lint. This is the same behaviour as the AST borrow
checker.

This is achieved by taking advantage of an existing pass over the MIR
for the `unused_mut` lint and creating a set of those locals that were
never initialized.

r? @pnkfelix

bors added a commit that referenced this pull request Nov 8, 2018

Auto merge of #55789 - kennytm:rollup, r=kennytm
Rollup of 16 pull requests

Successful merges:

 - #54993 (Support for the program data address space option of LLVM's Target Datalayout)
 - #55576 (Clarify error message for -C opt-level)
 - #55638 (Fix ICE in msg_span_from_free_region on ReEmpty)
 - #55650 (Implement rotate using funnel shift on LLVM >= 7)
 - #55672 (miri: accept extern types in structs if they are the only field)
 - #55719 (Sidestep link error from rustfix'ed code by using a *defined* static.)
 - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters)
 - #55736 (Elide anon lifetimes in conflicting impl note)
 - #55739 (Consume optimization fuel from the MIR inliner)
 - #55753 (borrow_set: remove a helper function and a clone it uses)
 - #55755 (Improve creation of 3 IndexVecs)
 - #55758 ([regression - rust2018]: unused_mut lint false positives on nightly)
 - #55760 (Remove intermediate font specs)
 - #55761 (mir: remove a hacky recursive helper function)
 - #55774 (wasm32-unknown-emscripten expects the rust_eh_personality symbol)
 - #55788 (rustc: Request ansi colors if stderr isn't a tty)

Failed merges:

r? @ghost

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Nov 9, 2018

Rollup merge of rust-lang#55758 - davidtwco:issue-55344, r=pnkfelix
[regression - rust2018]: unused_mut lint false positives on nightly

Fixes rust-lang#55344.

This commit filters out locals that have never been initialized for
consideration in the `unused_mut` lint.

This is intended to detect when the statement that would have
initialized the local was removed as unreachable code. In these cases,
we would not want to lint. This is the same behaviour as the AST borrow
checker.

This is achieved by taking advantage of an existing pass over the MIR
for the `unused_mut` lint and creating a set of those locals that were
never initialized.

r? @pnkfelix

bors added a commit that referenced this pull request Nov 9, 2018

Auto merge of #55803 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 17 pull requests

Successful merges:

 - #55576 (Clarify error message for -C opt-level)
 - #55633 (Support memcpy/memmove with differing src/dst alignment)
 - #55638 (Fix ICE in msg_span_from_free_region on ReEmpty)
 - #55659 (rustc: Delete grouping logic from the musl target)
 - #55719 (Sidestep link error from rustfix'ed code by using a *defined* static.)
 - #55736 (Elide anon lifetimes in conflicting impl note)
 - #55739 (Consume optimization fuel from the MIR inliner)
 - #55742 (Avoid panic when matching function call)
 - #55753 (borrow_set: remove a helper function and a clone it uses)
 - #55755 (Improve creation of 3 IndexVecs)
 - #55758 ([regression - rust2018]: unused_mut lint false positives on nightly)
 - #55760 (Remove intermediate font specs)
 - #55761 (mir: remove a hacky recursive helper function)
 - #55774 (wasm32-unknown-emscripten expects the rust_eh_personality symbol)
 - #55777 (Use `Lit` rather than `P<Lit>` in `ast::ExprKind`.)
 - #55783 (Deprecate mpsc channel selection)
 - #55788 (rustc: Request ansi colors if stderr isn't a tty)

Failed merges:

r? @ghost

@bors bors merged commit 299a452 into rust-lang:master Nov 9, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@davidtwco davidtwco deleted the davidtwco:issue-55344 branch Nov 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment