Sync from rust 35b658fb10
This commit is contained in:
commit
29bc1a5cc0
@ -371,8 +371,13 @@ pub(crate) fn codegen_terminator_call<'tcx>(
|
||||
|
||||
// Handle special calls like intrinsics and empty drop glue.
|
||||
let instance = if let ty::FnDef(def_id, fn_args) = *func.layout().ty.kind() {
|
||||
let instance =
|
||||
ty::Instance::expect_resolve(fx.tcx, ty::ParamEnv::reveal_all(), def_id, fn_args)
|
||||
let instance = ty::Instance::expect_resolve(
|
||||
fx.tcx,
|
||||
ty::ParamEnv::reveal_all(),
|
||||
def_id,
|
||||
fn_args,
|
||||
source_info.span,
|
||||
)
|
||||
.polymorphize(fx.tcx);
|
||||
|
||||
if is_call_from_compiler_builtins_to_upstream_monomorphization(fx.tcx, instance) {
|
||||
|
@ -491,6 +491,11 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
|
||||
)
|
||||
});
|
||||
}
|
||||
// FIXME(explicit_tail_calls): add support for tail calls to the cranelift backend, once cranelift supports tail calls
|
||||
TerminatorKind::TailCall { fn_span, .. } => span_bug!(
|
||||
*fn_span,
|
||||
"tail calls are not yet supported in `rustc_codegen_cranelift` backend"
|
||||
),
|
||||
TerminatorKind::InlineAsm {
|
||||
template,
|
||||
operands,
|
||||
|
@ -155,7 +155,7 @@ pub(crate) fn codegen_const_value<'tcx>(
|
||||
fx.bcx.ins().global_value(fx.pointer_type, local_data_id)
|
||||
}
|
||||
}
|
||||
GlobalAlloc::Function(instance) => {
|
||||
GlobalAlloc::Function { instance, .. } => {
|
||||
let func_id = crate::abi::import_function(fx.tcx, fx.module, instance);
|
||||
let local_func_id =
|
||||
fx.module.declare_func_in_func(func_id, &mut fx.bcx.func);
|
||||
@ -351,7 +351,9 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
|
||||
TodoItem::Alloc(alloc_id) => {
|
||||
let alloc = match tcx.global_alloc(alloc_id) {
|
||||
GlobalAlloc::Memory(alloc) => alloc,
|
||||
GlobalAlloc::Function(_) | GlobalAlloc::Static(_) | GlobalAlloc::VTable(..) => {
|
||||
GlobalAlloc::Function { .. }
|
||||
| GlobalAlloc::Static(_)
|
||||
| GlobalAlloc::VTable(..) => {
|
||||
unreachable!()
|
||||
}
|
||||
};
|
||||
@ -443,7 +445,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
|
||||
|
||||
let reloc_target_alloc = tcx.global_alloc(alloc_id);
|
||||
let data_id = match reloc_target_alloc {
|
||||
GlobalAlloc::Function(instance) => {
|
||||
GlobalAlloc::Function { instance, .. } => {
|
||||
assert_eq!(addend, 0);
|
||||
let func_id =
|
||||
crate::abi::import_function(tcx, module, instance.polymorphize(tcx));
|
||||
@ -593,6 +595,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
|
||||
{
|
||||
return None;
|
||||
}
|
||||
TerminatorKind::TailCall { .. } => return None,
|
||||
TerminatorKind::Call { .. } => {}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
use rustc_middle::ty::GenericArg;
|
||||
use rustc_session::config::{sigpipe, EntryFnType};
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::DUMMY_SP;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
@ -119,6 +120,7 @@ fn create_entry_fn(
|
||||
ParamEnv::reveal_all(),
|
||||
report.def_id,
|
||||
tcx.mk_args(&[GenericArg::from(main_ret_ty)]),
|
||||
DUMMY_SP,
|
||||
)
|
||||
.polymorphize(tcx);
|
||||
|
||||
@ -144,6 +146,7 @@ fn create_entry_fn(
|
||||
ParamEnv::reveal_all(),
|
||||
start_def_id,
|
||||
tcx.mk_args(&[main_ret_ty.into()]),
|
||||
DUMMY_SP,
|
||||
)
|
||||
.polymorphize(tcx);
|
||||
let start_func_id = import_function(tcx, m, start_instance);
|
||||
|
Loading…
Reference in New Issue
Block a user