Skip to content

Commit 27a46ff

Browse files
committed
Rustup to rustc 1.44.0-nightly (45d050cde 2020-04-21)
Remove the `<Box<F> as FnOnce>::call_once` hack now that rust-lang/rust#71170 is merged.
1 parent 5a6d9e1 commit 27a46ff

File tree

2 files changed

+1
-82
lines changed

2 files changed

+1
-82
lines changed

Diff for: rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2020-04-17
1+
nightly-2020-04-22

Diff for: src/base.rs

-81
Original file line numberDiff line numberDiff line change
@@ -58,92 +58,11 @@ pub(crate) fn trans_fn<'clif, 'tcx, B: Backend + 'static>(
5858
};
5959

6060
let arg_uninhabited = fx.mir.args_iter().any(|arg| fx.layout_of(fx.monomorphize(&fx.mir.local_decls[arg].ty)).abi.is_uninhabited());
61-
let is_call_once_for_box = name.starts_with("_ZN83_$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$9call_once");
6261

6362
if arg_uninhabited {
6463
fx.bcx.append_block_params_for_function_params(fx.block_map[START_BLOCK]);
6564
fx.bcx.switch_to_block(fx.block_map[START_BLOCK]);
6665
crate::trap::trap_unreachable(&mut fx, "function has uninhabited argument");
67-
} else if is_call_once_for_box {
68-
// HACK implement `<Box<F> as FnOnce>::call_once` without `alloca`.
69-
tcx.sess.time("codegen prelude", || crate::abi::codegen_fn_prelude(&mut fx, start_block, false));
70-
fx.bcx.switch_to_block(fx.block_map[START_BLOCK]);
71-
let bb_data = &fx.mir.basic_blocks()[START_BLOCK];
72-
let destination = match &bb_data.terminator().kind {
73-
TerminatorKind::Call {
74-
func,
75-
args,
76-
destination,
77-
cleanup: _,
78-
from_hir_call: _,
79-
} => {
80-
assert_eq!(args.len(), 2);
81-
82-
let closure_arg = Local::new(1);
83-
let closure_local = args[0].place().unwrap().as_local().unwrap();
84-
assert_eq!(fx.mir.local_decls[closure_local].ty, fx.mir.local_decls[closure_arg].ty.builtin_deref(true).unwrap().ty);
85-
let closure_deref = fx.local_map[&closure_arg].place_deref(&mut fx);
86-
fx.local_map.insert(closure_local, closure_deref);
87-
88-
let args_arg = Local::new(2);
89-
let args_local = args[1].place().unwrap().as_local().unwrap();
90-
assert_eq!(fx.mir.local_decls[args_local].ty, fx.mir.local_decls[args_arg].ty);
91-
fx.local_map.insert(args_local, fx.local_map[&args_arg]);
92-
93-
fx.tcx.sess.time("codegen call", || crate::abi::codegen_terminator_call(
94-
&mut fx,
95-
bb_data.terminator().source_info.span,
96-
func,
97-
args,
98-
*destination,
99-
));
100-
destination.map(|(_ret_place, ret_block)| ret_block)
101-
}
102-
_ => unreachable!(),
103-
};
104-
105-
let destination = if let Some(destination) = destination {
106-
fx.bcx.switch_to_block(fx.block_map[destination]);
107-
let bb_data = &fx.mir.basic_blocks()[destination];
108-
match &bb_data.terminator().kind {
109-
TerminatorKind::Call {
110-
func,
111-
args,
112-
destination,
113-
cleanup: _,
114-
from_hir_call: _,
115-
} => {
116-
match destination {
117-
Some((ret_place, _ret_block)) => {
118-
fx.local_map.insert(ret_place.as_local().unwrap(), CPlace::no_place(fx.layout_of(fx.tcx.mk_unit())));
119-
}
120-
None => {}
121-
}
122-
123-
assert_eq!(args.len(), 1);
124-
fx.tcx.sess.time("codegen call", || crate::abi::codegen_terminator_call(
125-
&mut fx,
126-
bb_data.terminator().source_info.span,
127-
func,
128-
args,
129-
*destination,
130-
));
131-
destination.map(|(_ret_place, ret_block)| ret_block)
132-
}
133-
_ => unreachable!(),
134-
}
135-
} else {
136-
None
137-
};
138-
139-
if let Some(destination) = destination {
140-
fx.bcx.switch_to_block(fx.block_map[destination]);
141-
let bb_data = &fx.mir.basic_blocks()[destination];
142-
match &bb_data.terminator().kind {
143-
TerminatorKind::Return => crate::abi::codegen_return(&mut fx),
144-
_ => unreachable!(),
145-
}
146-
}
14766
} else {
14867
tcx.sess.time("codegen clif ir", || {
14968
tcx.sess.time("codegen prelude", || crate::abi::codegen_fn_prelude(&mut fx, start_block, true));

0 commit comments

Comments
 (0)