Skip to content

Commit ccd99b3

Browse files
committed
Remove unused fields in some structures
The dead_code lint was previously eroneously missing those. Since this lint bug has been fixed, the unused fields need to be removed.
1 parent a0fe413 commit ccd99b3

File tree

10 files changed

+16
-34
lines changed

10 files changed

+16
-34
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
20652065
from_closure: constraint.from_closure,
20662066
cause: ObligationCause::new(constraint.span, CRATE_DEF_ID, cause_code.clone()),
20672067
variance_info: constraint.variance_info,
2068-
outlives_constraint: *constraint,
20692068
})
20702069
.collect();
20712070
debug!("categorized_path={:#?}", categorized_path);
@@ -2294,5 +2293,4 @@ pub struct BlameConstraint<'tcx> {
22942293
pub from_closure: bool,
22952294
pub cause: ObligationCause<'tcx>,
22962295
pub variance_info: ty::VarianceDiagInfo<'tcx>,
2297-
pub outlives_constraint: OutlivesConstraint<'tcx>,
22982296
}

compiler/rustc_builtin_macros/src/deriving/debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
5252

5353
let (ident, vdata, fields) = match substr.fields {
5454
Struct(vdata, fields) => (substr.type_ident, *vdata, fields),
55-
EnumMatching(_, _, v, fields) => (v.ident, &v.data, fields),
55+
EnumMatching(_, v, fields) => (v.ident, &v.data, fields),
5656
AllFieldlessEnum(enum_def) => return show_fieldless_enum(cx, span, enum_def, substr),
5757
EnumTag(..) | StaticStruct(..) | StaticEnum(..) => {
5858
cx.dcx().span_bug(span, "nonsensical .fields in `#[derive(Debug)]`")

compiler/rustc_builtin_macros/src/deriving/encodable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ fn encodable_substructure(
226226
BlockOrExpr::new_expr(expr)
227227
}
228228

229-
EnumMatching(idx, _, variant, fields) => {
229+
EnumMatching(idx, variant, fields) => {
230230
// We're not generating an AST that the borrow checker is expecting,
231231
// so we need to generate a unique local variable to take the
232232
// mutable loan out on, otherwise we get conflicts which don't

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,10 @@ pub enum SubstructureFields<'a> {
310310
/// variants has any fields).
311311
AllFieldlessEnum(&'a ast::EnumDef),
312312

313-
/// Matching variants of the enum: variant index, variant count, ast::Variant,
313+
/// Matching variants of the enum: variant index, ast::Variant,
314314
/// fields: the field name is only non-`None` in the case of a struct
315315
/// variant.
316-
EnumMatching(usize, usize, &'a ast::Variant, Vec<FieldInfo>),
316+
EnumMatching(usize, &'a ast::Variant, Vec<FieldInfo>),
317317

318318
/// The tag of an enum. The first field is a `FieldInfo` for the tags, as
319319
/// if they were fields. The second field is the expression to combine the
@@ -1272,7 +1272,7 @@ impl<'a> MethodDef<'a> {
12721272
trait_,
12731273
type_ident,
12741274
nonselflike_args,
1275-
&EnumMatching(0, 1, &variants[0], Vec::new()),
1275+
&EnumMatching(0, &variants[0], Vec::new()),
12761276
);
12771277
}
12781278
}
@@ -1318,7 +1318,7 @@ impl<'a> MethodDef<'a> {
13181318
// expressions for referencing every field of every
13191319
// Self arg, assuming all are instances of VariantK.
13201320
// Build up code associated with such a case.
1321-
let substructure = EnumMatching(index, variants.len(), variant, fields);
1321+
let substructure = EnumMatching(index, variant, fields);
13221322
let arm_expr = self
13231323
.call_substructure_method(
13241324
cx,
@@ -1346,7 +1346,7 @@ impl<'a> MethodDef<'a> {
13461346
trait_,
13471347
type_ident,
13481348
nonselflike_args,
1349-
&EnumMatching(0, variants.len(), v, Vec::new()),
1349+
&EnumMatching(0, v, Vec::new()),
13501350
)
13511351
.into_expr(cx, span),
13521352
)

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ use rustc_session::config::{CrateType, DebugInfo, PAuthKey, PacRet};
2727
use rustc_session::Session;
2828
use rustc_span::source_map::Spanned;
2929
use rustc_span::Span;
30-
use rustc_target::abi::{
31-
call::FnAbi, HasDataLayout, PointeeInfo, Size, TargetDataLayout, VariantIdx,
32-
};
30+
use rustc_target::abi::{call::FnAbi, HasDataLayout, TargetDataLayout, VariantIdx};
3331
use rustc_target::spec::{HasTargetSpec, RelocModel, Target, TlsModel};
3432
use smallvec::SmallVec;
3533

@@ -83,7 +81,6 @@ pub struct CodegenCx<'ll, 'tcx> {
8381
/// Mapping of scalar types to llvm types.
8482
pub scalar_lltypes: RefCell<FxHashMap<Ty<'tcx>, &'ll Type>>,
8583

86-
pub pointee_infos: RefCell<FxHashMap<(Ty<'tcx>, Size), Option<PointeeInfo>>>,
8784
pub isize_ty: &'ll Type,
8885

8986
pub coverage_cx: Option<coverageinfo::CrateCoverageContext<'ll, 'tcx>>,
@@ -460,7 +457,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
460457
compiler_used_statics: RefCell::new(Vec::new()),
461458
type_lowering: Default::default(),
462459
scalar_lltypes: Default::default(),
463-
pointee_infos: Default::default(),
464460
isize_ty,
465461
coverage_cx,
466462
dbg_cx,

compiler/rustc_mir_transform/src/gvn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
131131
|local, value, location| {
132132
let value = match value {
133133
// We do not know anything of this assigned value.
134-
AssignedValue::Arg | AssignedValue::Terminator(_) => None,
134+
AssignedValue::Arg | AssignedValue::Terminator => None,
135135
// Try to get some insight.
136136
AssignedValue::Rvalue(rvalue) => {
137137
let value = state.simplify_rvalue(rvalue, location);

compiler/rustc_mir_transform/src/ssa.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub struct SsaLocals {
2929
pub enum AssignedValue<'a, 'tcx> {
3030
Arg,
3131
Rvalue(&'a mut Rvalue<'tcx>),
32-
Terminator(&'a mut TerminatorKind<'tcx>),
32+
Terminator,
3333
}
3434

3535
impl SsaLocals {
@@ -149,8 +149,7 @@ impl SsaLocals {
149149
Set1::One(DefLocation::CallReturn { call, .. }) => {
150150
let bb = &mut basic_blocks[call];
151151
let loc = Location { block: call, statement_index: bb.statements.len() };
152-
let term = bb.terminator_mut();
153-
f(local, AssignedValue::Terminator(&mut term.kind), loc)
152+
f(local, AssignedValue::Terminator, loc)
154153
}
155154
_ => {}
156155
}

library/alloc/src/collections/btree/navigate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ impl<BorrowType: marker::BorrowType, K, V> NodeRef<BorrowType, K, V, marker::Lea
655655
pub enum Position<BorrowType, K, V> {
656656
Leaf(NodeRef<BorrowType, K, V, marker::Leaf>),
657657
Internal(NodeRef<BorrowType, K, V, marker::Internal>),
658-
InternalKV(Handle<NodeRef<BorrowType, K, V, marker::Internal>, marker::KV>),
658+
InternalKV,
659659
}
660660

661661
impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal> {
@@ -677,7 +677,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
677677
visit(Position::Leaf(leaf));
678678
match edge.next_kv() {
679679
Ok(kv) => {
680-
visit(Position::InternalKV(kv));
680+
visit(Position::InternalKV);
681681
kv.right_edge()
682682
}
683683
Err(_) => return,
@@ -699,7 +699,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
699699
self.visit_nodes_in_order(|pos| match pos {
700700
Position::Leaf(node) => result += node.len(),
701701
Position::Internal(node) => result += node.len(),
702-
Position::InternalKV(_) => (),
702+
Position::InternalKV => (),
703703
});
704704
result
705705
}

library/alloc/src/collections/btree/node/tests.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
3232
result += &format!("\n{}{:?}", indent, leaf.keys());
3333
}
3434
navigate::Position::Internal(_) => {}
35-
navigate::Position::InternalKV(kv) => {
36-
let depth = self.height() - kv.into_node().height();
37-
let indent = " ".repeat(depth);
38-
result += &format!("\n{}{:?}", indent, kv.into_kv().0);
39-
}
35+
navigate::Position::InternalKV => {}
4036
});
4137
result
4238
}

library/test/src/console.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ pub struct ConsoleTestDiscoveryState {
4646
pub tests: usize,
4747
pub benchmarks: usize,
4848
pub ignored: usize,
49-
pub options: Options,
5049
}
5150

5251
impl ConsoleTestDiscoveryState {
@@ -56,13 +55,7 @@ impl ConsoleTestDiscoveryState {
5655
None => None,
5756
};
5857

59-
Ok(ConsoleTestDiscoveryState {
60-
log_out,
61-
tests: 0,
62-
benchmarks: 0,
63-
ignored: 0,
64-
options: opts.options,
65-
})
58+
Ok(ConsoleTestDiscoveryState { log_out, tests: 0, benchmarks: 0, ignored: 0 })
6659
}
6760

6861
pub fn write_log<F, S>(&mut self, msg: F) -> io::Result<()>

0 commit comments

Comments
 (0)