Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 736fac8

Browse files
committed
Sync from rust 432b1a4
2 parents 777d473 + b166ad0 commit 736fac8

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

src/allocator.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::prelude::*;
55

66
use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
77
use rustc_session::config::OomStrategy;
8+
use rustc_span::symbol::sym;
89

910
/// Returns whether an allocator shim was created
1011
pub(crate) fn codegen(
@@ -23,7 +24,7 @@ pub(crate) fn codegen(
2324
module,
2425
unwind_context,
2526
kind,
26-
tcx.lang_items().oom().is_some(),
27+
tcx.alloc_error_handler_kind(()).unwrap(),
2728
tcx.sess.opts.unstable_opts.oom,
2829
);
2930
true
@@ -36,7 +37,7 @@ fn codegen_inner(
3637
module: &mut impl Module,
3738
unwind_context: &mut UnwindContext,
3839
kind: AllocatorKind,
39-
has_alloc_error_handler: bool,
40+
alloc_error_handler_kind: AllocatorKind,
4041
oom_strategy: OomStrategy,
4142
) {
4243
let usize_ty = module.target_config().pointer_type();
@@ -108,12 +109,12 @@ fn codegen_inner(
108109
returns: vec![],
109110
};
110111

111-
let callee_name = if has_alloc_error_handler { "__rg_oom" } else { "__rdl_oom" };
112+
let callee_name = alloc_error_handler_kind.fn_name(sym::oom);
112113

113114
let func_id =
114115
module.declare_function("__rust_alloc_error_handler", Linkage::Export, &sig).unwrap();
115116

116-
let callee_func_id = module.declare_function(callee_name, Linkage::Import, &sig).unwrap();
117+
let callee_func_id = module.declare_function(&callee_name, Linkage::Import, &sig).unwrap();
117118

118119
let mut ctx = Context::new();
119120
ctx.func.signature = sig;

src/archive.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ impl ArchiveBuilderBuilder for ArArchiveBuilderBuilder {
3838
_lib_name: &str,
3939
_dll_imports: &[rustc_session::cstore::DllImport],
4040
_tmpdir: &Path,
41+
_is_direct_dependency: bool,
4142
) -> PathBuf {
4243
bug!("creating dll imports is not supported");
4344
}

src/base.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -770,11 +770,7 @@ fn codegen_stmt<'tcx>(
770770
lval.write_cvalue(fx, CValue::by_val(operand, box_layout));
771771
}
772772
Rvalue::NullaryOp(null_op, ty) => {
773-
assert!(
774-
lval.layout()
775-
.ty
776-
.is_sized(fx.tcx.at(stmt.source_info.span), ParamEnv::reveal_all())
777-
);
773+
assert!(lval.layout().ty.is_sized(fx.tcx, ParamEnv::reveal_all()));
778774
let layout = fx.layout_of(fx.monomorphize(ty));
779775
let val = match null_op {
780776
NullOp::SizeOf => layout.size.bytes(),

src/constant.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
55
use rustc_middle::mir::interpret::{
66
read_target_uint, AllocId, ConstAllocation, ConstValue, ErrorHandled, GlobalAlloc, Scalar,
77
};
8-
use rustc_span::DUMMY_SP;
98

109
use cranelift_module::*;
1110

@@ -291,7 +290,7 @@ fn data_id_for_static(
291290
let is_mutable = if tcx.is_mutable_static(def_id) {
292291
true
293292
} else {
294-
!ty.is_freeze(tcx.at(DUMMY_SP), ParamEnv::reveal_all())
293+
!ty.is_freeze(tcx, ParamEnv::reveal_all())
295294
};
296295
let align = tcx.layout_of(ParamEnv::reveal_all().and(ty)).unwrap().align.pref.bytes();
297296

0 commit comments

Comments
 (0)