diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-06-13 22:55:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-13 22:55:45 +0200 |
| commit | 977c5fd419ade52467f7de79d5bfc25c0c893275 (patch) | |
| tree | 4d2e1713ef0a967dc7b1f8127df5dc2c811fe3e0 /compiler/rustc_passes | |
| parent | 24c94f0e4f5aa333c665fbbba423172c30176624 (diff) | |
| parent | 64450732be8c3111360589e9f8c44eab83f449e0 (diff) | |
| download | rust-977c5fd419ade52467f7de79d5bfc25c0c893275.tar.gz rust-977c5fd419ade52467f7de79d5bfc25c0c893275.zip | |
Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov
Add pub struct with allow(dead_code) into worklist
<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.
This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using
r? <reviewer name>
-->
Fixes #126289
Diffstat (limited to 'compiler/rustc_passes')
| -rw-r--r-- | compiler/rustc_passes/src/dead.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index a72fbdb9021..6a74ddc5508 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -898,7 +898,7 @@ fn create_and_seed_worklist( match tcx.def_kind(id) { DefKind::Impl { .. } => false, DefKind::AssocConst | DefKind::AssocFn => !matches!(tcx.associated_item(id).container, AssocItemContainer::ImplContainer), - DefKind::Struct => struct_all_fields_are_public(tcx, id.to_def_id()), + DefKind::Struct => struct_all_fields_are_public(tcx, id.to_def_id()) || has_allow_dead_code_or_lang_attr(tcx, id).is_some(), _ => true }) .map(|id| (id, ComesFromAllowExpect::No)) |
