Skip to content

Commit 7e23d77

Browse files
committed
Auto merge of rust-lang#109001 - matthiaskrgr:rollup-a3agnwp, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#105798 (Relax ordering rules for `asm!` operands) - rust-lang#105962 (Stabilize path_as_mut_os_str) - rust-lang#106085 (use problem matchers for tidy CI) - rust-lang#107711 (Stabilize movbe target feature) - rust-lang#108017 (Add `--no-undefined-version` link flag and fix associated breakage) - rust-lang#108891 (Remove an extraneous include) - rust-lang#108902 (no more do while :<) - rust-lang#108912 (Document tool lints) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents be445e1 + b23a3a3 commit 7e23d77

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

Diff for: src/allocator.rs

+10-18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use crate::prelude::*;
55

66
use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
7+
use rustc_codegen_ssa::base::allocator_kind_for_codegen;
78
use rustc_session::config::OomStrategy;
89
use rustc_span::symbol::sym;
910

@@ -13,24 +14,15 @@ pub(crate) fn codegen(
1314
module: &mut impl Module,
1415
unwind_context: &mut UnwindContext,
1516
) -> bool {
16-
let any_dynamic_crate = tcx.dependency_formats(()).iter().any(|(_, list)| {
17-
use rustc_middle::middle::dependency_format::Linkage;
18-
list.iter().any(|&linkage| linkage == Linkage::Dynamic)
19-
});
20-
if any_dynamic_crate {
21-
false
22-
} else if let Some(kind) = tcx.allocator_kind(()) {
23-
codegen_inner(
24-
module,
25-
unwind_context,
26-
kind,
27-
tcx.alloc_error_handler_kind(()).unwrap(),
28-
tcx.sess.opts.unstable_opts.oom,
29-
);
30-
true
31-
} else {
32-
false
33-
}
17+
let Some(kind) = allocator_kind_for_codegen(tcx) else { return false };
18+
codegen_inner(
19+
module,
20+
unwind_context,
21+
kind,
22+
tcx.alloc_error_handler_kind(()).unwrap(),
23+
tcx.sess.opts.unstable_opts.oom,
24+
);
25+
true
3426
}
3527

3628
fn codegen_inner(

0 commit comments

Comments
 (0)