Auto merge of #87781 - est31:remove_box, r=oli-obk

Remove box syntax from compiler and tools

Removes box syntax from the compiler and tools. In #49733, the future of box syntax is uncertain and the use in the compiler was listed as one of the reasons to keep it. Removal of box syntax [might affect the code generated](https://github.com/rust-lang/rust/pull/49646#issuecomment-379219615) and slow down the compiler so I'd recommend doing a perf run on this.
This commit is contained in:
bors 2021-08-18 10:43:27 +00:00
commit ba8cda2fa2
72 changed files with 549 additions and 505 deletions

View file

@ -8,7 +8,6 @@
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
test(attr(deny(warnings)))
)]
#![feature(box_syntax)]
#![feature(box_patterns)]
#![cfg_attr(bootstrap, feature(const_fn_transmute))]
#![feature(crate_visibility_modifier)]

View file

@ -37,7 +37,7 @@ pub struct P<T: ?Sized> {
/// Construct a `P<T>` from a `T` value.
#[allow(non_snake_case)]
pub fn P<T: 'static>(value: T) -> P<T> {
P { ptr: box value }
P { ptr: Box::new(value) }
}
impl<T: 'static> P<T> {

View file

@ -527,12 +527,12 @@ impl<'a> TraitDef<'a> {
tokens: None,
},
attrs: Vec::new(),
kind: ast::AssocItemKind::TyAlias(box ast::TyAliasKind(
kind: ast::AssocItemKind::TyAlias(Box::new(ast::TyAliasKind(
ast::Defaultness::Final,
Generics::default(),
Vec::new(),
Some(type_def.to_ty(cx, self.span, type_ident, generics)),
)),
))),
tokens: None,
})
});
@ -698,7 +698,7 @@ impl<'a> TraitDef<'a> {
self.span,
Ident::invalid(),
a,
ast::ItemKind::Impl(box ast::ImplKind {
ast::ItemKind::Impl(Box::new(ast::ImplKind {
unsafety,
polarity: ast::ImplPolarity::Positive,
defaultness: ast::Defaultness::Final,
@ -707,7 +707,7 @@ impl<'a> TraitDef<'a> {
of_trait: opt_trait_ref,
self_ty: self_type,
items: methods.into_iter().chain(associated_types).collect(),
}),
})),
)
}
@ -940,7 +940,12 @@ impl<'a> MethodDef<'a> {
tokens: None,
},
ident: method_ident,
kind: ast::AssocItemKind::Fn(box ast::FnKind(def, sig, fn_generics, Some(body_block))),
kind: ast::AssocItemKind::Fn(Box::new(ast::FnKind(
def,
sig,
fn_generics,
Some(body_block),
))),
tokens: None,
})
}

View file

