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

Emit diagnostic for privately uninhabited uncovered witnesses. #111624

Merged
merged 1 commit into from
May 25, 2023

Conversation

cjgillot
Copy link
Contributor

Fixes #104034

cc @Nadrieril

@rustbot
Copy link
Collaborator

rustbot commented May 15, 2023

r? @petrochenkov

(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 May 15, 2023
@rustbot
Copy link
Collaborator

rustbot commented May 15, 2023

Some changes might have occurred in exhaustiveness checking

cc @Nadrieril

@petrochenkov
Copy link
Contributor

I'm not very familiar with this code, but the change is diagnostic-only and the output looks reasonable.
r=me after addressing #111624 (comment) and squashing commits.
@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels May 22, 2023
@cjgillot cjgillot force-pushed the private-uninhabited-pattern branch from a0b35bd to ca4513f Compare May 24, 2023 18:33
@cjgillot cjgillot force-pushed the private-uninhabited-pattern branch from ca4513f to 9a7ed36 Compare May 24, 2023 19:16
@cjgillot cjgillot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 24, 2023
@cjgillot
Copy link
Contributor Author

@bors r=petrochenkov

@bors
Copy link
Contributor

bors commented May 24, 2023

📌 Commit 9a7ed36 has been approved by petrochenkov

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 May 24, 2023
@@ -479,12 +479,30 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
AdtDefinedHere { adt_def_span, ty, variants }
};

// Emit an extra note if the first uncovered witness is
// visibly uninhabited anywhere in the current crate.
Copy link
Member

Choose a reason for hiding this comment

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

It seems like you changed the logic, could you update this comment to match the new logic?

@Nadrieril
Copy link
Member

It seems you changed the logic to what I suggested, could you add a test where the secretely uninhabited type is in another crate? tests/ui/pattern/usefulness/auxiliary/empty.rs has SecretlyUninhabitedForeignStruct you can reuse for tests.

bors added a commit to rust-lang-ci/rust that referenced this pull request May 25, 2023
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#95198 (Add slice::{split_,}{first,last}_chunk{,_mut})
 - rust-lang#109899 (Use apple-m1 as target CPU for aarch64-apple-darwin.)
 - rust-lang#111624 (Emit diagnostic for privately uninhabited uncovered witnesses.)
 - rust-lang#111875 (Don't leak the function that is called on drop)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 725cadb into rust-lang:master May 25, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 25, 2023
@cjgillot cjgillot deleted the private-uninhabited-pattern branch May 25, 2023 10:01
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 26, 2023
Correct comment on privately uninhabited pattern.

Follow-up to rust-lang#111624 (comment)

r? `@Nadrieril`
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
5 participants