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.
This commit is contained in:
parent
a0fe4138ed
commit
ccd99b384e
10 changed files with 16 additions and 34 deletions
|
@ -2065,7 +2065,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
from_closure: constraint.from_closure,
|
from_closure: constraint.from_closure,
|
||||||
cause: ObligationCause::new(constraint.span, CRATE_DEF_ID, cause_code.clone()),
|
cause: ObligationCause::new(constraint.span, CRATE_DEF_ID, cause_code.clone()),
|
||||||
variance_info: constraint.variance_info,
|
variance_info: constraint.variance_info,
|
||||||
outlives_constraint: *constraint,
|
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
debug!("categorized_path={:#?}", categorized_path);
|
debug!("categorized_path={:#?}", categorized_path);
|
||||||
|
@ -2294,5 +2293,4 @@ pub struct BlameConstraint<'tcx> {
|
||||||
pub from_closure: bool,
|
pub from_closure: bool,
|
||||||
pub cause: ObligationCause<'tcx>,
|
pub cause: ObligationCause<'tcx>,
|
||||||
pub variance_info: ty::VarianceDiagInfo<'tcx>,
|
pub variance_info: ty::VarianceDiagInfo<'tcx>,
|
||||||
pub outlives_constraint: OutlivesConstraint<'tcx>,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
|
||||||
|
|
||||||
let (ident, vdata, fields) = match substr.fields {
|
let (ident, vdata, fields) = match substr.fields {
|
||||||
Struct(vdata, fields) => (substr.type_ident, *vdata, fields),
|
Struct(vdata, fields) => (substr.type_ident, *vdata, fields),
|
||||||
EnumMatching(_, _, v, fields) => (v.ident, &v.data, fields),
|
EnumMatching(_, v, fields) => (v.ident, &v.data, fields),
|
||||||
AllFieldlessEnum(enum_def) => return show_fieldless_enum(cx, span, enum_def, substr),
|
AllFieldlessEnum(enum_def) => return show_fieldless_enum(cx, span, enum_def, substr),
|
||||||
EnumTag(..) | StaticStruct(..) | StaticEnum(..) => {
|
EnumTag(..) | StaticStruct(..) | StaticEnum(..) => {
|
||||||
cx.dcx().span_bug(span, "nonsensical .fields in `#[derive(Debug)]`")
|
cx.dcx().span_bug(span, "nonsensical .fields in `#[derive(Debug)]`")
|
||||||
|
|
|
@ -226,7 +226,7 @@ fn encodable_substructure(
|
||||||
BlockOrExpr::new_expr(expr)
|
BlockOrExpr::new_expr(expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumMatching(idx, _, variant, fields) => {
|
EnumMatching(idx, variant, fields) => {
|
||||||
// We're not generating an AST that the borrow checker is expecting,
|
// We're not generating an AST that the borrow checker is expecting,
|
||||||
// so we need to generate a unique local variable to take the
|
// so we need to generate a unique local variable to take the
|
||||||
// mutable loan out on, otherwise we get conflicts which don't
|
// mutable loan out on, otherwise we get conflicts which don't
|
||||||
|
|
|
@ -310,10 +310,10 @@ pub enum SubstructureFields<'a> {
|
||||||
/// variants has any fields).
|
/// variants has any fields).
|
||||||
AllFieldlessEnum(&'a ast::EnumDef),
|
AllFieldlessEnum(&'a ast::EnumDef),
|
||||||
|
|
||||||
/// Matching variants of the enum: variant index, variant count, ast::Variant,
|
/// Matching variants of the enum: variant index, ast::Variant,
|
||||||
/// fields: the field name is only non-`None` in the case of a struct
|
/// fields: the field name is only non-`None` in the case of a struct
|
||||||
/// variant.
|
/// variant.
|
||||||
EnumMatching(usize, usize, &'a ast::Variant, Vec<FieldInfo>),
|
EnumMatching(usize, &'a ast::Variant, Vec<FieldInfo>),
|
||||||
|
|
||||||
/// The tag of an enum. The first field is a `FieldInfo` for the tags, as
|
/// The tag of an enum. The first field is a `FieldInfo` for the tags, as
|
||||||
/// if they were fields. The second field is the expression to combine the
|
/// if they were fields. The second field is the expression to combine the
|
||||||
|
@ -1272,7 +1272,7 @@ impl<'a> MethodDef<'a> {
|
||||||
trait_,
|
trait_,
|
||||||
type_ident,
|
type_ident,
|
||||||
nonselflike_args,
|
nonselflike_args,
|
||||||
&EnumMatching(0, 1, &variants[0], Vec::new()),
|
&EnumMatching(0, &variants[0], Vec::new()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1318,7 +1318,7 @@ impl<'a> MethodDef<'a> {
|
||||||
// expressions for referencing every field of every
|
// expressions for referencing every field of every
|
||||||
// Self arg, assuming all are instances of VariantK.
|
// Self arg, assuming all are instances of VariantK.
|
||||||
// Build up code associated with such a case.
|
// Build up code associated with such a case.
|
||||||
let substructure = EnumMatching(index, variants.len(), variant, fields);
|
let substructure = EnumMatching(index, variant, fields);
|
||||||
let arm_expr = self
|
let arm_expr = self
|
||||||
.call_substructure_method(
|
.call_substructure_method(
|
||||||
cx,
|
cx,
|
||||||
|
@ -1346,7 +1346,7 @@ impl<'a> MethodDef<'a> {
|
||||||
trait_,
|
trait_,
|
||||||
type_ident,
|
type_ident,
|
||||||
nonselflike_args,
|
nonselflike_args,
|
||||||
&EnumMatching(0, variants.len(), v, Vec::new()),
|
&EnumMatching(0, v, Vec::new()),
|
||||||
)
|
)
|
||||||
.into_expr(cx, span),
|
.into_expr(cx, span),
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,9 +27,7 @@ use rustc_session::config::{CrateType, DebugInfo, PAuthKey, PacRet};
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use rustc_span::source_map::Spanned;
|
use rustc_span::source_map::Spanned;
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use rustc_target::abi::{
|
use rustc_target::abi::{call::FnAbi, HasDataLayout, TargetDataLayout, VariantIdx};
|
||||||
call::FnAbi, HasDataLayout, PointeeInfo, Size, TargetDataLayout, VariantIdx,
|
|
||||||
};
|
|
||||||
use rustc_target::spec::{HasTargetSpec, RelocModel, Target, TlsModel};
|
use rustc_target::spec::{HasTargetSpec, RelocModel, Target, TlsModel};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
|
@ -83,7 +81,6 @@ pub struct CodegenCx<'ll, 'tcx> {
|
||||||
/// Mapping of scalar types to llvm types.
|
/// Mapping of scalar types to llvm types.
|
||||||
pub scalar_lltypes: RefCell<FxHashMap<Ty<'tcx>, &'ll Type>>,
|
pub scalar_lltypes: RefCell<FxHashMap<Ty<'tcx>, &'ll Type>>,
|
||||||
|
|
||||||
pub pointee_infos: RefCell<FxHashMap<(Ty<'tcx>, Size), Option<PointeeInfo>>>,
|
|
||||||
pub isize_ty: &'ll Type,
|
pub isize_ty: &'ll Type,
|
||||||
|
|
||||||
pub coverage_cx: Option<coverageinfo::CrateCoverageContext<'ll, 'tcx>>,
|
pub coverage_cx: Option<coverageinfo::CrateCoverageContext<'ll, 'tcx>>,
|
||||||
|
@ -460,7 +457,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
|
||||||
compiler_used_statics: RefCell::new(Vec::new()),
|
compiler_used_statics: RefCell::new(Vec::new()),
|
||||||
type_lowering: Default::default(),
|
type_lowering: Default::default(),
|
||||||
scalar_lltypes: Default::default(),
|
scalar_lltypes: Default::default(),
|
||||||
pointee_infos: Default::default(),
|
|
||||||
isize_ty,
|
isize_ty,
|
||||||
coverage_cx,
|
coverage_cx,
|
||||||
dbg_cx,
|
dbg_cx,
|
||||||
|
|
|
@ -131,7 +131,7 @@ fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
|local, value, location| {
|
|local, value, location| {
|
||||||
let value = match value {
|
let value = match value {
|
||||||
// We do not know anything of this assigned value.
|
// We do not know anything of this assigned value.
|
||||||
AssignedValue::Arg | AssignedValue::Terminator(_) => None,
|
AssignedValue::Arg | AssignedValue::Terminator => None,
|
||||||
// Try to get some insight.
|
// Try to get some insight.
|
||||||
AssignedValue::Rvalue(rvalue) => {
|
AssignedValue::Rvalue(rvalue) => {
|
||||||
let value = state.simplify_rvalue(rvalue, location);
|
let value = state.simplify_rvalue(rvalue, location);
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub struct SsaLocals {
|
||||||
pub enum AssignedValue<'a, 'tcx> {
|
pub enum AssignedValue<'a, 'tcx> {
|
||||||
Arg,
|
Arg,
|
||||||
Rvalue(&'a mut Rvalue<'tcx>),
|
Rvalue(&'a mut Rvalue<'tcx>),
|
||||||
Terminator(&'a mut TerminatorKind<'tcx>),
|
Terminator,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SsaLocals {
|
impl SsaLocals {
|
||||||
|
@ -149,8 +149,7 @@ impl SsaLocals {
|
||||||
Set1::One(DefLocation::CallReturn { call, .. }) => {
|
Set1::One(DefLocation::CallReturn { call, .. }) => {
|
||||||
let bb = &mut basic_blocks[call];
|
let bb = &mut basic_blocks[call];
|
||||||
let loc = Location { block: call, statement_index: bb.statements.len() };
|
let loc = Location { block: call, statement_index: bb.statements.len() };
|
||||||
let term = bb.terminator_mut();
|
f(local, AssignedValue::Terminator, loc)
|
||||||
f(local, AssignedValue::Terminator(&mut term.kind), loc)
|
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -655,7 +655,7 @@ impl<BorrowType: marker::BorrowType, K, V> NodeRef<BorrowType, K, V, marker::Lea
|
||||||
pub enum Position<BorrowType, K, V> {
|
pub enum Position<BorrowType, K, V> {
|
||||||
Leaf(NodeRef<BorrowType, K, V, marker::Leaf>),
|
Leaf(NodeRef<BorrowType, K, V, marker::Leaf>),
|
||||||
Internal(NodeRef<BorrowType, K, V, marker::Internal>),
|
Internal(NodeRef<BorrowType, K, V, marker::Internal>),
|
||||||
InternalKV(Handle<NodeRef<BorrowType, K, V, marker::Internal>, marker::KV>),
|
InternalKV,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal> {
|
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>
|
||||||
visit(Position::Leaf(leaf));
|
visit(Position::Leaf(leaf));
|
||||||
match edge.next_kv() {
|
match edge.next_kv() {
|
||||||
Ok(kv) => {
|
Ok(kv) => {
|
||||||
visit(Position::InternalKV(kv));
|
visit(Position::InternalKV);
|
||||||
kv.right_edge()
|
kv.right_edge()
|
||||||
}
|
}
|
||||||
Err(_) => return,
|
Err(_) => return,
|
||||||
|
@ -699,7 +699,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
|
||||||
self.visit_nodes_in_order(|pos| match pos {
|
self.visit_nodes_in_order(|pos| match pos {
|
||||||
Position::Leaf(node) => result += node.len(),
|
Position::Leaf(node) => result += node.len(),
|
||||||
Position::Internal(node) => result += node.len(),
|
Position::Internal(node) => result += node.len(),
|
||||||
Position::InternalKV(_) => (),
|
Position::InternalKV => (),
|
||||||
});
|
});
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
|
||||||
result += &format!("\n{}{:?}", indent, leaf.keys());
|
result += &format!("\n{}{:?}", indent, leaf.keys());
|
||||||
}
|
}
|
||||||
navigate::Position::Internal(_) => {}
|
navigate::Position::Internal(_) => {}
|
||||||
navigate::Position::InternalKV(kv) => {
|
navigate::Position::InternalKV => {}
|
||||||
let depth = self.height() - kv.into_node().height();
|
|
||||||
let indent = " ".repeat(depth);
|
|
||||||
result += &format!("\n{}{:?}", indent, kv.into_kv().0);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@ pub struct ConsoleTestDiscoveryState {
|
||||||
pub tests: usize,
|
pub tests: usize,
|
||||||
pub benchmarks: usize,
|
pub benchmarks: usize,
|
||||||
pub ignored: usize,
|
pub ignored: usize,
|
||||||
pub options: Options,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConsoleTestDiscoveryState {
|
impl ConsoleTestDiscoveryState {
|
||||||
|
@ -56,13 +55,7 @@ impl ConsoleTestDiscoveryState {
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(ConsoleTestDiscoveryState {
|
Ok(ConsoleTestDiscoveryState { log_out, tests: 0, benchmarks: 0, ignored: 0 })
|
||||||
log_out,
|
|
||||||
tests: 0,
|
|
||||||
benchmarks: 0,
|
|
||||||
ignored: 0,
|
|
||||||
options: opts.options,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_log<F, S>(&mut self, msg: F) -> io::Result<()>
|
pub fn write_log<F, S>(&mut self, msg: F) -> io::Result<()>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue