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

mir_build: consider privacy when checking for irrefutable patterns #138001

Merged
merged 2 commits into from
Mar 20, 2025

Conversation

meithecatte
Copy link
Contributor

@meithecatte meithecatte commented Mar 4, 2025

This PR fixes #137999.

Note that, since this makes the compiler reject code that was previously accepted, it will probably need a crater run.

I include a commit that factors out a common code pattern into a helper function, purely because the fact that this was repeated all over the place was bothering me. Let me know if I should split that into a separate PR instead.

@rustbot
Copy link
Collaborator

rustbot commented Mar 4, 2025

r? @compiler-errors

rustbot has assigned @compiler-errors.
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 Mar 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 4, 2025

Some changes occurred in exhaustiveness checking

cc @Nadrieril

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in match lowering

cc @Nadrieril

@rust-log-analyzer

This comment has been minimized.

@meithecatte meithecatte force-pushed the privately-uninhabited branch from a75dd17 to a4b5051 Compare March 4, 2025 14:54
@compiler-errors
Copy link
Member

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 4, 2025
…=<try>

mir_build: consider privacy when checking for irrefutable patterns

This PR fixes rust-lang#137999.

Note that, since this makes the compiler reject code that was previously accepted, it will probably need a crater run.

I include a commit that factors out a common code pattern into a helper function, purely because the fact that this was repeated all over the place was bothering me. Let me know if I should split that into a separate PR instead.
@bors
Copy link
Contributor

bors commented Mar 4, 2025

⌛ Trying commit a4b5051 with merge 5785402...

.inhabited_predicate(cx.tcx, adt_def)
.instantiate(cx.tcx, args)
.apply_ignore_module(cx.tcx, cx.infcx.typing_env(cx.param_env))
|| !v.inhabited_predicate(cx.tcx, adt_def).instantiate(cx.tcx, args).apply(
Copy link
Member

Choose a reason for hiding this comment

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

👍

@bors
Copy link
Contributor

bors commented Mar 4, 2025

☀️ Try build successful - checks-actions
Build commit: 5785402 (5785402183672f7786e9dc343d7b435bdaf4a4bc)

@compiler-errors
Copy link
Member

@craterbot check

@compiler-errors compiler-errors added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 4, 2025
@craterbot
Copy link
Collaborator

👌 Experiment pr-138001 created and queued.
🤖 Automatically detected try build 5785402
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🚧 Experiment pr-138001 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@Skgland
Copy link
Contributor

Skgland commented Mar 5, 2025

The crater run appears to be running extremely slow. The estimated end is up to 534 hours (22 days) and still increasing. Recent runs took 1-2 days.

Edit: a check crater run 4 days ago took ~18 hours, this crater run is at 3% 15 hours in.

@lqd
Copy link
Member

lqd commented Mar 5, 2025

@rust-timer build 5785402

(perf.rlo handles timeouts on benchmarks, it should be thus fine to check if this PR causes slowdowns)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5785402): comparison URL.

Overall result: no relevant changes - 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 benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (secondary -2.8%)

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
Improvements ✅
(secondary)
-2.8% [-2.8%, -2.8%] 1
All ❌✅ (primary) - - 0

Cycles

Results (secondary -6.4%)

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
Improvements ✅
(secondary)
-6.4% [-6.4%, -6.4%] 1
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: missing data
Artifact size: 362.04 MiB -> 362.04 MiB (0.00%)

@Skgland
Copy link
Contributor

Skgland commented Mar 5, 2025

As it doesn't appear to be a perf problem of the PR maybe its related to rust-lang/rustwide#94 and rustup 1.28 breaking rustwide also affects crater. Tough I would have expected a speedup in the crater run, as I would expect everything to fail immediately, rather than a slow down.

@Skgland
Copy link
Contributor

Skgland commented Mar 5, 2025

The Crater Agent has apparently lost contact since ~2 hours ago
image

@compiler-errors
Copy link
Member

@craterbot cancel

@craterbot
Copy link
Collaborator

🗑️ Experiment pr-138001 deleted!

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Mar 5, 2025
@compiler-errors
Copy link
Member