@ -179,7 +179,7 @@ fn inject_impl_of_structural_trait(
span,
Ident::invalid(),
attrs,
ItemKind::Impl(box ImplKind {
ItemKind::Impl(Box::new(ImplKind {
unsafety: ast::Unsafe::No,
polarity: ast::ImplPolarity::Positive,
defaultness: ast::Defaultness::Final,
@ -188,7 +188,7 @@ fn inject_impl_of_structural_trait(
of_trait: Some(trait_ref),
self_ty: self_type,
items: Vec::new(),
}),
})),
);
push(Annotatable::Item(newitem));

View file

@ -85,8 +85,12 @@ impl AllocFnFactory<'_, '_> {
let header = FnHeader { unsafety: Unsafe::Yes(self.span), ..FnHeader::default() };
let sig = FnSig { decl, header, span: self.span };
let block = Some(self.cx.block_expr(output_expr));
let kind =
ItemKind::Fn(box FnKind(ast::Defaultness::Final, sig, Generics::default(), block));
let kind = ItemKind::Fn(Box::new(FnKind(
ast::Defaultness::Final,
sig,
Generics::default(),
block,
)));
let item = self.cx.item(
self.span,
Ident::from_str_and_span(&self.kind.fn_name(method.name), self.span),

View file

@ -3,7 +3,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(bool_to_option)]
#![feature(crate_visibility_modifier)]
#![feature(decl_macro)]

View file

@ -315,8 +315,12 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
let decl = ecx.fn_decl(vec![], ast::FnRetTy::Ty(main_ret_ty));
let sig = ast::FnSig { decl, header: ast::FnHeader::default(), span: sp };
let def = ast::Defaultness::Final;
let main =
ast::ItemKind::Fn(box ast::FnKind(def, sig, ast::Generics::default(), Some(main_body)));
let main = ast::ItemKind::Fn(Box::new(ast::FnKind(
def,
sig,
ast::Generics::default(),
Some(main_body),
)));
// Honor the reexport_test_harness_main attribute
let main_id = match cx.reexport_test_harness_main {

View file

@ -1,4 +1,4 @@
#![feature(start, box_syntax, core_intrinsics, alloc_prelude, alloc_error_handler)]
#![feature(start, core_intrinsics, alloc_prelude, alloc_error_handler)]
#![no_std]
extern crate alloc;

View file

@ -1,4 +1,4 @@
#![feature(no_core, lang_items, box_syntax, never_type, linkage, extern_types, thread_local)]
#![feature(no_core, lang_items, never_type, linkage, extern_types, thread_local)]
#![no_core]
#![allow(dead_code, non_camel_case_types)]

View file

@ -1,4 +1,4 @@
#![feature(start, box_syntax, core_intrinsics, lang_items)]
#![feature(start, core_intrinsics, lang_items)]
#![no_std]
#[cfg_attr(unix, link(name = "c"))]

View file

@ -105,7 +105,7 @@ impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
b: ty::Region<'tcx>,
) -> RelateResult<'tcx, ty::Region<'tcx>> {
debug!("{}.regions({:?}, {:?})", self.tag(), a, b);
let origin = Subtype(box self.fields.trace.clone());
let origin = Subtype(Box::new(self.fields.trace.clone()));
self.fields
.infcx
.inner

View file

@ -67,7 +67,7 @@ impl TypeRelation<'tcx> for Glb<'combine, 'infcx, 'tcx> {
) -> RelateResult<'tcx, ty::Region<'tcx>> {
debug!("{}.regions({:?}, {:?})", self.tag(), a, b);
let origin = Subtype(box self.fields.trace.clone());
let origin = Subtype(Box::new(self.fields.trace.clone()));
Ok(self.fields.infcx.inner.borrow_mut().unwrap_region_constraints().glb_regions(
self.tcx(),
origin,

View file

@ -67,7 +67,7 @@ impl TypeRelation<'tcx> for Lub<'combine, 'infcx, 'tcx> {
) -> RelateResult<'tcx, ty::Region<'tcx>> {
debug!("{}.regions({:?}, {:?})", self.tag(), a, b);
let origin = Subtype(box self.fields.trace.clone());
let origin = Subtype(Box::new(self.fields.trace.clone()));
Ok(self.fields.infcx.inner.borrow_mut().unwrap_region_constraints().lub_regions(
self.tcx(),
origin,

View file

@ -142,7 +142,7 @@ impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
// FIXME -- we have more fine-grained information available
// from the "cause" field, we could perhaps give more tailored
// error messages.
let origin = SubregionOrigin::Subtype(box self.fields.trace.clone());
let origin = SubregionOrigin::Subtype(Box::new(self.fields.trace.clone()));
self.fields
.infcx
.inner

View file

@ -15,7 +15,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(extend_one)]
#![feature(iter_zip)]
#![feature(never_type)]

View file

@ -29,7 +29,6 @@
#![cfg_attr(test, feature(test))]
#![feature(array_windows)]
#![feature(bool_to_option)]
#![feature(box_syntax)]
#![feature(box_patterns)]
#![feature(crate_visibility_modifier)]
#![feature(format_args_capture)]
@ -246,7 +245,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
macro_rules! register_pass {
($method:ident, $ty:ident, $constructor:expr) => {
store.register_lints(&$ty::get_lints());
store.$method(|| box $constructor);
store.$method(|| Box::new($constructor));
};
}
@ -478,13 +477,13 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
fn register_internals(store: &mut LintStore) {
store.register_lints(&LintPassImpl::get_lints());
store.register_early_pass(|| box LintPassImpl);
store.register_early_pass(|| Box::new(LintPassImpl));
store.register_lints(&DefaultHashTypes::get_lints());
store.register_late_pass(|| box DefaultHashTypes);
store.register_late_pass(|| Box::new(DefaultHashTypes));
store.register_lints(&ExistingDocKeyword::get_lints());
store.register_late_pass(|| box ExistingDocKeyword);
store.register_late_pass(|| Box::new(ExistingDocKeyword));
store.register_lints(&TyTyKind::get_lints());
store.register_late_pass(|| box TyTyKind);
store.register_late_pass(|| Box::new(TyTyKind));
store.register_group(
false,
"rustc::internal",

View file

@ -29,7 +29,6 @@
#![feature(backtrace)]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(core_intrinsics)]
#![feature(discriminant_kind)]
#![feature(never_type)]

View file

@ -2061,11 +2061,11 @@ impl<'tcx> Operand<'tcx> {
span: Span,
) -> Self {
let ty = tcx.type_of(def_id).subst(tcx, substs);
Operand::Constant(box Constant {
Operand::Constant(Box::new(Constant {
span,
user_ty: None,
literal: ConstantKind::Ty(ty::Const::zero_sized(tcx, ty)),
})
}))
}
pub fn is_move(&self) -> bool {
@ -2092,11 +2092,11 @@ impl<'tcx> Operand<'tcx> {
};
scalar_size == type_size
});
Operand::Constant(box Constant {
Operand::Constant(Box::new(Constant {
span,
user_ty: None,
literal: ConstantKind::Val(ConstValue::Scalar(val), ty),
})
}))
}
pub fn to_copy(&self) -> Self {

View file

@ -182,10 +182,10 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
Len(place) => Len(place.fold_with(folder)),
Cast(kind, op, ty) => Cast(kind, op.fold_with(folder), ty.fold_with(folder)),
BinaryOp(op, box (rhs, lhs)) => {
BinaryOp(op, box (rhs.fold_with(folder), lhs.fold_with(folder)))
BinaryOp(op, Box::new((rhs.fold_with(folder), lhs.fold_with(folder))))
}
CheckedBinaryOp(op, box (rhs, lhs)) => {
CheckedBinaryOp(op, box (rhs.fold_with(folder), lhs.fold_with(folder)))
CheckedBinaryOp(op, Box::new((rhs.fold_with(folder), lhs.fold_with(folder))))
}
UnaryOp(op, val) => UnaryOp(op, val.fold_with(folder)),
Discriminant(place) => Discriminant(place.fold_with(folder)),

View file

@ -464,12 +464,12 @@ fn do_mir_borrowck<'a, 'tcx>(
let body_with_facts = if return_body_with_facts {
let output_facts = mbcx.polonius_output.expect("Polonius output was not computed");
Some(box BodyWithBorrowckFacts {
Some(Box::new(BodyWithBorrowckFacts {
body: body_owned,
input_facts: *polonius_input.expect("Polonius input facts were not generated"),
output_facts,
location_table: location_table_owned,
})
}))
} else {
None
};

View file

@ -11,7 +11,6 @@ Rust MIR: a lowered representation of Rust.
#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(crate_visibility_modifier)]
#![feature(decl_macro)]
#![feature(exact_size_is_empty)]

View file

@ -174,7 +174,7 @@ fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, ty: Option<Ty<'tcx>>)
0,
Statement {
source_info,
kind: StatementKind::Retag(RetagKind::Raw, box (dropee_ptr)),
kind: StatementKind::Retag(RetagKind::Raw, Box::new(dropee_ptr)),
},
);
}
@ -388,10 +388,10 @@ impl CloneShimBuilder<'tcx> {
fn copy_shim(&mut self) {
let rcvr = self.tcx.mk_place_deref(Place::from(Local::new(1 + 0)));
let ret_statement = self.make_statement(StatementKind::Assign(box (
let ret_statement = self.make_statement(StatementKind::Assign(Box::new((
Place::return_place(),
Rvalue::Use(Operand::Copy(rcvr)),
)));
))));
self.block(vec![ret_statement], TerminatorKind::Return, false);
}
@ -418,11 +418,11 @@ impl CloneShimBuilder<'tcx> {
// `func == Clone::clone(&ty) -> ty`
let func_ty = tcx.mk_fn_def(self.def_id, substs);
let func = Operand::Constant(box Constant {
let func = Operand::Constant(Box::new(Constant {
span: self.span,
user_ty: None,
literal: ty::Const::zero_sized(tcx, func_ty).into(),
});
}));
let ref_loc = self.make_place(
Mutability::Not,
@ -430,10 +430,10 @@ impl CloneShimBuilder<'tcx> {
);
// `let ref_loc: &ty = &src;`
let statement = self.make_statement(StatementKind::Assign(box (
let statement = self.make_statement(StatementKind::Assign(Box::new((
ref_loc,
Rvalue::Ref(tcx.lifetimes.re_erased, BorrowKind::Shared, src),
)));
))));
// `let loc = Clone::clone(ref_loc);`
self.block(
@ -461,10 +461,10 @@ impl CloneShimBuilder<'tcx> {
let tcx = self.tcx;
let cond = self.make_place(Mutability::Mut, tcx.types.bool);
let compute_cond = self.make_statement(StatementKind::Assign(box (
let compute_cond = self.make_statement(StatementKind::Assign(Box::new((
cond,
Rvalue::BinaryOp(BinOp::Ne, box (Operand::Copy(end), Operand::Copy(beg))),
)));
Rvalue::BinaryOp(BinOp::Ne, Box::new((Operand::Copy(end), Operand::Copy(beg)))),
))));
// `if end != beg { goto loop_body; } else { goto loop_end; }`
self.block(
@ -475,11 +475,11 @@ impl CloneShimBuilder<'tcx> {
}
fn make_usize(&self, value: u64) -> Box<Constant<'tcx>> {
box Constant {
Box::new(Constant {
span: self.span,
user_ty: None,
literal: ty::Const::from_usize(self.tcx, value).into(),
}
})
}
fn array_shim(
@ -500,18 +500,18 @@ impl CloneShimBuilder<'tcx> {
// `let end = len;`
// `goto #1;`
let inits = vec![
self.make_statement(StatementKind::Assign(box (
self.make_statement(StatementKind::Assign(Box::new((
Place::from(beg),
Rvalue::Use(Operand::Constant(self.make_usize(0))),
))),
self.make_statement(StatementKind::Assign(box (
)))),
self.make_statement(StatementKind::Assign(Box::new((
end,
Rvalue::Use(Operand::Constant(box Constant {
Rvalue::Use(Operand::Constant(Box::new(Constant {
span: self.span,
user_ty: None,
literal: len.into(),
})),
))),
}))),
)))),
];
self.block(inits, TerminatorKind::Goto { target: BasicBlock::new(1) }, false);
@ -532,13 +532,13 @@ impl CloneShimBuilder<'tcx> {
// BB #3
// `beg = beg + 1;`
// `goto #1`;
let statements = vec![self.make_statement(StatementKind::Assign(box (
let statements = vec![self.make_statement(StatementKind::Assign(Box::new((
Place::from(beg),
Rvalue::BinaryOp(
BinOp::Add,
box (Operand::Copy(Place::from(beg)), Operand::Constant(self.make_usize(1))),
Box::new((Operand::Copy(Place::from(beg)), Operand::Constant(self.make_usize(1)))),
),
)))];
))))];
self.block(statements, TerminatorKind::Goto { target: BasicBlock::new(1) }, false);
// BB #4
@ -551,10 +551,10 @@ impl CloneShimBuilder<'tcx> {
// goto #6;
let end = beg;
let beg = self.local_decls.push(LocalDecl::new(tcx.types.usize, span));
let init = self.make_statement(StatementKind::Assign(box (
let init = self.make_statement(StatementKind::Assign(Box::new((
Place::from(beg),
Rvalue::Use(Operand::Constant(self.make_usize(0))),
)));
))));
self.block(vec![init], TerminatorKind::Goto { target: BasicBlock::new(6) }, true);
// BB #6 (cleanup): loop {
@ -585,13 +585,13 @@ impl CloneShimBuilder<'tcx> {
// BB #8 (cleanup)
// `beg = beg + 1;`
// `goto #6;`
let statement = self.make_statement(StatementKind::Assign(box (
let statement = self.make_statement(StatementKind::Assign(Box::new((
Place::from(beg),
Rvalue::BinaryOp(
BinOp::Add,
box (Operand::Copy(Place::from(beg)), Operand::Constant(self.make_usize(1))),
Box::new((Operand::Copy(Place::from(beg)), Operand::Constant(self.make_usize(1)))),
),
)));
))));
self.block(vec![statement], TerminatorKind::Goto { target: BasicBlock::new(6) }, true);
// BB #9 (resume)
@ -748,10 +748,10 @@ fn build_call_shim<'tcx>(
let borrow_kind = BorrowKind::Mut { allow_two_phase_borrow: false };
statements.push(Statement {
source_info,
kind: StatementKind::Assign(box (
kind: StatementKind::Assign(Box::new((
Place::from(ref_rcvr),
Rvalue::Ref(tcx.lifetimes.re_erased, borrow_kind, rcvr_place()),
)),
))),
});
Operand::Move(Place::from(ref_rcvr))
}
@ -765,11 +765,11 @@ fn build_call_shim<'tcx>(
CallKind::Direct(def_id) => {
let ty = tcx.type_of(def_id);
(
Operand::Constant(box Constant {
Operand::Constant(Box::new(Constant {
span,
user_ty: None,
literal: ty::Const::zero_sized(tcx, ty).into(),
}),
})),
rcvr.into_iter().collect::<Vec<_>>(),
)
}

View file

@ -105,7 +105,7 @@ impl<'tcx> MirPass<'tcx> for AddRetag {
0..0,
places.map(|place| Statement {
source_info,
kind: StatementKind::Retag(RetagKind::FnEntry, box (place)),
kind: StatementKind::Retag(RetagKind::FnEntry, Box::new(place)),
}),
);
}
@ -137,7 +137,7 @@ impl<'tcx> MirPass<'tcx> for AddRetag {
0,
Statement {
source_info,
kind: StatementKind::Retag(RetagKind::Default, box (dest_place)),
kind: StatementKind::Retag(RetagKind::Default, Box::new(dest_place)),
},
);
}
@ -175,7 +175,10 @@ impl<'tcx> MirPass<'tcx> for AddRetag {
let source_info = block_data.statements[i].source_info;
block_data.statements.insert(
i + 1,
Statement { source_info, kind: StatementKind::Retag(retag_kind, box (place)) },
Statement {
source_info,
kind: StatementKind::Retag(retag_kind, Box::new(place)),
},
);
}
}

View file

@ -491,15 +491,19 @@ fn bcb_filtered_successors<'a, 'tcx>(
term_kind: &'tcx TerminatorKind<'tcx>,
) -> Box<dyn Iterator<Item = &'a BasicBlock> + 'a> {
let mut successors = term_kind.successors();
box match &term_kind {
// SwitchInt successors are never unwind, and all of them should be traversed.
TerminatorKind::SwitchInt { .. } => successors,
// For all other kinds, return only the first successor, if any, and ignore unwinds.
// NOTE: `chain(&[])` is required to coerce the `option::iter` (from
// `next().into_iter()`) into the `mir::Successors` aliased type.
_ => successors.next().into_iter().chain(&[]),
}
.filter(move |&&successor| body[successor].terminator().kind != TerminatorKind::Unreachable)
Box::new(
match &term_kind {
// SwitchInt successors are never unwind, and all of them should be traversed.
TerminatorKind::SwitchInt { .. } => successors,
// For all other kinds, return only the first successor, if any, and ignore unwinds.
// NOTE: `chain(&[])` is required to coerce the `option::iter` (from
// `next().into_iter()`) into the `mir::Successors` aliased type.
_ => successors.next().into_iter().chain(&[]),
}
.filter(move |&&successor| {
body[successor].terminator().kind != TerminatorKind::Unreachable
}),
)
}
/// Maintains separate worklists for each loop in the BasicCoverageBlock CFG, plus one for the

View file

@ -478,10 +478,10 @@ fn inject_statement(
let source_info = data.terminator().source_info;
let statement = Statement {
source_info,
kind: StatementKind::Coverage(box Coverage {
kind: StatementKind::Coverage(Box::new(Coverage {
kind: counter_kind,
code_region: some_code_region,
}),
})),
};
data.statements.insert(0, statement);
}
@ -495,7 +495,7 @@ fn inject_intermediate_expression(mir_body: &mut mir::Body<'tcx>, expression: Co
let source_info = data.terminator().source_info;
let statement = Statement {
source_info,
kind: StatementKind::Coverage(box Coverage { kind: expression, code_region: None }),
kind: StatementKind::Coverage(Box::new(Coverage { kind: expression, code_region: None })),
};
data.statements.push(statement);
}

View file

@ -44,11 +44,11 @@ const TEMP_BLOCK: BasicBlock = BasicBlock::MAX;
fn dummy_ty() -> &'static TyS<'static> {
thread_local! {
static DUMMY_TYS: &'static TyS<'static> = Box::leak(box TyS::make_for_test(
static DUMMY_TYS: &'static TyS<'static> = Box::leak(Box::new(TyS::make_for_test(
ty::Bool,
TypeFlags::empty(),
DebruijnIndex::from_usize(0),
));
)));
}
&DUMMY_TYS.with(|tys| *tys)

View file

@ -96,14 +96,14 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
opt_to_apply.infos[0].first_switch_info.discr_used_in_switch;
let not_equal_rvalue = Rvalue::BinaryOp(
not_equal,
box (
Box::new((
Operand::Copy(Place::from(second_discriminant_temp)),
Operand::Copy(first_descriminant_place),
),
)),
);
patch.add_statement(
end_of_block_location,
StatementKind::Assign(box (Place::from(not_equal_temp), not_equal_rvalue)),
StatementKind::Assign(Box::new((Place::from(not_equal_temp), not_equal_rvalue))),
);
let new_targets = opt_to_apply

View file

@ -409,7 +409,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
assert!(!data.is_cleanup, "DropAndReplace in unwind path not supported");
let assign = Statement {
kind: StatementKind::Assign(box (place, Rvalue::Use(value.clone()))),
kind: StatementKind::Assign(Box::new((place, Rvalue::Use(value.clone())))),
source_info: terminator.source_info,
};

View file

@ -274,7 +274,7 @@ impl TransformVisitor<'tcx> {
Statement {
source_info,
kind: StatementKind::SetDiscriminant {
place: box self_place,
place: Box::new(self_place),
variant_index: state_disc,
},
}
@ -289,7 +289,7 @@ impl TransformVisitor<'tcx> {
let self_place = Place::from(SELF_ARG);
let assign = Statement {
source_info: SourceInfo::outermost(body.span),
kind: StatementKind::Assign(box (temp, Rvalue::Discriminant(self_place))),
kind: StatementKind::Assign(Box::new((temp, Rvalue::Discriminant(self_place)))),
};
(assign, temp)
}
@ -954,7 +954,7 @@ fn create_generator_drop_shim<'tcx>(
0,
Statement {
source_info,
kind: StatementKind::Retag(RetagKind::Raw, box Place::from(SELF_ARG)),
kind: StatementKind::Retag(RetagKind::Raw, Box::new(Place::from(SELF_ARG))),
},
)
}
@ -984,11 +984,11 @@ fn insert_panic_block<'tcx>(
) -> BasicBlock {
let assert_block = BasicBlock::new(body.basic_blocks().len());
let term = TerminatorKind::Assert {
cond: Operand::Constant(box Constant {
cond: Operand::Constant(Box::new(Constant {
span: body.span,
user_ty: None,
literal: ty::Const::from_bool(tcx, false).into(),
}),
})),
expected: true,
msg: message,
target: assert_block,
@ -1207,10 +1207,10 @@ fn create_cases<'tcx>(
let resume_arg = Local::new(2); // 0 = return, 1 = self
statements.push(Statement {
source_info,
kind: StatementKind::Assign(box (
kind: StatementKind::Assign(Box::new((
point.resume_arg,
Rvalue::Use(Operand::Move(resume_arg.into())),
)),
))),
});
}
@ -1287,10 +1287,10 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
0,
Statement {
source_info,
kind: StatementKind::Assign(box (
kind: StatementKind::Assign(Box::new((
new_resume_local.into(),
Rvalue::Use(Operand::Move(resume_local.into())),
)),
))),
},
);

View file

@ -520,7 +520,7 @@ impl Inliner<'tcx> {
let temp = Place::from(self.new_call_temp(caller_body, &callsite, dest_ty));
caller_body[callsite.block].statements.push(Statement {
source_info: callsite.source_info,
kind: StatementKind::Assign(box (temp, dest)),
kind: StatementKind::Assign(Box::new((temp, dest))),
});
self.tcx.mk_place_deref(temp)
} else {
@ -729,7 +729,7 @@ impl Inliner<'tcx> {
let local = self.new_call_temp(caller_body, callsite, arg_ty);
caller_body[callsite.block].statements.push(Statement {
source_info: callsite.source_info,
kind: StatementKind::Assign(box (Place::from(local), Rvalue::Use(arg))),
kind: StatementKind::Assign(Box::new((Place::from(local), Rvalue::Use(arg)))),
});
local
}

View file

@ -124,7 +124,7 @@ impl<'tcx, 'a> InstCombineContext<'tcx, 'a> {
let constant =
Constant { span: source_info.span, literal: len.into(), user_ty: None };
*rvalue = Rvalue::Use(Operand::Constant(box constant));
*rvalue = Rvalue::Use(Operand::Constant(Box::new(constant)));
}
}
}

View file

@ -29,14 +29,14 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
if let Some((destination, target)) = *destination {
block.statements.push(Statement {
source_info: terminator.source_info,
kind: StatementKind::Assign(box (
kind: StatementKind::Assign(Box::new((
destination,
Rvalue::Use(Operand::Constant(box Constant {
Rvalue::Use(Operand::Constant(Box::new(Constant {
span: terminator.source_info.span,
user_ty: None,
literal: ty::Const::zero_sized(tcx, tcx.types.unit).into(),
})),
)),
}))),
))),
});
terminator.kind = TerminatorKind::Goto { target };
}
@ -46,13 +46,13 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
let mut args = args.drain(..);
block.statements.push(Statement {
source_info: terminator.source_info,
kind: StatementKind::CopyNonOverlapping(
box rustc_middle::mir::CopyNonOverlapping {
kind: StatementKind::CopyNonOverlapping(Box::new(
rustc_middle::mir::CopyNonOverlapping {
src: args.next().unwrap(),
dst: args.next().unwrap(),
count: args.next().unwrap(),
},
),
)),
});
assert_eq!(
args.next(),
@ -79,10 +79,10 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
};
block.statements.push(Statement {
source_info: terminator.source_info,
kind: StatementKind::Assign(box (
kind: StatementKind::Assign(Box::new((
destination,
Rvalue::BinaryOp(bin_op, box (lhs, rhs)),
)),
Rvalue::BinaryOp(bin_op, Box::new((lhs, rhs))),
))),
});
terminator.kind = TerminatorKind::Goto { target };
}
@ -97,10 +97,10 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
let tp_ty = substs.type_at(0);
block.statements.push(Statement {
source_info: terminator.source_info,
kind: StatementKind::Assign(box (
kind: StatementKind::Assign(Box::new((
destination,
Rvalue::NullaryOp(NullOp::SizeOf, tp_ty),
)),
))),
});
terminator.kind = TerminatorKind::Goto { target };
}
@ -112,10 +112,10 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
let arg = tcx.mk_place_deref(arg);
block.statements.push(Statement {
source_info: terminator.source_info,
kind: StatementKind::Assign(box (
kind: StatementKind::Assign(Box::new((
destination,
Rvalue::Discriminant(arg),
)),
))),
});
terminator.kind = TerminatorKind::Goto { target };
}

