Skip to content

Commit 79adda9

Browse files
committed
Ignore automatically derived impls of Clone and Debug in dead code analysis
1 parent 497ee32 commit 79adda9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+225
-107
lines changed

compiler/rustc_feature/src/accepted.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ macro_rules! declare_features {
1616
since: $ver,
1717
issue: to_nonzero($issue),
1818
edition: None,
19-
description: concat!($($doc,)*),
2019
}
2120
),+
2221
];

compiler/rustc_feature/src/active.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ macro_rules! declare_features {
3737
since: $ver,
3838
issue: to_nonzero($issue),
3939
edition: $edition,
40-
description: concat!($($doc,)*),
4140
}
4241
),+];
4342

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
453453
),
454454
// Enumerates "identity-like" conversion methods to suggest on type mismatch.
455455
rustc_attr!(rustc_conversion_suggestion, Normal, template!(Word), INTERNAL_UNSTABLE),
456+
// Prevents field reads in the marked trait or method to be considered
457+
// during dead code analysis.
458+
rustc_attr!(rustc_trivial_field_reads, Normal, template!(Word), INTERNAL_UNSTABLE),
456459

457460
// ==========================================================================
458461
// Internal attributes, Const related:

compiler/rustc_feature/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ pub struct Feature {
5151
pub since: &'static str,
5252
issue: Option<NonZeroU32>,
5353
pub edition: Option<Edition>,
54-
description: &'static str,
5554
}
5655

5756
#[derive(Copy, Clone, Debug)]

compiler/rustc_feature/src/removed.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ macro_rules! declare_features {
1616
since: $ver,
1717
issue: to_nonzero($issue),
1818
edition: None,
19-
description: concat!($($doc,)*),
2019
}
2120
),+
2221
];
@@ -34,7 +33,6 @@ macro_rules! declare_features {
3433
since: $ver,
3534
issue: to_nonzero($issue),
3635
edition: None,
37-
description: concat!($($doc,)*),
3836
}
3937
),+
4038
];

compiler/rustc_middle/src/hir/map/collector.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@ fn hash_body(
6262
stable_hasher.finish()
6363
}
6464

65-
/// Represents an entry and its parent `HirId`.
66-
#[derive(Copy, Clone, Debug)]
67-
pub struct Entry<'hir> {
68-
parent: HirId,
69-
node: Node<'hir>,
70-
}
71-
7265
impl<'a, 'hir> NodeCollector<'a, 'hir> {
7366
pub(super) fn root(
7467
sess: &'a Session,

compiler/rustc_middle/src/ich/hcx.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ fn compute_ignored_attr_names() -> FxHashSet<Symbol> {
2828
/// things (e.g., each `DefId`/`DefPath` is only hashed once).
2929
#[derive(Clone)]
3030
pub struct StableHashingContext<'a> {
31-
sess: &'a Session,
3231
definitions: &'a Definitions,
3332
cstore: &'a dyn CrateStore,
3433
pub(super) body_resolver: BodyResolver<'a>,
@@ -78,7 +77,6 @@ impl<'a> StableHashingContext<'a> {
7877
!always_ignore_spans && !sess.opts.debugging_opts.incremental_ignore_spans;
7978

8079
StableHashingContext {
81-
sess,
8280
body_resolver: BodyResolver(krate),
8381
definitions,
8482
cstore,

compiler/rustc_mir_build/src/build/matches/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -900,10 +900,7 @@ fn traverse_candidate<'pat, 'tcx: 'pat, C, T, I>(
900900
struct Binding<'tcx> {
901901
span: Span,
902902
source: Place<'tcx>,
903-
name: Symbol,
904903
var_id: HirId,
905-
var_ty: Ty<'tcx>,
906-
mutability: Mutability,
907904
binding_mode: BindingMode,
908905
}
909906

compiler/rustc_mir_build/src/build/matches/simplify.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,17 +176,22 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
176176
Ok(())
177177
}
178178

179-
PatKind::Binding { name, mutability, mode, var, ty, ref subpattern, is_primary: _ } => {
179+
PatKind::Binding {
180+
name: _,
181+
mutability: _,
182+
mode,
183+
var,
184+
ty: _,
185+
ref subpattern,
186+
is_primary: _,
187+
} => {
180188
if let Ok(place_resolved) =
181189
match_pair.place.clone().try_upvars_resolved(self.tcx, self.typeck_results)
182190
{
183191
candidate.bindings.push(Binding {
184-
name,
185-
mutability,
186192
span: match_pair.pattern.span,
187193
source: place_resolved.into_place(self.tcx, self.typeck_results),
188194
var_id: var,
189-
var_ty: ty,
190195
binding_mode: mode,
191196
});
192197
}

compiler/rustc_mir_build/src/build/scope.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ struct Scope {
118118
/// the region span of this scope within source code.
119119
region_scope: region::Scope,
120120

121-
/// the span of that region_scope
122-
region_scope_span: Span,
123-
124121
/// set of places to drop when exiting this scope. This starts
125122
/// out empty but grows as variables are declared during the
126123
/// building process. This is a stack, so we always drop from the
@@ -420,7 +417,6 @@ impl<'tcx> Scopes<'tcx> {
420417
self.scopes.push(Scope {
421418
source_scope: vis_scope,
422419
region_scope: region_scope.0,
423-
region_scope_span: region_scope.1.span,
424420
drops: vec![],
425421
moved_locals: vec![],
426422
cached_unwind_block: None,

0 commit comments

Comments
 (0)