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:
commit
ba8cda2fa2
72 changed files with 549 additions and 505 deletions
|
@ -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)]
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)]
|
||||
|
||||
|
|
|
@ -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"))]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)),
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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<_>>(),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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)),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
|
@ -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())),
|
||||
)),
|
||||
))),
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 };
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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),
|
||||
}),
|
||||
})),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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)) };
|
||||
|
|
|
@ -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))))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 }));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"]
|
||||
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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)?))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
}),
|
||||
})),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue