Skip to content

Don't consider unstable fields always-inhabited #144216

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Nadrieril
Copy link
Member

This reverts the hack in #133889 now that Pin's field is no longer public.

Fixes #143468.

r? @compiler-errors

@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 Jul 20, 2025
@rustbot

This comment has been minimized.

This reverts the hack in rust-lang#133889
now that `Pin`'s field is no longer public.
//@ revisions: current exhaustive

//! The field of `Pin` used to be public, which would cause `Pin<Void>` to be uninhabited. To remedy
//! this, we temporarily made it so unstable fields are always considered uninhabited. This has now
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
//! this, we temporarily made it so unstable fields are always considered uninhabited. This has now
//! this, we temporarily made it so unstable fields are always considered inhabited. This has now

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-19-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
To only update this specific test, also pass `--test-args uninhabited/uninhabited-unstable-field.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/uninhabited/uninhabited-unstable-field.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/uninhabited/uninhabited-unstable-field" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/uninhabited/uninhabited-unstable-field/auxiliary"
stdout: none
--- stderr -------------------------------
error: unreachable pattern
##[error]  --> /checkout/tests/ui/uninhabited/uninhabited-unstable-field.rs:24:9
   |
LL |         Foo { .. } => {} //~ ERROR unreachable
   |         ^^^^^^^^^^------
   |         |
   |         matches no values because `Foo<Void>` is uninhabited
   |         help: remove the match arm
   |
   = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
  --> /checkout/tests/ui/uninhabited/uninhabited-unstable-field.rs:9:9
---
   |
LL |         _ => {} //~ ERROR unreachable
   |         ^------
   |         |
   |         matches no values because `Foo<Void>` is uninhabited
   |         help: remove the match arm
   |
   = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

error: unreachable pattern
##[error]  --> /checkout/tests/ui/uninhabited/uninhabited-unstable-field.rs:41:9
   |
LL |         MyCoroutineState::Complete(_) => {} //~ ERROR unreachable
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------
   |         |
   |         matches no values because `!` is uninhabited
   |         help: remove the match arm
   |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exhaustive matching doesn't work correctly for Coroutines with never_type variants
5 participants