Skip to content

Commit 74a20b0

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 7f47e66 commit 74a20b0

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
@@ -2098,7 +2098,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
20982098
from_closure: constraint.from_closure,
20992099
cause: ObligationCause::new(constraint.span, CRATE_DEF_ID, cause_code.clone()),
21002100
variance_info: constraint.variance_info,
2101-
outlives_constraint: *constraint,
21022101
})
21032102
.collect();
21042103
debug!("categorized_path={:#?}", categorized_path);
@@ -2327,5 +2326,4 @@ pub struct BlameConstraint<'tcx> {
23272326
pub from_closure: bool,
23282327
pub cause: ObligationCause<'tcx>,
23292328
pub variance_info: ty::VarianceDiagInfo<'tcx>,
2330-
pub outlives_constraint: OutlivesConstraint<'tcx>,
23312329
}

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
@@ -304,10 +304,10 @@ pub enum SubstructureFields<'a> {
304304
/// variants has any fields).
305305
AllFieldlessEnum(&'a ast::EnumDef),
306306

307-
/// Matching variants of the enum: variant index, variant count, ast::Variant,
307+
/// Matching variants of the enum: variant index, ast::Variant,
308308
/// fields: the field name is only non-`None` in the case of a struct
309309
/// variant.
310-
EnumMatching(usize, usize, &'a ast::Variant, Vec<FieldInfo>),
310+
EnumMatching(usize, &'a ast::Variant, Vec<FieldInfo>),
311311

312312
/// The tag of an enum. The first field is a `FieldInfo` for the tags, as
313313
/// if they were fields. The second field is the expression to combine the
@@ -1270,7 +1270,7 @@ impl<'a> MethodDef<'a> {
12701270
trait_,
12711271
type_ident,
12721272
nonselflike_args,
1273-
&EnumMatching(0, 1, &variants[0], Vec::new()),
1273+
&EnumMatching(0, &variants[0], Vec::new()),
12741274
);
12751275
}
12761276
}
@@ -1316,7 +1316,7 @@ impl<'a> MethodDef<'a> {
13161316
// expressions for referencing every field of every
13171317
// Self arg, assuming all are instances of VariantK.
13181318
// Build up code associated with such a case.
1319-
let substructure = EnumMatching(index, variants.len(), variant, fields);
1319+
let substructure = EnumMatching(index, variant, fields);
13201320
let arm_expr = self
13211321
.call_substructure_method(
13221322
cx,
@@ -1344,7 +1344,7 @@ impl<'a> MethodDef<'a> {
13441344
trait_,
13451345
type_ident,
13461346
nonselflike_args,
1347-
&EnumMatching(0, variants.len(), v, Vec::new()),
1347+
&EnumMatching(0, v, Vec::new()),
13481348
)
13491349
.into_expr(cx, span),
13501350
)

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

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

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

8885
pub coverage_cx: Option<coverageinfo::CrateCoverageContext<'ll, 'tcx>>,
@@ -487,7 +484,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
487484
compiler_used_statics: RefCell::new(Vec::new()),
488485
type_lowering: Default::default(),
489486
scalar_lltypes: Default::default(),
490-
pointee_infos: Default::default(),
491487
isize_ty,
492488
coverage_cx,
493489
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 {
@@ -148,8 +148,7 @@ impl SsaLocals {
148148
Set1::One(DefLocation::CallReturn { call, .. }) => {
149149
let bb = &mut basic_blocks[call];
150150
let loc = Location { block: call, statement_index: bb.statements.len() };
151-
let term = bb.terminator_mut();
152-
f(local, AssignedValue::Terminator(&mut term.kind), loc)
151+
f(local, AssignedValue::Terminator, loc)
153152
}
154153
_ => {}
155154
}

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)