Skip to content

Commit 88c48cd

Browse files
committed
Sync from rust 74509131e85a97353c67c503ea32e148a56cf4bd
2 parents 7a8d368 + 6412cfb commit 88c48cd

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

src/abi/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,9 @@ pub(crate) fn codegen_terminator_call<'tcx>(
443443
Err(instance) => Some(instance),
444444
}
445445
}
446-
InstanceKind::DropGlue(_, None) | ty::InstanceKind::AsyncDropGlueCtorShim(_, None) => {
446+
// We don't need AsyncDropGlueCtorShim here because it is not `noop func`,
447+
// it is `func returning noop future`
448+
InstanceKind::DropGlue(_, None) => {
447449
// empty drop glue - a nop.
448450
let dest = target.expect("Non terminating drop_in_place_real???");
449451
let ret_block = fx.get_block(dest);
@@ -713,9 +715,8 @@ pub(crate) fn codegen_drop<'tcx>(
713715
let drop_instance = Instance::resolve_drop_in_place(fx.tcx, ty);
714716
let ret_block = fx.get_block(target);
715717

716-
if let ty::InstanceKind::DropGlue(_, None) | ty::InstanceKind::AsyncDropGlueCtorShim(_, None) =
717-
drop_instance.def
718-
{
718+
// AsyncDropGlueCtorShim can't be here
719+
if let ty::InstanceKind::DropGlue(_, None) = drop_instance.def {
719720
// we don't actually need to drop anything
720721
fx.bcx.ins().jump(ret_block, &[]);
721722
} else {

src/base.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,11 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
582582
| TerminatorKind::CoroutineDrop => {
583583
bug!("shouldn't exist at codegen {:?}", bb_data.terminator());
584584
}
585-
TerminatorKind::Drop { place, target, unwind, replace: _ } => {
585+
TerminatorKind::Drop { place, target, unwind, replace: _, drop, async_fut } => {
586+
assert!(
587+
async_fut.is_none() && drop.is_none(),
588+
"Async Drop must be expanded or reset to sync before codegen"
589+
);
586590
let drop_place = codegen_place(fx, *place);
587591
crate::abi::codegen_drop(fx, source_info, drop_place, *target, *unwind);
588592
}

src/lib.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ use std::sync::Arc;
4141

4242
use cranelift_codegen::isa::TargetIsa;
4343
use cranelift_codegen::settings::{self, Configurable};
44-
use rustc_codegen_ssa::CodegenResults;
4544
use rustc_codegen_ssa::traits::CodegenBackend;
45+
use rustc_codegen_ssa::{CodegenResults, TargetConfig};
4646
use rustc_metadata::EncodedMetadata;
4747
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
4848
use rustc_session::Session;
@@ -177,7 +177,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
177177
}
178178
}
179179

180-
fn target_features_cfg(&self, sess: &Session) -> (Vec<Symbol>, Vec<Symbol>) {
180+
fn target_config(&self, sess: &Session) -> TargetConfig {
181181
// FIXME return the actually used target features. this is necessary for #[cfg(target_feature)]
182182
let target_features = if sess.target.arch == "x86_64" && sess.target.os != "none" {
183183
// x86_64 mandates SSE2 support and rustc requires the x87 feature to be enabled
@@ -196,7 +196,16 @@ impl CodegenBackend for CraneliftCodegenBackend {
196196
};
197197
// FIXME do `unstable_target_features` properly
198198
let unstable_target_features = target_features.clone();
199-
(target_features, unstable_target_features)
199+
200+
TargetConfig {
201+
target_features,
202+
unstable_target_features,
203+
// Cranelift does not yet support f16 or f128
204+
has_reliable_f16: false,
205+
has_reliable_f16_math: false,
206+
has_reliable_f128: false,
207+
has_reliable_f128_math: false,
208+
}
200209
}
201210

202211
fn print_version(&self) {

0 commit comments

Comments
 (0)