Skip to content
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

Remove MIR unsafe check #123322

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Conversation

matthewjasper
Copy link
Contributor

Now that THIR unsafeck is enabled by default in stable I think we can remove MIR unsafeck entirely. This PR also removes safety information from MIR.

@rustbot
Copy link
Collaborator

rustbot commented Apr 1, 2024

r? @Nadrieril

rustbot has assigned @Nadrieril.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Apr 1, 2024
@rustbot
Copy link
Collaborator

rustbot commented Apr 1, 2024

Some changes occurred in match lowering

cc @Nadrieril

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Nadrieril
Copy link
Member

This is a very satisfying PR :D Implementation looks good, I'd like someone else to confirm that this is a good idea; @compiler-errors?

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if y'all think this needs an additional FCP given that the FCP in #117673 seemed to exclude the changes to MIR building and removing MIR unsafeck.

The changes look good to me tho.

If anything, it's worth a ping to @rust-lang/compiler for the MIR changes and @rust-lang/lang for the removal of MIR unsafeck (i.e. full commitment to THIR unsafeck).

@lcnr
Copy link
Contributor

lcnr commented Apr 2, 2024

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 2, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 2, 2024
…=<try>

Remove MIR unsafe check

Now that THIR unsafeck is enabled by default in stable I think we can remove MIR unsafeck entirely. This PR also removes safety information from MIR.
@bors
Copy link
Contributor

bors commented Apr 2, 2024

⌛ Trying commit c10ad18 with merge 361ad8e...

@lcnr
Copy link
Contributor

lcnr commented Apr 2, 2024

Given that thir-unsafeck has now hit stable (version 1.77), we can now safely remove MIR unsafe check. Don't believe this to require any additional team approval.

@scottmcm
Copy link
Member

scottmcm commented Apr 2, 2024

I don't think anything is needed here from lang. Personally I'd consider it removing off-in-stable code in rustc, which is entirely up to compiler.

@bors
Copy link
Contributor

bors commented Apr 2, 2024

☀️ Try build successful - checks-actions
Build commit: 361ad8e (361ad8e0935797cfb92d931aedd56456973d1c5f)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (361ad8e): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.1% [1.1%, 1.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.7% [2.1%, 3.3%] 2
Regressions ❌
(secondary)
4.7% [3.9%, 5.5%] 2
Improvements ✅
(primary)
-4.6% [-4.6%, -4.6%] 1
Improvements ✅
(secondary)
-2.9% [-2.9%, -2.9%] 1
All ❌✅ (primary) 0.3% [-4.6%, 3.3%] 3

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.2% [1.2%, 1.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.2% [1.2%, 1.2%] 1

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.5%, -0.0%] 7
Improvements ✅
(secondary)
-0.5% [-0.9%, -0.0%] 12
All ❌✅ (primary) -0.2% [-0.5%, -0.0%] 7

Bootstrap: 669.168s -> 667.487s (-0.25%)
Artifact size: 315.68 MiB -> 315.62 MiB (-0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 2, 2024
@matthewjasper
Copy link
Contributor Author

Changes look like noise

@@ -909,11 +909,6 @@ impl UnsafeOpKind {
}

pub fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) {
Copy link
Contributor

@lcnr lcnr Apr 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in separate PR: should this get moved into its own crate rustc_thir_unsafeck or rustc_thir_analysis?

@lcnr
Copy link
Contributor

lcnr commented Apr 2, 2024

r? @lcnr

@bors r=compiler-errors,lcnr rollup=iffy

@bors
Copy link
Contributor

bors commented Apr 2, 2024

📌 Commit c10ad18 has been approved by compiler-errors,lcnr

It is now in the queue for this repository.

@rustbot rustbot assigned lcnr and unassigned Nadrieril Apr 2, 2024
@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 2, 2024
@bors
Copy link
Contributor

bors commented Apr 2, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 2, 2024
@compiler-errors
Copy link
Member

@bors r=lcnr,compiler-errors

@bors
Copy link
Contributor

bors commented Apr 2, 2024

📌 Commit 2645e60 has been approved by lcnr,compiler-errors

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 Apr 2, 2024
@bors
Copy link
Contributor

bors commented Apr 3, 2024

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout remove-mir-unsafeck (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self remove-mir-unsafeck --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Removing tests/ui/asm/x86_64/goto.thirunsafeck.stderr
CONFLICT (modify/delete): tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir deleted in HEAD and modified in heads/homu-tmp. Version heads/homu-tmp of tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir left in tree.
CONFLICT (modify/delete): tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir deleted in HEAD and modified in heads/homu-tmp. Version heads/homu-tmp of tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir left in tree.
CONFLICT (modify/delete): tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff deleted in HEAD and modified in heads/homu-tmp. Version heads/homu-tmp of tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff left in tree.
CONFLICT (modify/delete): tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff deleted in HEAD and modified in heads/homu-tmp. Version heads/homu-tmp of tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff left in tree.
Auto-merging tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir
CONFLICT (content): Merge conflict in tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir
Auto-merging tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir
CONFLICT (content): Merge conflict in tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir
Auto-merging tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff
CONFLICT (content): Merge conflict in tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff
Auto-merging tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff
CONFLICT (content): Merge conflict in tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff
Auto-merging tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir
CONFLICT (content): Merge conflict in tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir
Auto-merging tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir
CONFLICT (content): Merge conflict in tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir
Auto-merging tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff
CONFLICT (content): Merge conflict in tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff
Auto-merging tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff
CONFLICT (content): Merge conflict in tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff
CONFLICT (modify/delete): tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir deleted in HEAD and modified in heads/homu-tmp. Version heads/homu-tmp of tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir left in tree.
CONFLICT (modify/delete): tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir deleted in HEAD and modified in heads/homu-tmp. Version heads/homu-tmp of tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir left in tree.
CONFLICT (modify/delete): tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff deleted in HEAD and modified in heads/homu-tmp. Version heads/homu-tmp of tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff left in tree.
CONFLICT (modify/delete): tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff deleted in HEAD and modified in heads/homu-tmp. Version heads/homu-tmp of tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff left in tree.
Auto-merging tests/incremental/hashes/function_interfaces.rs
Removing compiler/rustc_mir_transform/src/check_unsafety.rs
Automatic merge failed; fix conflicts and then commit the result.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 3, 2024
@bors
Copy link
Contributor

bors commented Apr 3, 2024

☔ The latest upstream changes (presumably #123385) made this pull request unmergeable. Please resolve the merge conflicts.

This also remove safety information from MIR.
@lcnr
Copy link
Contributor

lcnr commented Apr 3, 2024

@bors r=lcnr,compiler-errors p=1 (prone to merge conflicts apparently)

@bors
Copy link
Contributor

bors commented Apr 3, 2024

📌 Commit a277c90 has been approved by lcnr,compiler-errors

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 3, 2024
@bors
Copy link
Contributor

bors commented Apr 3, 2024

⌛ Testing commit a277c90 with merge 99c42d2...

@bors
Copy link
Contributor

bors commented Apr 3, 2024

☀️ Test successful - checks-actions
Approved by: lcnr,compiler-errors
Pushing 99c42d2 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 3, 2024
@bors bors merged commit 99c42d2 into rust-lang:master Apr 3, 2024
12 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 3, 2024
@matthewjasper matthewjasper deleted the remove-mir-unsafeck branch April 3, 2024 13:08
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (99c42d2): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.9% [-1.7%, -0.2%] 2
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
4.9% [4.7%, 5.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.1%, 0.1%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.5%, -0.0%] 6
Improvements ✅
(secondary)
-0.5% [-0.8%, -0.0%] 9
All ❌✅ (primary) -0.2% [-0.5%, -0.0%] 6

Bootstrap: 667.159s -> 668.489s (0.20%)
Artifact size: 318.19 MiB -> 318.05 MiB (-0.05%)

Kobzol pushed a commit to Kobzol/rust that referenced this pull request Apr 4, 2024
…=lcnr,compiler-errors

Remove MIR unsafe check

Now that THIR unsafeck is enabled by default in stable I think we can remove MIR unsafeck entirely. This PR also removes safety information from MIR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

9 participants