Skip to content

Commit f4ea305

Browse files
committed
Fix new dead_code instances in compiler
1 parent 5fbb5d2 commit f4ea305

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

compiler/rustc_builtin_macros/src/format_foreign.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ pub(crate) mod printf {
6262
/// Precision of the conversion.
6363
precision: Option<Num>,
6464
/// Length modifier for the conversion.
65+
// FIXME(#143487): is it okay that this field is never read?
66+
#[cfg_attr(not(bootstrap), expect(dead_code))]
6567
length: Option<&'a str>,
6668
/// Type of parameter being converted.
6769
type_: &'a str,

compiler/rustc_data_structures/src/sync/worker_local.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ use crate::sync::CacheAligned;
1212
/// A pointer to the `RegistryData` which uniquely identifies a registry.
1313
/// This identifier can be reused if the registry gets freed.
1414
#[derive(Clone, Copy, PartialEq)]
15-
struct RegistryId(*const RegistryData);
15+
struct RegistryId(
16+
#[cfg_attr(
17+
not(bootstrap),
18+
expect(dead_code, reason = "This field is only used for equality comparisons")
19+
)]
20+
*const RegistryData,
21+
);
1622

1723
impl RegistryId {
1824
#[inline(always)]

compiler/rustc_hir_typeck/src/loops.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,21 @@ use crate::errors::{
2626
enum Context {
2727
Normal,
2828
Fn,
29-
Loop(hir::LoopSource),
29+
Loop(
30+
// FIXME(#143487): is it okay that this field is never read?
31+
#[cfg_attr(not(bootstrap), expect(dead_code))] hir::LoopSource,
32+
),
3033
Closure(Span),
3134
Coroutine {
3235
coroutine_span: Span,
3336
kind: hir::CoroutineDesugaring,
3437
source: hir::CoroutineSource,
3538
},
3639
UnlabeledBlock(Span),
37-
UnlabeledIfBlock(Span),
40+
UnlabeledIfBlock(
41+
// FIXME(#143487): is it okay that this field is never read?
42+
#[cfg_attr(not(bootstrap), expect(dead_code))] Span,
43+
),
3844
LabeledBlock,
3945
/// E.g. The labeled block inside `['_'; 'block: { break 'block 1 + 2; }]`.
4046
AnonConst,

compiler/rustc_pattern_analysis/src/constructor.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,13 @@ impl Slice {
657657

658658
/// A globally unique id to distinguish `Opaque` patterns.
659659
#[derive(Clone, Debug, PartialEq, Eq)]
660-
pub struct OpaqueId(u32);
660+
pub struct OpaqueId(
661+
#[cfg_attr(
662+
not(bootstrap),
663+
expect(dead_code, reason = "This field is only used for equality comparisons")
664+
)]
665+
u32,
666+
);
661667

662668
impl OpaqueId {
663669
pub fn new() -> Self {

0 commit comments

Comments
 (0)