View file

@ -140,11 +140,11 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
let op = if f_b { BinOp::Eq } else { BinOp::Ne };
let rhs = Rvalue::BinaryOp(
op,
box (Operand::Copy(Place::from(discr_local)), const_cmp),
Box::new((Operand::Copy(Place::from(discr_local)), const_cmp)),
);
Statement {
source_info: f.source_info,
kind: StatementKind::Assign(box (*lhs, rhs)),
kind: StatementKind::Assign(Box::new((*lhs, rhs))),
}
}
}
@ -157,7 +157,10 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
.push(Statement { source_info, kind: StatementKind::StorageLive(discr_local) });
from.statements.push(Statement {
source_info,
kind: StatementKind::Assign(box (Place::from(discr_local), Rvalue::Use(discr))),
kind: StatementKind::Assign(Box::new((
Place::from(discr_local),
Rvalue::Use(discr),
))),
});
from.statements.extend(new_stmts);
from.statements

View file

@ -719,7 +719,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
let data = &mut self.promoted[last];
data.statements.push(Statement {
source_info: SourceInfo::outermost(span),
kind: StatementKind::Assign(box (Place::from(dest), rvalue)),
kind: StatementKind::Assign(Box::new((Place::from(dest), rvalue))),
});
}
@ -774,11 +774,11 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
if self.keep_original {
rhs.clone()
} else {
let unit = Rvalue::Use(Operand::Constant(box Constant {
let unit = Rvalue::Use(Operand::Constant(Box::new(Constant {
span: statement.source_info.span,
user_ty: None,
literal: ty::Const::zero_sized(self.tcx, self.tcx.types.unit).into(),
}));
})));
mem::replace(rhs, unit)
},
statement.source_info,

View file

@ -382,10 +382,10 @@ fn save_unreachable_coverage(
for (source_info, code_region) in dropped_coverage {
start_block.statements.push(Statement {
source_info,
kind: StatementKind::Coverage(box Coverage {
kind: StatementKind::Coverage(Box::new(Coverage {
kind: CoverageKind::Unreachable,
code_region: Some(code_region),
}),
})),
})
}
}

View file

@ -420,10 +420,10 @@ impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity {
let stmt = &mut bb.statements[opt_info.stmt_to_overwrite];
stmt.source_info = opt_info.source_info;
stmt.kind = StatementKind::Assign(box (
stmt.kind = StatementKind::Assign(Box::new((
opt_info.local_0.into(),
Rvalue::Use(Operand::Move(opt_info.local_1.into())),
));
)));
bb.statements.retain(|stmt| stmt.kind != StatementKind::Nop);

View file

@ -25,7 +25,7 @@ pub fn expand_aggregate<'tcx>(
AggregateKind::Adt(adt_def, variant_index, _, _, active_field_index) => {
if adt_def.is_enum() {
set_discriminant = Some(Statement {
kind: StatementKind::SetDiscriminant { place: box (lhs), variant_index },
kind: StatementKind::SetDiscriminant { place: Box::new(lhs), variant_index },
source_info,
});
lhs = tcx.mk_place_downcast(lhs, adt_def, variant_index);
@ -37,7 +37,7 @@ pub fn expand_aggregate<'tcx>(
// variant 0 (Unresumed).
let variant_index = VariantIdx::new(0);
set_discriminant = Some(Statement {
kind: StatementKind::SetDiscriminant { place: box (lhs), variant_index },
kind: StatementKind::SetDiscriminant { place: Box::new(lhs), variant_index },
source_info,
});
@ -66,7 +66,10 @@ pub fn expand_aggregate<'tcx>(
let field = Field::new(active_field_index.unwrap_or(i));
tcx.mk_place_field(lhs, field, ty)
};
Statement { source_info, kind: StatementKind::Assign(box (lhs_field, Rvalue::Use(op))) }
Statement {
source_info,
kind: StatementKind::Assign(Box::new((lhs_field, Rvalue::Use(op)))),
}
})
.chain(set_discriminant)
}

View file

@ -680,12 +680,12 @@ where
let (ptr_next, cur_next) = if ptr_based {
(
Rvalue::Use(copy(cur.into())),
Rvalue::BinaryOp(BinOp::Offset, box (move_(cur.into()), one)),
Rvalue::BinaryOp(BinOp::Offset, Box::new((move_(cur.into()), one))),
)
} else {
(
Rvalue::AddressOf(Mutability::Mut, tcx.mk_place_index(self.place, cur)),
Rvalue::BinaryOp(BinOp::Add, box (move_(cur.into()), one)),
Rvalue::BinaryOp(BinOp::Add, Box::new((move_(cur.into()), one))),
)
};
@ -703,7 +703,10 @@ where
let loop_block = BasicBlockData {
statements: vec![self.assign(
can_go,
Rvalue::BinaryOp(BinOp::Eq, box (copy(Place::from(cur)), copy(length_or_end))),
Rvalue::BinaryOp(
BinOp::Eq,
Box::new((copy(Place::from(cur)), copy(length_or_end))),
),
)],
is_cleanup: unwind.is_cleanup(),
terminator: Some(Terminator {
@ -821,7 +824,7 @@ where
length_or_end,
Rvalue::BinaryOp(
BinOp::Offset,
box (Operand::Copy(cur), Operand::Move(length)),
Box::new((Operand::Copy(cur), Operand::Move(length))),
),
),
]
@ -1032,14 +1035,17 @@ where
}
fn constant_usize(&self, val: u16) -> Operand<'tcx> {
Operand::Constant(box Constant {
Operand::Constant(Box::new(Constant {
span: self.source_info.span,
user_ty: None,
literal: ty::Const::from_usize(self.tcx(), val.into()).into(),
})
}))
}
fn assign(&self, lhs: Place<'tcx>, rhs: Rvalue<'tcx>) -> Statement<'tcx> {
Statement { source_info: self.source_info, kind: StatementKind::Assign(box (lhs, rhs)) }
Statement {
source_info: self.source_info,
kind: StatementKind::Assign(Box::new((lhs, rhs))),
}
}
}

View file

@ -112,7 +112,7 @@ impl<'tcx> MirPatch<'tcx> {
}
pub fn add_assign(&mut self, loc: Location, place: Place<'tcx>, rv: Rvalue<'tcx>) {
self.add_statement(loc, StatementKind::Assign(box (place, rv)));
self.add_statement(loc, StatementKind::Assign(Box::new((place, rv))));
}
pub fn apply(self, body: &mut Body<'tcx>) {

View file

@ -40,7 +40,7 @@ impl<'tcx> CFG<'tcx> {
) {
self.push(
block,
Statement { source_info, kind: StatementKind::Assign(box (place, rvalue)) },
Statement { source_info, kind: StatementKind::Assign(Box::new((place, rvalue))) },
);
}
@ -51,7 +51,12 @@ impl<'tcx> CFG<'tcx> {
temp: Place<'tcx>,
constant: Constant<'tcx>,
) {
self.push_assign(block, source_info, temp, Rvalue::Use(Operand::Constant(box constant)));
self.push_assign(
block,
source_info,
temp,
Rvalue::Use(Operand::Constant(Box::new(constant))),
);
}
crate fn push_assign_unit(
@ -65,11 +70,11 @@ impl<'tcx> CFG<'tcx> {
block,
source_info,
place,
Rvalue::Use(Operand::Constant(box Constant {
Rvalue::Use(Operand::Constant(Box::new(Constant {
span: source_info.span,
user_ty: None,
literal: ty::Const::zero_sized(tcx, tcx.types.unit).into(),
})),
}))),
);
}
@ -80,7 +85,7 @@ impl<'tcx> CFG<'tcx> {
cause: FakeReadCause,
place: Place<'tcx>,
) {
let kind = StatementKind::FakeRead(box (cause, place));
let kind = StatementKind::FakeRead(Box::new((cause, place)));
let stmt = Statement { source_info, kind };
self.push(block, stmt);
}

View file

@ -111,7 +111,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
match category {
Category::Constant => {
let constant = this.as_constant(expr);
block.and(Operand::Constant(box constant))
block.and(Operand::Constant(Box::new(constant)))
}
Category::Place | Category::Rvalue(..) => {
let operand = unpack!(block = this.as_temp(block, scope, expr, Mutability::Mut));

View file

@ -507,10 +507,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
Statement {
source_info,
kind: StatementKind::AscribeUserType(
box (
Box::new((
place,
UserTypeProjection { base: annotation_index, projs: vec![] },
),
)),
Variance::Invariant,
),
},
@ -534,10 +534,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
Statement {
source_info,
kind: StatementKind::AscribeUserType(
box (
Box::new((
Place::from(temp),
UserTypeProjection { base: annotation_index, projs: vec![] },
),
)),
Variance::Invariant,
),
},
@ -691,7 +691,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
lt,
Rvalue::BinaryOp(
BinOp::Lt,
box (Operand::Copy(Place::from(index)), Operand::Copy(len)),
Box::new((Operand::Copy(Place::from(index)), Operand::Copy(len))),
),
);
let msg = BoundsCheck { len: Operand::Move(len), index: Operand::Copy(Place::from(index)) };

View file

@ -73,7 +73,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
block,
source_info,
is_min,
Rvalue::BinaryOp(BinOp::Eq, box (arg.to_copy(), minval)),
Rvalue::BinaryOp(BinOp::Eq, Box::new((arg.to_copy(), minval))),
);
block = this.assert(
@ -158,7 +158,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
.map(|f| unpack!(block = this.as_operand(block, scope, &this.thir[f])))
.collect();
block.and(Rvalue::Aggregate(box AggregateKind::Array(el_ty), fields))
block.and(Rvalue::Aggregate(Box::new(AggregateKind::Array(el_ty)), fields))
}
ExprKind::Tuple { ref fields } => {
// see (*) above
@ -169,7 +169,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
.map(|f| unpack!(block = this.as_operand(block, scope, &this.thir[f])))
.collect();
block.and(Rvalue::Aggregate(box AggregateKind::Tuple, fields))
block.and(Rvalue::Aggregate(Box::new(AggregateKind::Tuple), fields))
}
ExprKind::Closure { closure_id, substs, ref upvars, movability, ref fake_reads } => {
// Convert the closure fake reads, if any, from `ExprRef` to mir `Place`
@ -254,19 +254,21 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// We implicitly set the discriminant to 0. See
// librustc_mir/transform/deaggregator.rs for details.
let movability = movability.unwrap();
box AggregateKind::Generator(closure_id, substs, movability)
Box::new(AggregateKind::Generator(closure_id, substs, movability))
}
UpvarSubsts::Closure(substs) => {
Box::new(AggregateKind::Closure(closure_id, substs))
}
UpvarSubsts::Closure(substs) => box AggregateKind::Closure(closure_id, substs),
};
block.and(Rvalue::Aggregate(result, operands))
}
ExprKind::Assign { .. } | ExprKind::AssignOp { .. } => {
block = unpack!(this.stmt_expr(block, expr, None));
block.and(Rvalue::Use(Operand::Constant(box Constant {
block.and(Rvalue::Use(Operand::Constant(Box::new(Constant {
span: expr_span,
user_ty: None,
literal: ty::Const::zero_sized(this.tcx, this.tcx.types.unit).into(),
})))
}))))
}
ExprKind::Yield { .. }
| ExprKind::Literal { .. }
@ -327,7 +329,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
block,
source_info,
result_value,
Rvalue::CheckedBinaryOp(op, box (lhs.to_copy(), rhs.to_copy())),
Rvalue::CheckedBinaryOp(op, Box::new((lhs.to_copy(), rhs.to_copy()))),
);
let val_fld = Field::new(0);
let of_fld = Field::new(1);
@ -360,7 +362,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
block,
source_info,
is_zero,
Rvalue::BinaryOp(BinOp::Eq, box (rhs.to_copy(), zero)),
Rvalue::BinaryOp(BinOp::Eq, Box::new((rhs.to_copy(), zero))),
);
block = self.assert(block, Operand::Move(is_zero), false, zero_err, span);
@ -381,13 +383,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
block,
source_info,
is_neg_1,
Rvalue::BinaryOp(BinOp::Eq, box (rhs.to_copy(), neg_1)),
Rvalue::BinaryOp(BinOp::Eq, Box::new((rhs.to_copy(), neg_1))),
);
self.cfg.push_assign(
block,
source_info,
is_min,
Rvalue::BinaryOp(BinOp::Eq, box (lhs.to_copy(), min)),
Rvalue::BinaryOp(BinOp::Eq, Box::new((lhs.to_copy(), min))),
);
let is_neg_1 = Operand::Move(is_neg_1);
@ -396,14 +398,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
block,
source_info,
of,
Rvalue::BinaryOp(BinOp::BitAnd, box (is_neg_1, is_min)),
Rvalue::BinaryOp(BinOp::BitAnd, Box::new((is_neg_1, is_min))),
);
block = self.assert(block, Operand::Move(of), false, overflow_err, span);
}
}
block.and(Rvalue::BinaryOp(op, box (lhs, rhs)))
block.and(Rvalue::BinaryOp(op, Box::new((lhs, rhs))))
}
}

View file

@ -62,16 +62,16 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
assert!(!this.tcx.is_thread_local_static(def_id));
local_decl.internal = true;
local_decl.local_info =
Some(box LocalInfo::StaticRef { def_id, is_thread_local: false });
Some(Box::new(LocalInfo::StaticRef { def_id, is_thread_local: false }));
}
ExprKind::ThreadLocalRef(def_id) => {
assert!(this.tcx.is_thread_local_static(def_id));
local_decl.internal = true;
local_decl.local_info =
Some(box LocalInfo::StaticRef { def_id, is_thread_local: true });
Some(Box::new(LocalInfo::StaticRef { def_id, is_thread_local: true }));
}
ExprKind::Literal { const_id: Some(def_id), .. } => {
local_decl.local_info = Some(box LocalInfo::ConstRef { def_id });
local_decl.local_info = Some(Box::new(LocalInfo::ConstRef { def_id }));
}
_ => {}
}