Let's try again 🙏 otherwise I'll open a T-infra thread to investigate.

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-138001 created and queued.
🤖 Automatically detected try build 5785402
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 5, 2025
@craterbot craterbot added the S-waiting-on-crater Status: Waiting on a crater run to be completed. label Mar 5, 2025
@meithecatte
Copy link
Contributor Author

The crater run is not starting. The agent is still unreachable.

@compiler-errors
Copy link
Member

@craterbot
Copy link
Collaborator

🚧 Experiment pr-138001 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-138001 is completed!
📊 2 regressed and 4 fixed (592735 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Mar 6, 2025
@meithecatte
Copy link
Contributor Author

I might be misreading this, but it seems like there's a bunch of spurious errors, and no legitimate failures.

@compiler-errors
Copy link
Member

No regressions, yup

@compiler-errors
Copy link
Member

I'm inclined to treat this as a bugfix. This probably wouldn't have been committed if we knew the consequence.

A check for `#[non_exhaustive]` is often done in combination with
checking whether the type is local to the crate, in a variety of ways.
Create a helper method and standardize on it as the way to check for
this.
@meithecatte meithecatte force-pushed the privately-uninhabited branch from a4b5051 to 044deec Compare March 7, 2025 15:29
@meithecatte
Copy link
Contributor Author

I rebased the PR onto latest master and resolved the merge conflicts.

@compiler-errors
Copy link
Member

r? nadrieril for a final review, though looks fine to me

@rustbot rustbot assigned Nadrieril and unassigned compiler-errors Mar 8, 2025
@Nadrieril
Copy link
Member

Looks good, agreed that it qualifies as bugfix.

@bors r+

@bors
Copy link
Contributor

bors commented Mar 18, 2025

📌 Commit 044deec has been approved by Nadrieril

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 Mar 18, 2025
@Nadrieril
Copy link
Member

Disabling rollup to make it easier to find by bisection, just in case.

@bors rollup=never

@compiler-errors
Copy link
Member

cargo bisect-rustc handles rollups totally fine, and i don't expect this to have any fallout, so let's compromise and mark it as rollup=maybe :)

@bors rollup=maybe

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 19, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#135394 (`MaybeUninit` inherent slice methods part 2)
 - rust-lang#137051 (Implement default methods for `io::Empty` and `io::Sink`)
 - rust-lang#138001 (mir_build: consider privacy when checking for irrefutable patterns)
 - rust-lang#138540 (core/slice: Mark some `split_off` variants unstably const)
 - rust-lang#138589 (If a label is placed on the block of a loop instead of the header, suggest moving it to the header.)
 - rust-lang#138594 (Fix next solver handling of shallow trait impl check)
 - rust-lang#138613 (Remove E0773 "A builtin-macro was defined more than once.")

Failed merges:

 - rust-lang#138602 (Slim `rustc_parse_format` dependencies down)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 19, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#135394 (`MaybeUninit` inherent slice methods part 2)
 - rust-lang#137051 (Implement default methods for `io::Empty` and `io::Sink`)
 - rust-lang#138001 (mir_build: consider privacy when checking for irrefutable patterns)
 - rust-lang#138540 (core/slice: Mark some `split_off` variants unstably const)
 - rust-lang#138589 (If a label is placed on the block of a loop instead of the header, suggest moving it to the header.)
 - rust-lang#138594 (Fix next solver handling of shallow trait impl check)
 - rust-lang#138613 (Remove E0773 "A builtin-macro was defined more than once.")

Failed merges:

 - rust-lang#138602 (Slim `rustc_parse_format` dependencies down)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2ab69b8 into rust-lang:master Mar 20, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 20, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 20, 2025
Rollup merge of rust-lang#138001 - meithecatte:privately-uninhabited, r=Nadrieril

mir_build: consider privacy when checking for irrefutable patterns

This PR fixes rust-lang#137999.

Note that, since this makes the compiler reject code that was previously accepted, it will probably need a crater run.

I include a commit that factors out a common code pattern into a helper function, purely because the fact that this was repeated all over the place was bothering me. Let me know if I should split that into a separate PR instead.
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.

Privately uninhabited types can affect how pattern matches are borrow-checked
10 participants