Skip to content

Conversation

kiscad
Copy link
Contributor

@kiscad kiscad commented Sep 6, 2023

fix #115348
It looks that:

  • In rustc_mir_build::build, the body of function will not be built, when the tcx.check_match(def) fails due to non-exhaustive patterns
  • In rustc_mir_transform::check_unsafety, the UnsafetyChecker collects all used_unsafe_blocks in the MIR of a function, and the UnusedUnsafeVisitor will visit all UnsafeBlocks in the HIR and collect unused_unsafes, which are not contained in used_unsafe_blocks, and report unnecessary_unsafes
  • So the unsafe block in the issue example code will be reported as unnecessary_unsafe.

@rustbot
Copy link
Collaborator

rustbot commented Sep 6, 2023

r? @cjgillot

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 6, 2023
@rustbot
Copy link
Collaborator

rustbot commented Sep 6, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@oli-obk
Copy link
Contributor

oli-obk commented Sep 6, 2023

r? @oli-obk

Please add a regression test

@rustbot rustbot assigned oli-obk and unassigned cjgillot Sep 6, 2023
@oli-obk
Copy link
Contributor

oli-obk commented Sep 6, 2023

@bors r+ rollup

Thanks!

small request for the future: instead of having commits refer to an issue, add a message to the main post of the PR. this way the issue does not get multiple references noted in it.

@bors
Copy link
Collaborator

bors commented Sep 6, 2023

📌 Commit cfa2119 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 6, 2023
fmease added a commit to fmease/rust that referenced this pull request Sep 6, 2023
fix rust-lang#115348

fix rust-lang#115348
It looks that:

- In `rustc_mir_build::build`, the body of function will not be built, when the `tcx.check_match(def)` fails due to `non-exhaustive patterns`
- In `rustc_mir_transform::check_unsafety`, the `UnsafetyChecker` collects all `used_unsafe_blocks` in the MIR of a function, and the `UnusedUnsafeVisitor` will visit all `UnsafeBlock`s in the HIR and collect `unused_unsafes`, which are not contained in `used_unsafe_blocks`, and report `unnecessary_unsafe`s
- So the unsafe block in the issue example code will be reported as `unnecessary_unsafe`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 6, 2023
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#114511 (Remove the unhelpful let binding diag comes from FormatArguments)
 - rust-lang#115473 (Add explanatory note to 'expected item' error)
 - rust-lang#115574 (Replace `rustc_data_structures` dependency with `rustc_index` in `rustc_parse_format`)
 - rust-lang#115578 (Clarify cryptic comments)
 - rust-lang#115587 (fix rust-lang#115348)
 - rust-lang#115596 (A small change)
 - rust-lang#115598 (Fix log formatting in bootstrap)
 - rust-lang#115605 (Better Debug for `Ty` in smir)
 - rust-lang#115614 (Fix minor grammar typo)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3e42a12 into rust-lang:master Sep 6, 2023
@rustbot rustbot added this to the 1.74.0 milestone Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

necessary unsafe keywords marked as unnecessary when inside incomplete match
5 participants