View file

@ -346,13 +346,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
inferred_ty,
})
});
let adt = box AggregateKind::Adt(
let adt = Box::new(AggregateKind::Adt(
adt_def,
variant_index,
substs,
user_ty,
active_field_index,
);
));
this.cfg.push_assign(
block,
source_info,
@ -403,11 +403,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
thir::InlineAsmOperand::Const { value, span } => {
mir::InlineAsmOperand::Const {
value: box Constant { span, user_ty: None, literal: value.into() },
value: Box::new(Constant {
span,
user_ty: None,
literal: value.into(),
}),
}
}
thir::InlineAsmOperand::SymFn { expr } => mir::InlineAsmOperand::SymFn {
value: box this.as_constant(&this.thir[expr]),
value: Box::new(this.as_constant(&this.thir[expr])),
},
thir::InlineAsmOperand::SymStatic { def_id } => {
mir::InlineAsmOperand::SymStatic { def_id }

View file

@ -123,11 +123,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
block,
Statement {
source_info,
kind: StatementKind::LlvmInlineAsm(box LlvmInlineAsm {
kind: StatementKind::LlvmInlineAsm(Box::new(LlvmInlineAsm {
asm: asm.clone(),
outputs,
inputs,
}),
})),
},
);
this.block_context.pop();

View file

@ -494,7 +494,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
Statement {
source_info: ty_source_info,
kind: StatementKind::AscribeUserType(
box (place, user_ty),
Box::new((place, user_ty)),
// We always use invariant as the variance here. This is because the
// variance field from the ascription refers to the variance to use
// when applying the type to the value being matched, but this
@ -2004,7 +2004,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
Statement {
source_info,
kind: StatementKind::AscribeUserType(
box (ascription.source, user_ty),
Box::new((ascription.source, user_ty)),
ascription.variance,
),
},
@ -2133,11 +2133,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let local = LocalDecl::<'tcx> {
mutability,
ty: var_ty,
user_ty: if user_ty.is_empty() { None } else { Some(box user_ty) },
user_ty: if user_ty.is_empty() { None } else { Some(Box::new(user_ty)) },
source_info,
internal: false,
is_block_tail: None,
local_info: Some(box LocalInfo::User(ClearCrossCrate::Set(BindingForm::Var(
local_info: Some(Box::new(LocalInfo::User(ClearCrossCrate::Set(BindingForm::Var(
VarBindingForm {
binding_mode,
// hypothetically, `visit_primary_bindings` could try to unzip
@ -2148,7 +2148,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
opt_match_place,
pat_span,
},
)))),
))))),
};
let for_arm_body = self.local_decls.push(local);
self.var_debug_info.push(VarDebugInfo {
@ -2166,9 +2166,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
source_info,
internal: false,
is_block_tail: None,
local_info: Some(box LocalInfo::User(ClearCrossCrate::Set(
local_info: Some(Box::new(LocalInfo::User(ClearCrossCrate::Set(
BindingForm::RefForGuard,
))),
)))),
});
self.var_debug_info.push(VarDebugInfo {
name,

View file

@ -346,7 +346,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let result = self.temp(bool_ty, source_info.span);
// result = op(left, right)
self.cfg.push_assign(block, source_info, result, Rvalue::BinaryOp(op, box (left, right)));
self.cfg.push_assign(
block,
source_info,
result,
Rvalue::BinaryOp(op, Box::new((left, right))),
);
// branch based on result
self.cfg.terminate(
@ -429,7 +434,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
block,
source_info,
TerminatorKind::Call {
func: Operand::Constant(box Constant {
func: Operand::Constant(Box::new(Constant {
span: source_info.span,
// FIXME(#54571): This constant comes from user input (a
@ -439,7 +444,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
user_ty: None,
literal: method.into(),
}),
})),
args: vec![val, expect],
destination: Some((eq_result, eq_block)),
cleanup: None,

View file

@ -31,7 +31,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
literal: &'tcx ty::Const<'tcx>,
) -> Operand<'tcx> {
let literal = literal.into();
let constant = box Constant { span, user_ty: None, literal };
let constant = Box::new(Constant { span, user_ty: None, literal });
Operand::Constant(constant)
}

View file

@ -980,19 +980,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
self.local_decls[local].mutability = mutability;
self.local_decls[local].source_info.scope = self.source_scope;
self.local_decls[local].local_info = if let Some(kind) = self_binding {
Some(box LocalInfo::User(ClearCrossCrate::Set(
Some(Box::new(LocalInfo::User(ClearCrossCrate::Set(
BindingForm::ImplicitSelf(*kind),
)))
))))
} else {
let binding_mode = ty::BindingMode::BindByValue(mutability);
Some(box LocalInfo::User(ClearCrossCrate::Set(BindingForm::Var(
Some(Box::new(LocalInfo::User(ClearCrossCrate::Set(BindingForm::Var(
VarBindingForm {
binding_mode,
opt_ty_info,
opt_match_place: Some((Some(place), span)),
pat_span: span,
},
))))
)))))
};
self.var_indices.insert(var, LocalsForNode::One(local));
}

View file

@ -2,7 +2,6 @@
//!
//! This crate also contains the match exhaustiveness and usefulness checking.
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(control_flow_enum)]
#![feature(crate_visibility_modifier)]
#![feature(bool_to_option)]

View file

@ -132,7 +132,7 @@ impl<'tcx> Cx<'tcx> {
},
};
let expr = box [self.thir.exprs.push(expr)];
let expr = Box::new([self.thir.exprs.push(expr)]);
self.overloaded_place(hir_expr, adjustment.target, Some(call), expr, deref.span)
}
@ -190,7 +190,7 @@ impl<'tcx> Cx<'tcx> {
ExprKind::Call {
ty: method.ty,
fun: self.thir.exprs.push(method),
args: box [self.mirror_expr(fun), tupled_args],
args: Box::new([self.mirror_expr(fun), tupled_args]),
from_hir_call: true,
fn_span: expr.span,
}
@ -266,7 +266,7 @@ impl<'tcx> Cx<'tcx> {
if self.typeck_results().is_method_call(expr) {
let lhs = self.mirror_expr(lhs);
let rhs = self.mirror_expr(rhs);
self.overloaded_operator(expr, box [lhs, rhs])
self.overloaded_operator(expr, Box::new([lhs, rhs]))
} else {
ExprKind::AssignOp {
op: bin_op(op.node),
@ -286,7 +286,7 @@ impl<'tcx> Cx<'tcx> {
if self.typeck_results().is_method_call(expr) {
let lhs = self.mirror_expr(lhs);
let rhs = self.mirror_expr(rhs);
self.overloaded_operator(expr, box [lhs, rhs])
self.overloaded_operator(expr, Box::new([lhs, rhs]))
} else {
// FIXME overflow
match op.node {
@ -317,7 +317,7 @@ impl<'tcx> Cx<'tcx> {
if self.typeck_results().is_method_call(expr) {
let lhs = self.mirror_expr(lhs);
let index = self.mirror_expr(index);
self.overloaded_place(expr, expr_ty, None, box [lhs, index], expr.span)
self.overloaded_place(expr, expr_ty, None, Box::new([lhs, index]), expr.span)
} else {
ExprKind::Index { lhs: self.mirror_expr(lhs), index: self.mirror_expr(index) }
}
@ -326,7 +326,7 @@ impl<'tcx> Cx<'tcx> {
hir::ExprKind::Unary(hir::UnOp::Deref, ref arg) => {
if self.typeck_results().is_method_call(expr) {
let arg = self.mirror_expr(arg);
self.overloaded_place(expr, expr_ty, None, box [arg], expr.span)
self.overloaded_place(expr, expr_ty, None, Box::new([arg]), expr.span)
} else {
ExprKind::Deref { arg: self.mirror_expr(arg) }
}
@ -335,7 +335,7 @@ impl<'tcx> Cx<'tcx> {
hir::ExprKind::Unary(hir::UnOp::Not, ref arg) => {
if self.typeck_results().is_method_call(expr) {
let arg = self.mirror_expr(arg);
self.overloaded_operator(expr, box [arg])
self.overloaded_operator(expr, Box::new([arg]))
} else {
ExprKind::Unary { op: UnOp::Not, arg: self.mirror_expr(arg) }
}
@ -344,7 +344,7 @@ impl<'tcx> Cx<'tcx> {
hir::ExprKind::Unary(hir::UnOp::Neg, ref arg) => {
if self.typeck_results().is_method_call(expr) {
let arg = self.mirror_expr(arg);
self.overloaded_operator(expr, box [arg])
self.overloaded_operator(expr, Box::new([arg]))
} else if let hir::ExprKind::Lit(ref lit) = arg.kind {
ExprKind::Literal {
literal: self.const_eval_literal(&lit.node, expr_ty, lit.span, true),
@ -914,7 +914,7 @@ impl<'tcx> Cx<'tcx> {
variant_index: adt_def.variant_index_with_ctor_id(def_id),
substs,
user_ty: user_provided_type,
fields: box [],
fields: Box::new([]),
base: None,
})),
_ => bug!("unexpected ty: {:?}", ty),

View file

@ -600,7 +600,7 @@ crate trait PatternFolder<'tcx>: Sized {
impl<'tcx, T: PatternFoldable<'tcx>> PatternFoldable<'tcx> for Box<T> {
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
let content: T = (**self).fold_with(folder);
box content
Box::new(content)
}
}

View file

@ -3,7 +3,6 @@
#![feature(array_windows)]
#![feature(crate_visibility_modifier)]
#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(box_syntax)]
#![feature(box_patterns)]
#![recursion_limit = "256"]

View file

@ -221,7 +221,7 @@ impl<'a> Parser<'a> {
} else if self.check_fn_front_matter(def_final) {
// FUNCTION ITEM
let (ident, sig, generics, body) = self.parse_fn(attrs, req_name, lo)?;
(ident, ItemKind::Fn(box FnKind(def(), sig, generics, body)))
(ident, ItemKind::Fn(Box::new(FnKind(def(), sig, generics, body))))
} else if self.eat_keyword(kw::Extern) {
if self.eat_keyword(kw::Crate) {
// EXTERN CRATE
@ -548,7 +548,7 @@ impl<'a> Parser<'a> {
};
let trait_ref = TraitRef { path, ref_id: ty_first.id };
ItemKind::Impl(box ImplKind {
ItemKind::Impl(Box::new(ImplKind {
unsafety,
polarity,
defaultness,
@ -557,11 +557,11 @@ impl<'a> Parser<'a> {
of_trait: Some(trait_ref),
self_ty: ty_second,
items: impl_items,
})
}))
}
None => {
// impl Type
ItemKind::Impl(box ImplKind {
ItemKind::Impl(Box::new(ImplKind {
unsafety,
polarity,
defaultness,
@ -570,7 +570,7 @@ impl<'a> Parser<'a> {
of_trait: None,
self_ty: ty_first,
items: impl_items,
})
}))
}
};
@ -710,7 +710,7 @@ impl<'a> Parser<'a> {
// It's a normal trait.
tps.where_clause = self.parse_where_clause()?;
let items = self.parse_item_list(attrs, |p| p.parse_trait_item(ForceCollect::No))?;
Ok((ident, ItemKind::Trait(box TraitKind(is_auto, unsafety, tps, bounds, items))))
Ok((ident, ItemKind::Trait(Box::new(TraitKind(is_auto, unsafety, tps, bounds, items)))))
}
}
@ -769,7 +769,7 @@ impl<'a> Parser<'a> {
let default = if self.eat(&token::Eq) { Some(self.parse_ty()?) } else { None };
self.expect_semi()?;
Ok((ident, ItemKind::TyAlias(box TyAliasKind(def, generics, bounds, default))))
Ok((ident, ItemKind::TyAlias(Box::new(TyAliasKind(def, generics, bounds, default)))))
}
/// Parses a `UseTree`.

View file

@ -9,7 +9,6 @@ Core encoding and decoding interfaces.
html_playground_url = "https://play.rust-lang.org/",
test(attr(allow(unused_variables), deny(warnings)))
)]
#![feature(box_syntax)]
#![feature(never_type)]
#![feature(nll)]
#![feature(associated_type_bounds)]

View file

@ -679,6 +679,6 @@ impl<S: Encoder, T: ?Sized + Encodable<S>> Encodable<S> for Box<T> {
}
impl<D: Decoder, T: Decodable<D>> Decodable<D> for Box<T> {
fn decode(d: &mut D) -> Result<Box<T>, D::Error> {
Ok(box Decodable::decode(d)?)
Ok(Box::new(Decodable::decode(d)?))
}
}

View file

@ -108,7 +108,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
0 => (arm_span, ObligationCauseCode::BlockTailExpression(arm.body.hir_id)),
_ => (
expr.span,
ObligationCauseCode::MatchExpressionArm(box MatchExpressionArmCause {
ObligationCauseCode::MatchExpressionArm(Box::new(MatchExpressionArmCause {
arm_span,
scrut_span: scrut.span,
semi_span,
@ -117,7 +117,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
last_ty: prior_arm_ty.unwrap(),
scrut_hir_id: scrut.hir_id,
opt_suggest_box_span,
}),
})),
),
};
let cause = self.cause(span, code);
@ -397,13 +397,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Finally construct the cause:
self.cause(
error_sp,
ObligationCauseCode::IfExpression(box IfExpressionCause {
ObligationCauseCode::IfExpression(Box::new(IfExpressionCause {
then: then_sp,
else_sp: error_sp,
outer: outer_sp,
semicolon: remove_semicolon,
opt_suggest_box_span,
}),
})),
)
}

View file

@ -58,7 +58,6 @@ This API is completely unstable and subject to change.
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(bool_to_option)]
#![feature(box_syntax)]
#![feature(crate_visibility_modifier)]
#![feature(format_args_capture)]
#![feature(in_band_lifetimes)]

View file

@ -114,7 +114,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
attrs: Default::default(),
visibility: Inherited,
def_id: ItemId::Auto { trait_: trait_def_id, for_: item_def_id },
kind: box ImplItem(Impl {
kind: Box::new(ImplItem(Impl {
span: Span::dummy(),
unsafety: hir::Unsafety::Normal,
generics: new_generics,
@ -124,7 +124,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
negative_polarity,
synthetic: true,
blanket_impl: None,
}),
})),
cfg: None,
})
}

View file

@ -97,7 +97,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
attrs: Default::default(),
visibility: Inherited,
def_id: ItemId::Blanket { impl_id: impl_def_id, for_: item_def_id },
kind: box ImplItem(Impl {
kind: Box::new(ImplItem(Impl {
span: Span::new(self.cx.tcx.def_span(impl_def_id)),
unsafety: hir::Unsafety::Normal,
generics: (
@ -118,8 +118,8 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
.clean(self.cx),
negative_polarity: false,
synthetic: false,
blanket_impl: Some(box trait_ref.self_ty().clean(self.cx)),
}),
blanket_impl: Some(Box::new(trait_ref.self_ty().clean(self.cx))),
})),
cfg: None,
});
}

View file

@ -124,8 +124,14 @@ crate fn try_inline(
let (attrs, cfg) = merge_attrs(cx, Some(parent_module), load_attrs(cx, did), attrs_clone);
cx.inlined.insert(did.into());
let mut item =
clean::Item::from_def_id_and_attrs_and_parts(did, Some(name), kind, box attrs, cx, cfg);
let mut item = clean::Item::from_def_id_and_attrs_and_parts(
did,
Some(name),
kind,
Box::new(attrs),
cx,
cfg,
);
if let Some(import_def_id) = import_def_id {
// The visibility needs to reflect the one from the reexport and not from the "source" DefId.
item.visibility = cx.tcx.visibility(import_def_id).clean(cx);
@ -458,7 +464,7 @@ crate fn build_impl(
synthetic: false,
blanket_impl: None,
}),
box merged_attrs,
Box::new(merged_attrs),
cx,
cfg,
));
@ -486,10 +492,10 @@ fn build_module(
let prim_ty = clean::PrimitiveType::from(p);
items.push(clean::Item {
name: None,
attrs: box clean::Attributes::default(),
attrs: Box::new(clean::Attributes::default()),
def_id: ItemId::Primitive(prim_ty, did.krate),
visibility: clean::Public,
kind: box clean::ImportItem(clean::Import::new_simple(
kind: Box::new(clean::ImportItem(clean::Import::new_simple(
item.ident.name,
clean::ImportSource {
path: clean::Path {
@ -506,7 +512,7 @@ fn build_module(
did: None,
},
true,
)),
))),
cfg: None,
});
} else if let Some(i) =

View file

@ -403,8 +403,8 @@ impl<'tcx> Clean<Type> for ty::ProjectionTy<'tcx> {
Type::QPath {
name: cx.tcx.associated_item(self.item_def_id).ident.name,
self_def_id: self_type.def_id(),
self_type: box self_type,
trait_: box trait_,
self_type: Box::new(self_type),
trait_: Box::new(trait_),
}
}
}
@ -1305,8 +1305,8 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
Type::QPath {
name: p.segments.last().expect("segments were empty").ident.name,
self_def_id: Some(DefId::local(qself.hir_id.owner.local_def_index)),
self_type: box qself.clean(cx),
trait_: box resolve_type(cx, trait_path, hir_id),
self_type: Box::new(qself.clean(cx)),
trait_: Box::new(resolve_type(cx, trait_path, hir_id)),
}
}
hir::QPath::TypeRelative(ref qself, ref segment) => {
@ -1320,8 +1320,8 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
Type::QPath {
name: segment.ident.name,
self_def_id: res.opt_def_id(),
self_type: box qself.clean(cx),
trait_: box resolve_type(cx, trait_path, hir_id),
self_type: Box::new(qself.clean(cx)),
trait_: Box::new(resolve_type(cx, trait_path, hir_id)),
}
}
hir::QPath::LangItem(..) => bug!("clean: requiring documentation of lang item"),
@ -1334,7 +1334,7 @@ impl Clean<Type> for hir::Ty<'_> {
match self.kind {
TyKind::Never => Never,
TyKind::Ptr(ref m) => RawPointer(m.mutbl, box m.ty.clean(cx)),
TyKind::Ptr(ref m) => RawPointer(m.mutbl, Box::new(m.ty.clean(cx))),
TyKind::Rptr(ref l, ref m) => {
// There are two times a `Fresh` lifetime can be created:
// 1. For `&'_ x`, written by the user. This corresponds to `lower_lifetime` in `rustc_ast_lowering`.
@ -1346,9 +1346,9 @@ impl Clean<Type> for hir::Ty<'_> {
let elided =
l.is_elided() || matches!(l.name, LifetimeName::Param(ParamName::Fresh(_)));
let lifetime = if elided { None } else { Some(l.clean(cx)) };
BorrowedRef { lifetime, mutability: m.mutbl, type_: box m.ty.clean(cx) }
BorrowedRef { lifetime, mutability: m.mutbl, type_: Box::new(m.ty.clean(cx)) }
}
TyKind::Slice(ref ty) => Slice(box ty.clean(cx)),
TyKind::Slice(ref ty) => Slice(Box::new(ty.clean(cx))),
TyKind::Array(ref ty, ref length) => {
let def_id = cx.tcx.hir().local_def_id(length.hir_id);
// NOTE(min_const_generics): We can't use `const_eval_poly` for constants
@ -1361,7 +1361,7 @@ impl Clean<Type> for hir::Ty<'_> {
let ct = ty::Const::from_anon_const(cx.tcx, def_id);
let param_env = cx.tcx.param_env(def_id);
let length = print_const(cx, ct.eval(cx.tcx, param_env));
Array(box ty.clean(cx), length)
Array(Box::new(ty.clean(cx)), length)
}
TyKind::Tup(ref tys) => Tuple(tys.clean(cx)),
TyKind::OpaqueDef(item_id, _) => {
@ -1378,7 +1378,7 @@ impl Clean<Type> for hir::Ty<'_> {
let lifetime = if !lifetime.is_elided() { Some(lifetime.clean(cx)) } else { None };
DynTrait(bounds, lifetime)
}
TyKind::BareFn(ref barefn) => BareFunction(box barefn.clean(cx)),
TyKind::BareFn(ref barefn) => BareFunction(Box::new(barefn.clean(cx))),
TyKind::Infer | TyKind::Err => Infer,
TyKind::Typeof(..) => panic!("unimplemented type {:?}", self.kind),
}
@ -1428,27 +1428,29 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
ty::Uint(uint_ty) => Primitive(uint_ty.into()),
ty::Float(float_ty) => Primitive(float_ty.into()),
ty::Str => Primitive(PrimitiveType::Str),
ty::Slice(ty) => Slice(box ty.clean(cx)),
ty::Slice(ty) => Slice(Box::new(ty.clean(cx))),
ty::Array(ty, n) => {
let mut n = cx.tcx.lift(n).expect("array lift failed");
n = n.eval(cx.tcx, ty::ParamEnv::reveal_all());
let n = print_const(cx, n);
Array(box ty.clean(cx), n)
}
ty::RawPtr(mt) => RawPointer(mt.mutbl, box mt.ty.clean(cx)),
ty::Ref(r, ty, mutbl) => {
BorrowedRef { lifetime: r.clean(cx), mutability: mutbl, type_: box ty.clean(cx) }
Array(Box::new(ty.clean(cx)), n)
}
ty::RawPtr(mt) => RawPointer(mt.mutbl, Box::new(mt.ty.clean(cx))),
ty::Ref(r, ty, mutbl) => BorrowedRef {
lifetime: r.clean(cx),
mutability: mutbl,
type_: Box::new(ty.clean(cx)),
},
ty::FnDef(..) | ty::FnPtr(_) => {
let ty = cx.tcx.lift(*self).expect("FnPtr lift failed");
let sig = ty.fn_sig(cx.tcx);
let def_id = DefId::local(CRATE_DEF_INDEX);
BareFunction(box BareFunctionDecl {
BareFunction(Box::new(BareFunctionDecl {
unsafety: sig.unsafety(),
generic_params: Vec::new(),
decl: (def_id, sig).clean(cx),
abi: sig.abi(),
})
}))
}
ty::Adt(def, substs) => {
let did = def.did;
@ -1988,10 +1990,10 @@ fn clean_extern_crate(
// FIXME: using `from_def_id_and_kind` breaks `rustdoc/masked` for some reason
vec![Item {
name: Some(name),
attrs: box attrs.clean(cx),
attrs: Box::new(attrs.clean(cx)),
def_id: crate_def_id.into(),
visibility: krate.vis.clean(cx),
kind: box ExternCrateItem { src: orig_name },
kind: Box::new(ExternCrateItem { src: orig_name }),
cfg: attrs.cfg(cx.sess()),
}]
}

View file

@ -416,7 +416,7 @@ impl Item {
def_id,
name,
kind,
box ast_attrs.clean(cx),
Box::new(ast_attrs.clean(cx)),
cx,
ast_attrs.cfg(cx.sess()),
)
@ -434,7 +434,7 @@ impl Item {
Item {
def_id: def_id.into(),
kind: box kind,
kind: Box::new(kind),
name,
attrs,
visibility: cx.tcx.visibility(def_id).clean(cx),

View file

@ -265,7 +265,7 @@ crate fn create_config(
stderr: None,
lint_caps,
parse_sess_created: None,
register_lints: Some(box crate::lint::register_lints),
register_lints: Some(Box::new(crate::lint::register_lints)),
override_queries: Some(|_sess, providers, _external_providers| {
// Most lints will require typechecking, so just don't run them.
providers.lint_mod = |_, _| {};

View file

@ -99,7 +99,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
stderr: None,
lint_caps,
parse_sess_created: None,
register_lints: Some(box crate::lint::register_lints),
register_lints: Some(Box::new(crate::lint::register_lints)),
override_queries: None,
make_codegen_backend: None,
registry: rustc_driver::diagnostics_registry(),
@ -549,10 +549,10 @@ crate fn make_test(
.supports_color();
let emitter =
EmitterWriter::new(box io::sink(), None, false, false, false, None, false);
EmitterWriter::new(Box::new(io::sink()), None, false, false, false, None, false);
// FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser
let handler = Handler::with_emitter(false, None, box emitter);
let handler = Handler::with_emitter(false, None, Box::new(emitter));
let sess = ParseSess::with_span_handler(handler, sm);
let mut found_main = false;
@ -962,7 +962,7 @@ impl Tester for Collector {
no_run,
test_type: test::TestType::DocTest,
},
testfn: test::DynTestFn(box move || {
testfn: test::DynTestFn(Box::new(move || {
let report_unused_externs = |uext| {
unused_externs.lock().unwrap().push(uext);
};
@ -1042,9 +1042,9 @@ impl Tester for Collector {
}
}
panic::resume_unwind(box ());
panic::resume_unwind(Box::new(()));
}
}),
})),
});
}

View file

@ -2,7 +2,7 @@ use crate::clean::*;
crate fn strip_item(mut item: Item) -> Item {
if !matches!(*item.kind, StrippedItem(..)) {
item.kind = box StrippedItem(item.kind);
item.kind = Box::new(StrippedItem(item.kind));
}
item
}
@ -65,10 +65,10 @@ crate trait DocFolder: Sized {
/// don't override!
fn fold_item_recur(&mut self, mut item: Item) -> Item {
item.kind = box match *item.kind {
StrippedItem(box i) => StrippedItem(box self.fold_inner_recur(i)),
item.kind = Box::new(match *item.kind {
StrippedItem(box i) => StrippedItem(Box::new(self.fold_inner_recur(i))),
_ => self.fold_inner_recur(*item.kind),
};
});
item
}

View file

@ -5,7 +5,6 @@
#![feature(rustc_private)]
#![feature(array_methods)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(in_band_lifetimes)]
#![feature(nll)]
#![feature(test)]

View file

@ -61,7 +61,7 @@ enum ErrorKind<'a> {
impl<'a> From<ResolutionFailure<'a>> for ErrorKind<'a> {
fn from(err: ResolutionFailure<'a>) -> Self {
ErrorKind::Resolve(box err)
ErrorKind::Resolve(Box::new(err))
}
}

View file

@ -116,7 +116,7 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
// prevent folding of `cfg!` macros and the like
if !e.span.from_expansion() {
match &e.kind {
ExprKind::Unary(UnOp::Not, inner) => return Ok(Bool::Not(box self.run(inner)?)),
ExprKind::Unary(UnOp::Not, inner) => return Ok(Bool::Not(Box::new(self.run(inner)?))),
ExprKind::Binary(binop, lhs, rhs) => match &binop.node {
BinOpKind::Or => {
return Ok(Bool::Or(self.extract(BinOpKind::Or, &[lhs, rhs], Vec::new())?));

View file

@ -578,8 +578,8 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
let filename = FileName::anon_source_code(&code);
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let emitter = EmitterWriter::new(box io::sink(), None, false, false, false, None, false);
let handler = Handler::with_emitter(false, None, box emitter);
let emitter = EmitterWriter::new(Box::new(io::sink()), None, false, false, false, None, false);
let handler = Handler::with_emitter(false, None, Box::new(emitter));
let sess = ParseSess::with_span_handler(handler, sm);
let mut parser = match maybe_new_parser_from_source_str(&sess, filename, code) {

View file

@ -1,7 +1,6 @@
// error-pattern:cargo-clippy
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(drain_filter)]
#![feature(in_band_lifetimes)]
#![feature(iter_zip)]
@ -393,9 +392,9 @@ use crate::utils::conf::TryConf;
/// Used in `./src/driver.rs`.
pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore) {
// NOTE: Do not add any more pre-expansion passes. These should be removed eventually.
store.register_pre_expansion_pass(|| box write::Write::default());
store.register_pre_expansion_pass(|| box attrs::EarlyAttributes);
store.register_pre_expansion_pass(|| box dbg_macro::DbgMacro);
store.register_pre_expansion_pass(|| Box::new(write::Write::default()));
store.register_pre_expansion_pass(|| Box::new(attrs::EarlyAttributes));
store.register_pre_expansion_pass(|| Box::new(dbg_macro::DbgMacro));
}
#[doc(hidden)]
@ -1810,7 +1809,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
#[cfg(feature = "metadata-collector-lint")]
{
if std::env::var("ENABLE_METADATA_COLLECTION").eq(&Ok("1".to_string())) {
store.register_late_pass(|| box utils::internal_lints::metadata_collector::MetadataCollector::new());
store.register_late_pass(|| Box::new(utils::internal_lints::metadata_collector::MetadataCollector::new()));
return;
}
}
@ -1818,57 +1817,57 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
// all the internal lints
#[cfg(feature = "internal-lints")]
{
store.register_early_pass(|| box utils::internal_lints::ClippyLintsInternal);
store.register_early_pass(|| box utils::internal_lints::ProduceIce);
store.register_late_pass(|| box utils::inspector::DeepCodeInspector);
store.register_late_pass(|| box utils::internal_lints::CollapsibleCalls);
store.register_late_pass(|| box utils::internal_lints::CompilerLintFunctions::new());
store.register_late_pass(|| box utils::internal_lints::IfChainStyle);
store.register_late_pass(|| box utils::internal_lints::InvalidPaths);
store.register_late_pass(|| box utils::internal_lints::InterningDefinedSymbol::default());
store.register_late_pass(|| box utils::internal_lints::LintWithoutLintPass::default());
store.register_late_pass(|| box utils::internal_lints::MatchTypeOnDiagItem);
store.register_late_pass(|| box utils::internal_lints::OuterExpnDataPass);
store.register_early_pass(|| Box::new(utils::internal_lints::ClippyLintsInternal));
store.register_early_pass(|| Box::new(utils::internal_lints::ProduceIce));
store.register_late_pass(|| Box::new(utils::inspector::DeepCodeInspector));
store.register_late_pass(|| Box::new(utils::internal_lints::CollapsibleCalls));
store.register_late_pass(|| Box::new(utils::internal_lints::CompilerLintFunctions::new()));
store.register_late_pass(|| Box::new(utils::internal_lints::IfChainStyle));
store.register_late_pass(|| Box::new(utils::internal_lints::InvalidPaths));
store.register_late_pass(|| Box::new(utils::internal_lints::InterningDefinedSymbol::default()));
store.register_late_pass(|| Box::new(utils::internal_lints::LintWithoutLintPass::default()));
store.register_late_pass(|| Box::new(utils::internal_lints::MatchTypeOnDiagItem));
store.register_late_pass(|| Box::new(utils::internal_lints::OuterExpnDataPass));
}
store.register_late_pass(|| box utils::author::Author);
store.register_late_pass(|| box await_holding_invalid::AwaitHolding);
store.register_late_pass(|| box serde_api::SerdeApi);
store.register_late_pass(|| Box::new(utils::author::Author));
store.register_late_pass(|| Box::new(await_holding_invalid::AwaitHolding));
store.register_late_pass(|| Box::new(serde_api::SerdeApi));
let vec_box_size_threshold = conf.vec_box_size_threshold;
let type_complexity_threshold = conf.type_complexity_threshold;
store.register_late_pass(move || box types::Types::new(vec_box_size_threshold, type_complexity_threshold));
store.register_late_pass(|| box booleans::NonminimalBool);
store.register_late_pass(|| box needless_bitwise_bool::NeedlessBitwiseBool);
store.register_late_pass(|| box eq_op::EqOp);
store.register_late_pass(|| box enum_clike::UnportableVariant);
store.register_late_pass(|| box float_literal::FloatLiteral);
store.register_late_pass(move || Box::new(types::Types::new(vec_box_size_threshold, type_complexity_threshold)));
store.register_late_pass(|| Box::new(booleans::NonminimalBool));
store.register_late_pass(|| Box::new(needless_bitwise_bool::NeedlessBitwiseBool));
store.register_late_pass(|| Box::new(eq_op::EqOp));
store.register_late_pass(|| Box::new(enum_clike::UnportableVariant));
store.register_late_pass(|| Box::new(float_literal::FloatLiteral));
let verbose_bit_mask_threshold = conf.verbose_bit_mask_threshold;
store.register_late_pass(move || box bit_mask::BitMask::new(verbose_bit_mask_threshold));
store.register_late_pass(|| box ptr::Ptr);
store.register_late_pass(|| box ptr_eq::PtrEq);
store.register_late_pass(|| box needless_bool::NeedlessBool);
store.register_late_pass(|| box needless_bool::BoolComparison);
store.register_late_pass(|| box needless_for_each::NeedlessForEach);
store.register_late_pass(|| box approx_const::ApproxConstant);
store.register_late_pass(|| box misc::MiscLints);
store.register_late_pass(|| box eta_reduction::EtaReduction);
store.register_late_pass(|| box identity_op::IdentityOp);
store.register_late_pass(|| box erasing_op::ErasingOp);
store.register_late_pass(|| box mut_mut::MutMut);
store.register_late_pass(|| box mut_reference::UnnecessaryMutPassed);
store.register_late_pass(|| box len_zero::LenZero);
store.register_late_pass(|| box attrs::Attributes);
store.register_late_pass(|| box blocks_in_if_conditions::BlocksInIfConditions);
store.register_late_pass(|| box collapsible_match::CollapsibleMatch);
store.register_late_pass(|| box unicode::Unicode);
store.register_late_pass(|| box unit_return_expecting_ord::UnitReturnExpectingOrd);
store.register_late_pass(|| box strings::StringAdd);
store.register_late_pass(|| box implicit_return::ImplicitReturn);
store.register_late_pass(|| box implicit_saturating_sub::ImplicitSaturatingSub);
store.register_late_pass(|| box default_numeric_fallback::DefaultNumericFallback);
store.register_late_pass(|| box inconsistent_struct_constructor::InconsistentStructConstructor);
store.register_late_pass(|| box non_octal_unix_permissions::NonOctalUnixPermissions);
store.register_early_pass(|| box unnecessary_self_imports::UnnecessarySelfImports);
store.register_late_pass(move || Box::new(bit_mask::BitMask::new(verbose_bit_mask_threshold)));
store.register_late_pass(|| Box::new(ptr::Ptr));
store.register_late_pass(|| Box::new(ptr_eq::PtrEq));
store.register_late_pass(|| Box::new(needless_bool::NeedlessBool));
store.register_late_pass(|| Box::new(needless_bool::BoolComparison));
store.register_late_pass(|| Box::new(needless_for_each::NeedlessForEach));
store.register_late_pass(|| Box::new(approx_const::ApproxConstant));
store.register_late_pass(|| Box::new(misc::MiscLints));
store.register_late_pass(|| Box::new(eta_reduction::EtaReduction));
store.register_late_pass(|| Box::new(identity_op::IdentityOp));
store.register_late_pass(|| Box::new(erasing_op::ErasingOp));
store.register_late_pass(|| Box::new(mut_mut::MutMut));
store.register_late_pass(|| Box::new(mut_reference::UnnecessaryMutPassed));
store.register_late_pass(|| Box::new(len_zero::LenZero));
store.register_late_pass(|| Box::new(attrs::Attributes));
store.register_late_pass(|| Box::new(blocks_in_if_conditions::BlocksInIfConditions));
store.register_late_pass(|| Box::new(collapsible_match::CollapsibleMatch));
store.register_late_pass(|| Box::new(unicode::Unicode));
store.register_late_pass(|| Box::new(unit_return_expecting_ord::UnitReturnExpectingOrd));
store.register_late_pass(|| Box::new(strings::StringAdd));
store.register_late_pass(|| Box::new(implicit_return::ImplicitReturn));
store.register_late_pass(|| Box::new(implicit_saturating_sub::ImplicitSaturatingSub));
store.register_late_pass(|| Box::new(default_numeric_fallback::DefaultNumericFallback));
store.register_late_pass(|| Box::new(inconsistent_struct_constructor::InconsistentStructConstructor));
store.register_late_pass(|| Box::new(non_octal_unix_permissions::NonOctalUnixPermissions));
store.register_early_pass(|| Box::new(unnecessary_self_imports::UnnecessarySelfImports));
let msrv = conf.msrv.as_ref().and_then(|s| {
parse_msrv(s, None, None).or_else(|| {
@ -1878,231 +1877,231 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
});
let avoid_breaking_exported_api = conf.avoid_breaking_exported_api;
store.register_late_pass(move || box methods::Methods::new(avoid_breaking_exported_api, msrv));
store.register_late_pass(move || box matches::Matches::new(msrv));
store.register_early_pass(move || box manual_non_exhaustive::ManualNonExhaustive::new(msrv));
store.register_late_pass(move || box manual_strip::ManualStrip::new(msrv));
store.register_early_pass(move || box redundant_static_lifetimes::RedundantStaticLifetimes::new(msrv));
store.register_early_pass(move || box redundant_field_names::RedundantFieldNames::new(msrv));
store.register_late_pass(move || box checked_conversions::CheckedConversions::new(msrv));
store.register_late_pass(move || box mem_replace::MemReplace::new(msrv));
store.register_late_pass(move || box ranges::Ranges::new(msrv));
store.register_late_pass(move || box from_over_into::FromOverInto::new(msrv));
store.register_late_pass(move || box use_self::UseSelf::new(msrv));
store.register_late_pass(move || box missing_const_for_fn::MissingConstForFn::new(msrv));
store.register_late_pass(move || box needless_question_mark::NeedlessQuestionMark);
store.register_late_pass(move || box casts::Casts::new(msrv));
store.register_early_pass(move || box unnested_or_patterns::UnnestedOrPatterns::new(msrv));
store.register_late_pass(move || Box::new(methods::Methods::new(avoid_breaking_exported_api, msrv)));
store.register_late_pass(move || Box::new(matches::Matches::new(msrv)));
store.register_early_pass(move || Box::new(manual_non_exhaustive::ManualNonExhaustive::new(msrv)));
store.register_late_pass(move || Box::new(manual_strip::ManualStrip::new(msrv)));
store.register_early_pass(move || Box::new(redundant_static_lifetimes::RedundantStaticLifetimes::new(msrv)));
store.register_early_pass(move || Box::new(redundant_field_names::RedundantFieldNames::new(msrv)));
store.register_late_pass(move || Box::new(checked_conversions::CheckedConversions::new(msrv)));
store.register_late_pass(move || Box::new(mem_replace::MemReplace::new(msrv)));
store.register_late_pass(move || Box::new(ranges::Ranges::new(msrv)));
store.register_late_pass(move || Box::new(from_over_into::FromOverInto::new(msrv)));
store.register_late_pass(move || Box::new(use_self::UseSelf::new(msrv)));
store.register_late_pass(move || Box::new(missing_const_for_fn::MissingConstForFn::new(msrv)));
store.register_late_pass(move || Box::new(needless_question_mark::NeedlessQuestionMark));
store.register_late_pass(move || Box::new(casts::Casts::new(msrv)));
store.register_early_pass(move || Box::new(unnested_or_patterns::UnnestedOrPatterns::new(msrv)));
store.register_late_pass(|| box size_of_in_element_count::SizeOfInElementCount);
store.register_late_pass(|| box map_clone::MapClone);
store.register_late_pass(|| box map_err_ignore::MapErrIgnore);
store.register_late_pass(|| box shadow::Shadow);
store.register_late_pass(|| box unit_types::UnitTypes);
store.register_late_pass(|| box loops::Loops);
store.register_late_pass(|| box main_recursion::MainRecursion::default());
store.register_late_pass(|| box lifetimes::Lifetimes);
store.register_late_pass(|| box entry::HashMapPass);
store.register_late_pass(|| box minmax::MinMaxPass);
store.register_late_pass(|| box open_options::OpenOptions);
store.register_late_pass(|| box zero_div_zero::ZeroDiv);
store.register_late_pass(|| box mutex_atomic::Mutex);
store.register_late_pass(|| box needless_update::NeedlessUpdate);
store.register_late_pass(|| box needless_borrow::NeedlessBorrow::default());
store.register_late_pass(|| box needless_borrowed_ref::NeedlessBorrowedRef);
store.register_late_pass(|| box no_effect::NoEffect);
store.register_late_pass(|| box temporary_assignment::TemporaryAssignment);
store.register_late_pass(|| box transmute::Transmute);
store.register_late_pass(|| Box::new(size_of_in_element_count::SizeOfInElementCount));
store.register_late_pass(|| Box::new(map_clone::MapClone));
store.register_late_pass(|| Box::new(map_err_ignore::MapErrIgnore));
store.register_late_pass(|| Box::new(shadow::Shadow));
store.register_late_pass(|| Box::new(unit_types::UnitTypes));
store.register_late_pass(|| Box::new(loops::Loops));
store.register_late_pass(|| Box::new(main_recursion::MainRecursion::default()));
store.register_late_pass(|| Box::new(lifetimes::Lifetimes));
store.register_late_pass(|| Box::new(entry::HashMapPass));
store.register_late_pass(|| Box::new(minmax::MinMaxPass));
store.register_late_pass(|| Box::new(open_options::OpenOptions));
store.register_late_pass(|| Box::new(zero_div_zero::ZeroDiv));
store.register_late_pass(|| Box::new(mutex_atomic::Mutex));
store.register_late_pass(|| Box::new(needless_update::NeedlessUpdate));
store.register_late_pass(|| Box::new(needless_borrow::NeedlessBorrow::default()));
store.register_late_pass(|| Box::new(needless_borrowed_ref::NeedlessBorrowedRef));
store.register_late_pass(|| Box::new(no_effect::NoEffect));
store.register_late_pass(|| Box::new(temporary_assignment::TemporaryAssignment));
store.register_late_pass(|| Box::new(transmute::Transmute));
let cognitive_complexity_threshold = conf.cognitive_complexity_threshold;
store.register_late_pass(move || box cognitive_complexity::CognitiveComplexity::new(cognitive_complexity_threshold));
store.register_late_pass(move || Box::new(cognitive_complexity::CognitiveComplexity::new(cognitive_complexity_threshold)));
let too_large_for_stack = conf.too_large_for_stack;
store.register_late_pass(move || box escape::BoxedLocal{too_large_for_stack});
store.register_late_pass(move || box vec::UselessVec{too_large_for_stack});
store.register_late_pass(|| box panic_unimplemented::PanicUnimplemented);
store.register_late_pass(|| box strings::StringLitAsBytes);
store.register_late_pass(|| box derive::Derive);
store.register_late_pass(|| box get_last_with_len::GetLastWithLen);
store.register_late_pass(|| box drop_forget_ref::DropForgetRef);
store.register_late_pass(|| box empty_enum::EmptyEnum);
store.register_late_pass(|| box absurd_extreme_comparisons::AbsurdExtremeComparisons);
store.register_late_pass(|| box invalid_upcast_comparisons::InvalidUpcastComparisons);
store.register_late_pass(|| box regex::Regex::default());
store.register_late_pass(|| box copies::CopyAndPaste);
store.register_late_pass(|| box copy_iterator::CopyIterator);
store.register_late_pass(|| box format::UselessFormat);
store.register_late_pass(|| box swap::Swap);
store.register_late_pass(|| box overflow_check_conditional::OverflowCheckConditional);
store.register_late_pass(|| box new_without_default::NewWithoutDefault::default());
store.register_late_pass(move || Box::new(escape::BoxedLocal{too_large_for_stack}));
store.register_late_pass(move || Box::new(vec::UselessVec{too_large_for_stack}));
store.register_late_pass(|| Box::new(panic_unimplemented::PanicUnimplemented));
store.register_late_pass(|| Box::new(strings::StringLitAsBytes));
store.register_late_pass(|| Box::new(derive::Derive));
store.register_late_pass(|| Box::new(get_last_with_len::GetLastWithLen));
store.register_late_pass(|| Box::new(drop_forget_ref::DropForgetRef));
store.register_late_pass(|| Box::new(empty_enum::EmptyEnum));
store.register_late_pass(|| Box::new(absurd_extreme_comparisons::AbsurdExtremeComparisons));
store.register_late_pass(|| Box::new(invalid_upcast_comparisons::InvalidUpcastComparisons));
store.register_late_pass(|| Box::new(regex::Regex::default()));
store.register_late_pass(|| Box::new(copies::CopyAndPaste));
store.register_late_pass(|| Box::new(copy_iterator::CopyIterator));
store.register_late_pass(|| Box::new(format::UselessFormat));
store.register_late_pass(|| Box::new(swap::Swap));
store.register_late_pass(|| Box::new(overflow_check_conditional::OverflowCheckConditional));
store.register_late_pass(|| Box::new(new_without_default::NewWithoutDefault::default()));
let blacklisted_names = conf.blacklisted_names.iter().cloned().collect::<FxHashSet<_>>();
store.register_late_pass(move || box blacklisted_name::BlacklistedName::new(blacklisted_names.clone()));
store.register_late_pass(move || Box::new(blacklisted_name::BlacklistedName::new(blacklisted_names.clone())));
let too_many_arguments_threshold = conf.too_many_arguments_threshold;
let too_many_lines_threshold = conf.too_many_lines_threshold;
store.register_late_pass(move || box functions::Functions::new(too_many_arguments_threshold, too_many_lines_threshold));
store.register_late_pass(move || Box::new(functions::Functions::new(too_many_arguments_threshold, too_many_lines_threshold)));
let doc_valid_idents = conf.doc_valid_idents.iter().cloned().collect::<FxHashSet<_>>();
store.register_late_pass(move || box doc::DocMarkdown::new(doc_valid_idents.clone()));
store.register_late_pass(|| box neg_multiply::NegMultiply);
store.register_late_pass(|| box mem_discriminant::MemDiscriminant);
store.register_late_pass(|| box mem_forget::MemForget);
store.register_late_pass(|| box arithmetic::Arithmetic::default());
store.register_late_pass(|| box assign_ops::AssignOps);
store.register_late_pass(|| box let_if_seq::LetIfSeq);
store.register_late_pass(|| box eval_order_dependence::EvalOrderDependence);
store.register_late_pass(|| box missing_doc::MissingDoc::new());
store.register_late_pass(|| box missing_inline::MissingInline);
store.register_late_pass(move || box exhaustive_items::ExhaustiveItems);
store.register_late_pass(|| box if_let_some_result::OkIfLet);
store.register_late_pass(|| box partialeq_ne_impl::PartialEqNeImpl);
store.register_late_pass(|| box unused_io_amount::UnusedIoAmount);
store.register_late_pass(move || Box::new(doc::DocMarkdown::new(doc_valid_idents.clone())));
store.register_late_pass(|| Box::new(neg_multiply::NegMultiply));
store.register_late_pass(|| Box::new(mem_discriminant::MemDiscriminant));
store.register_late_pass(|| Box::new(mem_forget::MemForget));
store.register_late_pass(|| Box::new(arithmetic::Arithmetic::default()));
store.register_late_pass(|| Box::new(assign_ops::AssignOps));
store.register_late_pass(|| Box::new(let_if_seq::LetIfSeq));
store.register_late_pass(|| Box::new(eval_order_dependence::EvalOrderDependence));
store.register_late_pass(|| Box::new(missing_doc::MissingDoc::new()));
store.register_late_pass(|| Box::new(missing_inline::MissingInline));
store.register_late_pass(move || Box::new(exhaustive_items::ExhaustiveItems));
store.register_late_pass(|| Box::new(if_let_some_result::OkIfLet));
store.register_late_pass(|| Box::new(partialeq_ne_impl::PartialEqNeImpl));
store.register_late_pass(|| Box::new(unused_io_amount::UnusedIoAmount));
let enum_variant_size_threshold = conf.enum_variant_size_threshold;
store.register_late_pass(move || box large_enum_variant::LargeEnumVariant::new(enum_variant_size_threshold));
store.register_late_pass(|| box explicit_write::ExplicitWrite);
store.register_late_pass(|| box needless_pass_by_value::NeedlessPassByValue);
store.register_late_pass(move || Box::new(large_enum_variant::LargeEnumVariant::new(enum_variant_size_threshold)));
store.register_late_pass(|| Box::new(explicit_write::ExplicitWrite));
store.register_late_pass(|| Box::new(needless_pass_by_value::NeedlessPassByValue));
let pass_by_ref_or_value = pass_by_ref_or_value::PassByRefOrValue::new(
conf.trivial_copy_size_limit,
conf.pass_by_value_size_limit,
conf.avoid_breaking_exported_api,
&sess.target,
);
store.register_late_pass(move || box pass_by_ref_or_value);
store.register_late_pass(|| box ref_option_ref::RefOptionRef);
store.register_late_pass(|| box try_err::TryErr);
store.register_late_pass(|| box bytecount::ByteCount);
store.register_late_pass(|| box infinite_iter::InfiniteIter);
store.register_late_pass(|| box inline_fn_without_body::InlineFnWithoutBody);
store.register_late_pass(|| box useless_conversion::UselessConversion::default());
store.register_late_pass(|| box implicit_hasher::ImplicitHasher);
store.register_late_pass(|| box fallible_impl_from::FallibleImplFrom);
store.register_late_pass(|| box double_comparison::DoubleComparisons);
store.register_late_pass(|| box question_mark::QuestionMark);
store.register_early_pass(|| box suspicious_operation_groupings::SuspiciousOperationGroupings);
store.register_late_pass(|| box suspicious_trait_impl::SuspiciousImpl);
store.register_late_pass(|| box map_unit_fn::MapUnit);
store.register_late_pass(|| box inherent_impl::MultipleInherentImpl);
store.register_late_pass(|| box neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd);
store.register_late_pass(|| box unwrap::Unwrap);
store.register_late_pass(|| box duration_subsec::DurationSubsec);
store.register_late_pass(|| box indexing_slicing::IndexingSlicing);
store.register_late_pass(|| box non_copy_const::NonCopyConst);
store.register_late_pass(|| box ptr_offset_with_cast::PtrOffsetWithCast);
store.register_late_pass(|| box redundant_clone::RedundantClone);
store.register_late_pass(|| box slow_vector_initialization::SlowVectorInit);
store.register_late_pass(|| box unnecessary_sort_by::UnnecessarySortBy);
store.register_late_pass(move || box unnecessary_wraps::UnnecessaryWraps::new(avoid_breaking_exported_api));
store.register_late_pass(|| box assertions_on_constants::AssertionsOnConstants);
store.register_late_pass(|| box transmuting_null::TransmutingNull);
store.register_late_pass(|| box path_buf_push_overwrite::PathBufPushOverwrite);
store.register_late_pass(|| box integer_division::IntegerDivision);
store.register_late_pass(|| box inherent_to_string::InherentToString);
store.register_late_pass(move || Box::new(pass_by_ref_or_value));
store.register_late_pass(|| Box::new(ref_option_ref::RefOptionRef));
store.register_late_pass(|| Box::new(try_err::TryErr));
store.register_late_pass(|| Box::new(bytecount::ByteCount));
store.register_late_pass(|| Box::new(infinite_iter::InfiniteIter));
store.register_late_pass(|| Box::new(inline_fn_without_body::InlineFnWithoutBody));
store.register_late_pass(|| Box::new(useless_conversion::UselessConversion::default()));
store.register_late_pass(|| Box::new(implicit_hasher::ImplicitHasher));
store.register_late_pass(|| Box::new(fallible_impl_from::FallibleImplFrom));
store.register_late_pass(|| Box::new(double_comparison::DoubleComparisons));
store.register_late_pass(|| Box::new(question_mark::QuestionMark));
store.register_early_pass(|| Box::new(suspicious_operation_groupings::SuspiciousOperationGroupings));
store.register_late_pass(|| Box::new(suspicious_trait_impl::SuspiciousImpl));
store.register_late_pass(|| Box::new(map_unit_fn::MapUnit));
store.register_late_pass(|| Box::new(inherent_impl::MultipleInherentImpl));
store.register_late_pass(|| Box::new(neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd));
store.register_late_pass(|| Box::new(unwrap::Unwrap));
store.register_late_pass(|| Box::new(duration_subsec::DurationSubsec));
store.register_late_pass(|| Box::new(indexing_slicing::IndexingSlicing));
store.register_late_pass(|| Box::new(non_copy_const::NonCopyConst));
store.register_late_pass(|| Box::new(ptr_offset_with_cast::PtrOffsetWithCast));
store.register_late_pass(|| Box::new(redundant_clone::RedundantClone));
store.register_late_pass(|| Box::new(slow_vector_initialization::SlowVectorInit));
store.register_late_pass(|| Box::new(unnecessary_sort_by::UnnecessarySortBy));
store.register_late_pass(move || Box::new(unnecessary_wraps::UnnecessaryWraps::new(avoid_breaking_exported_api)));
store.register_late_pass(|| Box::new(assertions_on_constants::AssertionsOnConstants));
store.register_late_pass(|| Box::new(transmuting_null::TransmutingNull));
store.register_late_pass(|| Box::new(path_buf_push_overwrite::PathBufPushOverwrite));
store.register_late_pass(|| Box::new(integer_division::IntegerDivision));
store.register_late_pass(|| Box::new(inherent_to_string::InherentToString));
let max_trait_bounds = conf.max_trait_bounds;
store.register_late_pass(move || box trait_bounds::TraitBounds::new(max_trait_bounds));
store.register_late_pass(|| box comparison_chain::ComparisonChain);
store.register_late_pass(|| box mut_key::MutableKeyType);
store.register_late_pass(|| box modulo_arithmetic::ModuloArithmetic);
store.register_early_pass(|| box reference::DerefAddrOf);
store.register_early_pass(|| box reference::RefInDeref);
store.register_early_pass(|| box double_parens::DoubleParens);
store.register_late_pass(|| box to_string_in_display::ToStringInDisplay::new());
store.register_early_pass(|| box unsafe_removed_from_name::UnsafeNameRemoval);
store.register_early_pass(|| box if_not_else::IfNotElse);
store.register_early_pass(|| box else_if_without_else::ElseIfWithoutElse);
store.register_early_pass(|| box int_plus_one::IntPlusOne);
store.register_early_pass(|| box formatting::Formatting);
store.register_early_pass(|| box misc_early::MiscEarlyLints);
store.register_early_pass(|| box redundant_closure_call::RedundantClosureCall);
store.register_late_pass(|| box redundant_closure_call::RedundantClosureCall);
store.register_early_pass(|| box unused_unit::UnusedUnit);
store.register_late_pass(|| box returns::Return);
store.register_early_pass(|| box collapsible_if::CollapsibleIf);
store.register_early_pass(|| box items_after_statements::ItemsAfterStatements);
store.register_early_pass(|| box precedence::Precedence);
store.register_early_pass(|| box needless_continue::NeedlessContinue);
store.register_early_pass(|| box redundant_else::RedundantElse);
store.register_late_pass(|| box create_dir::CreateDir);
store.register_early_pass(|| box needless_arbitrary_self_type::NeedlessArbitrarySelfType);
store.register_late_pass(move || Box::new(trait_bounds::TraitBounds::new(max_trait_bounds)));
store.register_late_pass(|| Box::new(comparison_chain::ComparisonChain));
store.register_late_pass(|| Box::new(mut_key::MutableKeyType));
store.register_late_pass(|| Box::new(modulo_arithmetic::ModuloArithmetic));
store.register_early_pass(|| Box::new(reference::DerefAddrOf));
store.register_early_pass(|| Box::new(reference::RefInDeref));
store.register_early_pass(|| Box::new(double_parens::DoubleParens));
store.register_late_pass(|| Box::new(to_string_in_display::ToStringInDisplay::new()));
store.register_early_pass(|| Box::new(unsafe_removed_from_name::UnsafeNameRemoval));
store.register_early_pass(|| Box::new(if_not_else::IfNotElse));
store.register_early_pass(|| Box::new(else_if_without_else::ElseIfWithoutElse));
store.register_early_pass(|| Box::new(int_plus_one::IntPlusOne));
store.register_early_pass(|| Box::new(formatting::Formatting));
store.register_early_pass(|| Box::new(misc_early::MiscEarlyLints));
store.register_early_pass(|| Box::new(redundant_closure_call::RedundantClosureCall));
store.register_late_pass(|| Box::new(redundant_closure_call::RedundantClosureCall));
store.register_early_pass(|| Box::new(unused_unit::UnusedUnit));
store.register_late_pass(|| Box::new(returns::Return));
store.register_early_pass(|| Box::new(collapsible_if::CollapsibleIf));
store.register_early_pass(|| Box::new(items_after_statements::ItemsAfterStatements));
store.register_early_pass(|| Box::new(precedence::Precedence));
store.register_early_pass(|| Box::new(needless_continue::NeedlessContinue));
store.register_early_pass(|| Box::new(redundant_else::RedundantElse));
store.register_late_pass(|| Box::new(create_dir::CreateDir));
store.register_early_pass(|| Box::new(needless_arbitrary_self_type::NeedlessArbitrarySelfType));
let cargo_ignore_publish = conf.cargo_ignore_publish;
store.register_late_pass(move || box cargo_common_metadata::CargoCommonMetadata::new(cargo_ignore_publish));
store.register_late_pass(|| box multiple_crate_versions::MultipleCrateVersions);
store.register_late_pass(|| box wildcard_dependencies::WildcardDependencies);
store.register_late_pass(move || Box::new(cargo_common_metadata::CargoCommonMetadata::new(cargo_ignore_publish)));
store.register_late_pass(|| Box::new(multiple_crate_versions::MultipleCrateVersions));
store.register_late_pass(|| Box::new(wildcard_dependencies::WildcardDependencies));
let literal_representation_lint_fraction_readability = conf.unreadable_literal_lint_fractions;
store.register_early_pass(move || box literal_representation::LiteralDigitGrouping::new(literal_representation_lint_fraction_readability));
store.register_early_pass(move || Box::new(literal_representation::LiteralDigitGrouping::new(literal_representation_lint_fraction_readability)));
let literal_representation_threshold = conf.literal_representation_threshold;
store.register_early_pass(move || box literal_representation::DecimalLiteralRepresentation::new(literal_representation_threshold));
store.register_early_pass(move || Box::new(literal_representation::DecimalLiteralRepresentation::new(literal_representation_threshold)));
let enum_variant_name_threshold = conf.enum_variant_name_threshold;
store.register_late_pass(move || box enum_variants::EnumVariantNames::new(enum_variant_name_threshold, avoid_breaking_exported_api));
store.register_early_pass(|| box tabs_in_doc_comments::TabsInDocComments);
store.register_late_pass(move || Box::new(enum_variants::EnumVariantNames::new(enum_variant_name_threshold, avoid_breaking_exported_api)));
store.register_early_pass(|| Box::new(tabs_in_doc_comments::TabsInDocComments));
let upper_case_acronyms_aggressive = conf.upper_case_acronyms_aggressive;
store.register_late_pass(move || box upper_case_acronyms::UpperCaseAcronyms::new(avoid_breaking_exported_api, upper_case_acronyms_aggressive));
store.register_late_pass(|| box default::Default::default());
store.register_late_pass(|| box unused_self::UnusedSelf);
store.register_late_pass(|| box mutable_debug_assertion::DebugAssertWithMutCall);
store.register_late_pass(|| box exit::Exit);
store.register_late_pass(|| box to_digit_is_some::ToDigitIsSome);
store.register_late_pass(move || Box::new(upper_case_acronyms::UpperCaseAcronyms::new(avoid_breaking_exported_api, upper_case_acronyms_aggressive)));
store.register_late_pass(|| Box::new(default::Default::default()));
store.register_late_pass(|| Box::new(unused_self::UnusedSelf));
store.register_late_pass(|| Box::new(mutable_debug_assertion::DebugAssertWithMutCall));
store.register_late_pass(|| Box::new(exit::Exit));
store.register_late_pass(|| Box::new(to_digit_is_some::ToDigitIsSome));
let array_size_threshold = conf.array_size_threshold;
store.register_late_pass(move || box large_stack_arrays::LargeStackArrays::new(array_size_threshold));
store.register_late_pass(move || box large_const_arrays::LargeConstArrays::new(array_size_threshold));
store.register_late_pass(|| box floating_point_arithmetic::FloatingPointArithmetic);
store.register_early_pass(|| box as_conversions::AsConversions);
store.register_late_pass(|| box let_underscore::LetUnderscore);
store.register_early_pass(|| box single_component_path_imports::SingleComponentPathImports);
store.register_late_pass(move || Box::new(large_stack_arrays::LargeStackArrays::new(array_size_threshold)));
store.register_late_pass(move || Box::new(large_const_arrays::LargeConstArrays::new(array_size_threshold)));
store.register_late_pass(|| Box::new(floating_point_arithmetic::FloatingPointArithmetic));
store.register_early_pass(|| Box::new(as_conversions::AsConversions));
store.register_late_pass(|| Box::new(let_underscore::LetUnderscore));
store.register_early_pass(|| Box::new(single_component_path_imports::SingleComponentPathImports));
let max_fn_params_bools = conf.max_fn_params_bools;
let max_struct_bools = conf.max_struct_bools;
store.register_early_pass(move || box excessive_bools::ExcessiveBools::new(max_struct_bools, max_fn_params_bools));
store.register_early_pass(|| box option_env_unwrap::OptionEnvUnwrap);
store.register_early_pass(move || Box::new(excessive_bools::ExcessiveBools::new(max_struct_bools, max_fn_params_bools)));
store.register_early_pass(|| Box::new(option_env_unwrap::OptionEnvUnwrap));
let warn_on_all_wildcard_imports = conf.warn_on_all_wildcard_imports;
store.register_late_pass(move || box wildcard_imports::WildcardImports::new(warn_on_all_wildcard_imports));
store.register_late_pass(|| box verbose_file_reads::VerboseFileReads);
store.register_late_pass(|| box redundant_pub_crate::RedundantPubCrate::default());
store.register_late_pass(|| box unnamed_address::UnnamedAddress);
store.register_late_pass(|| box dereference::Dereferencing::default());
store.register_late_pass(|| box option_if_let_else::OptionIfLetElse);
store.register_late_pass(|| box future_not_send::FutureNotSend);
store.register_late_pass(|| box if_let_mutex::IfLetMutex);
store.register_late_pass(|| box mut_mutex_lock::MutMutexLock);
store.register_late_pass(|| box match_on_vec_items::MatchOnVecItems);
store.register_late_pass(|| box manual_async_fn::ManualAsyncFn);
store.register_late_pass(|| box vec_resize_to_zero::VecResizeToZero);
store.register_late_pass(|| box panic_in_result_fn::PanicInResultFn);
store.register_late_pass(move || Box::new(wildcard_imports::WildcardImports::new(warn_on_all_wildcard_imports)));
store.register_late_pass(|| Box::new(verbose_file_reads::VerboseFileReads));
store.register_late_pass(|| Box::new(redundant_pub_crate::RedundantPubCrate::default()));
store.register_late_pass(|| Box::new(unnamed_address::UnnamedAddress));
store.register_late_pass(|| Box::new(dereference::Dereferencing::default()));
store.register_late_pass(|| Box::new(option_if_let_else::OptionIfLetElse));
store.register_late_pass(|| Box::new(future_not_send::FutureNotSend));
store.register_late_pass(|| Box::new(if_let_mutex::IfLetMutex));
store.register_late_pass(|| Box::new(mut_mutex_lock::MutMutexLock));
store.register_late_pass(|| Box::new(match_on_vec_items::MatchOnVecItems));
store.register_late_pass(|| Box::new(manual_async_fn::ManualAsyncFn));
store.register_late_pass(|| Box::new(vec_resize_to_zero::VecResizeToZero));
store.register_late_pass(|| Box::new(panic_in_result_fn::PanicInResultFn));
let single_char_binding_names_threshold = conf.single_char_binding_names_threshold;
store.register_early_pass(move || box non_expressive_names::NonExpressiveNames {
store.register_early_pass(move || Box::new(non_expressive_names::NonExpressiveNames {
single_char_binding_names_threshold,
});
}));
let macro_matcher = conf.standard_macro_braces.iter().cloned().collect::<FxHashSet<_>>();
store.register_early_pass(move || box nonstandard_macro_braces::MacroBraces::new(&macro_matcher));
store.register_late_pass(|| box macro_use::MacroUseImports::default());
store.register_late_pass(|| box pattern_type_mismatch::PatternTypeMismatch);
store.register_late_pass(|| box stable_sort_primitive::StableSortPrimitive);
store.register_late_pass(|| box repeat_once::RepeatOnce);
store.register_late_pass(|| box unwrap_in_result::UnwrapInResult);
store.register_late_pass(|| box self_assignment::SelfAssignment);
store.register_late_pass(|| box manual_unwrap_or::ManualUnwrapOr);
store.register_late_pass(|| box manual_ok_or::ManualOkOr);
store.register_late_pass(|| box float_equality_without_abs::FloatEqualityWithoutAbs);
store.register_late_pass(|| box semicolon_if_nothing_returned::SemicolonIfNothingReturned);
store.register_late_pass(|| box async_yields_async::AsyncYieldsAsync);
store.register_early_pass(move || Box::new(nonstandard_macro_braces::MacroBraces::new(&macro_matcher)));
store.register_late_pass(|| Box::new(macro_use::MacroUseImports::default()));
store.register_late_pass(|| Box::new(pattern_type_mismatch::PatternTypeMismatch));
store.register_late_pass(|| Box::new(stable_sort_primitive::StableSortPrimitive));
store.register_late_pass(|| Box::new(repeat_once::RepeatOnce));
store.register_late_pass(|| Box::new(unwrap_in_result::UnwrapInResult));
store.register_late_pass(|| Box::new(self_assignment::SelfAssignment));
store.register_late_pass(|| Box::new(manual_unwrap_or::ManualUnwrapOr));
store.register_late_pass(|| Box::new(manual_ok_or::ManualOkOr));
store.register_late_pass(|| Box::new(float_equality_without_abs::FloatEqualityWithoutAbs));
store.register_late_pass(|| Box::new(semicolon_if_nothing_returned::SemicolonIfNothingReturned));
store.register_late_pass(|| Box::new(async_yields_async::AsyncYieldsAsync));
let disallowed_methods = conf.disallowed_methods.iter().cloned().collect::<FxHashSet<_>>();
store.register_late_pass(move || box disallowed_method::DisallowedMethod::new(&disallowed_methods));
store.register_early_pass(|| box asm_syntax::InlineAsmX86AttSyntax);
store.register_early_pass(|| box asm_syntax::InlineAsmX86IntelSyntax);
store.register_late_pass(|| box undropped_manually_drops::UndroppedManuallyDrops);
store.register_late_pass(|| box strings::StrToString);
store.register_late_pass(|| box strings::StringToString);
store.register_late_pass(|| box zero_sized_map_values::ZeroSizedMapValues);
store.register_late_pass(|| box vec_init_then_push::VecInitThenPush::default());
store.register_late_pass(|| box case_sensitive_file_extension_comparisons::CaseSensitiveFileExtensionComparisons);
store.register_late_pass(|| box redundant_slicing::RedundantSlicing);
store.register_late_pass(|| box from_str_radix_10::FromStrRadix10);
store.register_late_pass(|| box manual_map::ManualMap);
store.register_late_pass(move || box if_then_some_else_none::IfThenSomeElseNone::new(msrv));
store.register_early_pass(|| box bool_assert_comparison::BoolAssertComparison);
store.register_late_pass(|| box unused_async::UnusedAsync);
store.register_late_pass(move || Box::new(disallowed_method::DisallowedMethod::new(&disallowed_methods)));
store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86AttSyntax));
store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86IntelSyntax));
store.register_late_pass(|| Box::new(undropped_manually_drops::UndroppedManuallyDrops));
store.register_late_pass(|| Box::new(strings::StrToString));
store.register_late_pass(|| Box::new(strings::StringToString));
store.register_late_pass(|| Box::new(zero_sized_map_values::ZeroSizedMapValues));
store.register_late_pass(|| Box::new(vec_init_then_push::VecInitThenPush::default()));
store.register_late_pass(|| Box::new(case_sensitive_file_extension_comparisons::CaseSensitiveFileExtensionComparisons));
store.register_late_pass(|| Box::new(redundant_slicing::RedundantSlicing));
store.register_late_pass(|| Box::new(from_str_radix_10::FromStrRadix10));
store.register_late_pass(|| Box::new(manual_map::ManualMap));
store.register_late_pass(move || Box::new(if_then_some_else_none::IfThenSomeElseNone::new(msrv)));
store.register_early_pass(|| Box::new(bool_assert_comparison::BoolAssertComparison));
store.register_late_pass(|| Box::new(unused_async::UnusedAsync));
let disallowed_types = conf.disallowed_types.iter().cloned().collect::<FxHashSet<_>>();
store.register_late_pass(move || box disallowed_type::DisallowedType::new(&disallowed_types));
store.register_late_pass(move || Box::new(disallowed_type::DisallowedType::new(&disallowed_types)));
let import_renames = conf.enforced_import_renames.clone();
store.register_late_pass(move || box missing_enforced_import_rename::ImportRename::new(import_renames.clone()));
store.register_late_pass(move || Box::new(missing_enforced_import_rename::ImportRename::new(import_renames.clone())));
let scripts = conf.allowed_scripts.clone();
store.register_early_pass(move || box disallowed_script_idents::DisallowedScriptIdents::new(&scripts));
store.register_late_pass(|| box strlen_on_c_strings::StrlenOnCStrings);
store.register_late_pass(move || box self_named_constructors::SelfNamedConstructors);
store.register_early_pass(move || Box::new(disallowed_script_idents::DisallowedScriptIdents::new(&scripts)));
store.register_late_pass(|| Box::new(strlen_on_c_strings::StrlenOnCStrings));
store.register_late_pass(move || Box::new(self_named_constructors::SelfNamedConstructors));
}
#[rustfmt::skip]