diff options
| author | Michael Goulet <michael@errs.io> | 2025-03-18 18:23:32 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-03-18 18:23:36 +0000 |
| commit | f6107ca17342c34b3fd19bb88e3e57f99b07864e (patch) | |
| tree | 09b21036931d928ca9a939d7f9928810b8127d66 /compiler/rustc_pattern_analysis/src/rustc.rs | |
| parent | 75530e9f72a1990ed2305e16fd51d02f47048f12 (diff) | |
| download | rust-f6107ca17342c34b3fd19bb88e3e57f99b07864e.tar.gz rust-f6107ca17342c34b3fd19bb88e3e57f99b07864e.zip | |
Consider fields to be inhabited if they are unstable
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/rustc.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/rustc.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_pattern_analysis/src/rustc.rs b/compiler/rustc_pattern_analysis/src/rustc.rs index 88194c737a6..68d4d083a74 100644 --- a/compiler/rustc_pattern_analysis/src/rustc.rs +++ b/compiler/rustc_pattern_analysis/src/rustc.rs @@ -232,7 +232,11 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> { let is_visible = adt.is_enum() || field.vis.is_accessible_from(cx.module, cx.tcx); let is_uninhabited = cx.is_uninhabited(*ty); - let skip = is_uninhabited && !is_visible; + let is_unstable = cx + .tcx + .lookup_stability(field.did) + .is_some_and(|stab| stab.is_unstable()); + let skip = is_uninhabited && (!is_visible || is_unstable); (ty, PrivateUninhabitedField(skip)) }); cx.dropless_arena.alloc_from_iter(tys) |
