Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d3da100

Browse files
committed
Auto merge of #146876 - Zalathar:rollup-hfvkrpi, r=Zalathar
Rollup of 9 pull requests Successful merges: - #145411 (regression test for Cow<[u8]> layout) - #146317 (Add panic=immediate-abort) - #146397 (std_detect on Darwin AArch64: update features) - #146594 (bootstrap: Don't force -static for musl targets in cc-rs) - #146791 (emit attribute for readonly non-pure inline assembly) - #146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly) - #146838 (Introduce "wrapper" helpers to rustdoc) - #146846 (btree InternalNode::new safety comments) - #146858 (Make mips64el-unknown-linux-muslabi64 link dynamically) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9f32ccf + 3c6ab38 commit d3da100

File tree

98 files changed

+1484
-613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1484
-613
lines changed

‎compiler/rustc_builtin_macros/src/test_harness.rs‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ pub fn inject(
6363

6464
if sess.is_test_crate() {
6565
let panic_strategy = match (panic_strategy, sess.opts.unstable_opts.panic_abort_tests) {
66-
(PanicStrategy::Abort, true) => PanicStrategy::Abort,
67-
(PanicStrategy::Abort, false) => {
66+
(PanicStrategy::Abort | PanicStrategy::ImmediateAbort, true) => panic_strategy,
67+
(PanicStrategy::Abort | PanicStrategy::ImmediateAbort, false) => {
6868
if panic_strategy == platform_panic_strategy {
6969
// Silently allow compiling with panic=abort on these platforms,
7070
// but with old behavior (abort if a test fails).
@@ -287,10 +287,8 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> Box<ast::Item> {
287287
let ecx = &cx.ext_cx;
288288
let test_ident = Ident::new(sym::test, sp);
289289

290-
let runner_name = match cx.panic_strategy {
291-
PanicStrategy::Unwind => "test_main_static",
292-
PanicStrategy::Abort => "test_main_static_abort",
293-
};
290+
let runner_name =
291+
if cx.panic_strategy.unwinds() { "test_main_static" } else { "test_main_static_abort" };
294292

295293
// test::test_main_static(...)
296294
let mut test_runner = cx.test_runner.clone().unwrap_or_else(|| {

‎compiler/rustc_codegen_gcc/src/asm.rs‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,12 @@ fn reg_class_to_gcc(reg_class: InlineAsmRegClass) -> &'static str {
698698
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::reg_nonzero) => "b",
699699
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::freg) => "f",
700700
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::vreg) => "v",
701-
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::cr)
702-
| InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::xer) => {
701+
InlineAsmRegClass::PowerPC(
702+
PowerPCInlineAsmRegClass::cr
703+
| PowerPCInlineAsmRegClass::ctr
704+
| PowerPCInlineAsmRegClass::lr
705+
| PowerPCInlineAsmRegClass::xer,
706+
) => {
703707
unreachable!("clobber-only")
704708
}
705709
InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::reg) => "r",
@@ -777,8 +781,12 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
777781
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::vreg) => {
778782
cx.type_vector(cx.type_i32(), 4)
779783
}
780-
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::cr)
781-
| InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::xer) => {
784+
InlineAsmRegClass::PowerPC(
785+
PowerPCInlineAsmRegClass::cr
786+
| PowerPCInlineAsmRegClass::ctr
787+
| PowerPCInlineAsmRegClass::lr
788+
| PowerPCInlineAsmRegClass::xer,
789+
) => {
782790
unreachable!("clobber-only")
783791
}
784792
InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::reg) => cx.type_i32(),

‎compiler/rustc_codegen_gcc/src/base.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use rustc_middle::mir::mono::Visibility;
1515
use rustc_middle::ty::TyCtxt;
1616
use rustc_session::config::DebugInfo;
1717
use rustc_span::Symbol;
18+
use rustc_target::spec::RelocModel;
1819
#[cfg(feature = "master")]
1920
use rustc_target::spec::SymbolVisibility;
20-
use rustc_target::spec::{PanicStrategy, RelocModel};
2121

2222
use crate::builder::Builder;
2323
use crate::context::CodegenCx;
@@ -101,7 +101,7 @@ pub fn compile_codegen_unit(
101101
// Instantiate monomorphizations without filling out definitions yet...
102102
let context = new_context(tcx);
103103

104-
if tcx.sess.panic_strategy() == PanicStrategy::Unwind {
104+
if tcx.sess.panic_strategy().unwinds() {
105105
context.add_command_line_option("-fexceptions");
106106
context.add_driver_option("-fexceptions");
107107
}

‎compiler/rustc_codegen_gcc/src/intrinsic/mod.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use rustc_middle::ty::layout::LayoutOf;
2929
use rustc_middle::ty::{self, Instance, Ty};
3030
use rustc_span::{Span, Symbol, sym};
3131
use rustc_target::callconv::{ArgAbi, PassMode};
32-
use rustc_target::spec::PanicStrategy;
3332

3433
#[cfg(feature = "master")]
3534
use crate::abi::FnAbiGccExt;
@@ -1334,7 +1333,7 @@ fn try_intrinsic<'a, 'b, 'gcc, 'tcx>(
13341333
_catch_func: RValue<'gcc>,
13351334
dest: PlaceRef<'tcx, RValue<'gcc>>,
13361335
) {
1337-
if bx.sess().panic_strategy() == PanicStrategy::Abort {
1336+
if !bx.sess().panic_strategy().unwinds() {
13381337
bx.call(bx.type_void(), None, None, try_func, &[data], None, None);
13391338
// Return 0 unconditionally from the intrinsic call;
13401339
// we can never unwind.

‎compiler/rustc_codegen_llvm/src/asm.rs‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
340340
attrs.push(llvm::AttributeKind::WillReturn.create_attr(self.cx.llcx));
341341
} else if options.contains(InlineAsmOptions::NOMEM) {
342342
attrs.push(llvm::MemoryEffects::InaccessibleMemOnly.create_attr(self.cx.llcx));
343-
} else {
344-
// LLVM doesn't have an attribute to represent ReadOnly + SideEffect
343+
} else if options.contains(InlineAsmOptions::READONLY){
344+
attrs.push(llvm::MemoryEffects::ReadOnlyNotPure.create_attr(self.cx.llcx));
345345
}
346346
attributes::apply_to_callsite(result, llvm::AttributePlace::Function, &{ attrs });
347347

@@ -662,7 +662,12 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) ->
662662
PowerPC(PowerPCInlineAsmRegClass::reg_nonzero) => "b",
663663
PowerPC(PowerPCInlineAsmRegClass::freg) => "f",
664664
PowerPC(PowerPCInlineAsmRegClass::vreg) => "v",
665-
PowerPC(PowerPCInlineAsmRegClass::cr) | PowerPC(PowerPCInlineAsmRegClass::xer) => {
665+
PowerPC(
666+
PowerPCInlineAsmRegClass::cr
667+
| PowerPCInlineAsmRegClass::ctr
668+
| PowerPCInlineAsmRegClass::lr
669+
| PowerPCInlineAsmRegClass::xer,
670+
) => {
666671
unreachable!("clobber-only")
667672
}
668673
RiscV(RiscVInlineAsmRegClass::reg) => "r",
@@ -830,7 +835,12 @@ fn dummy_output_type<'ll>(cx: &CodegenCx<'ll, '_>, reg: InlineAsmRegClass) -> &'
830835
PowerPC(PowerPCInlineAsmRegClass::reg_nonzero) => cx.type_i32(),
831836
PowerPC(PowerPCInlineAsmRegClass::freg) => cx.type_f64(),
832837
PowerPC(PowerPCInlineAsmRegClass::vreg) => cx.type_vector(cx.type_i32(), 4),
833-
PowerPC(PowerPCInlineAsmRegClass::cr) | PowerPC(PowerPCInlineAsmRegClass::xer) => {
838+
PowerPC(
839+
PowerPCInlineAsmRegClass::cr
840+
| PowerPCInlineAsmRegClass::ctr
841+
| PowerPCInlineAsmRegClass::lr
842+
| PowerPCInlineAsmRegClass::xer,
843+
) => {
834844
unreachable!("clobber-only")
835845
}
836846
RiscV(RiscVInlineAsmRegClass::reg) => cx.type_i32(),

‎compiler/rustc_codegen_llvm/src/intrinsic.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use rustc_middle::{bug, span_bug};
1818
use rustc_span::{Span, Symbol, sym};
1919
use rustc_symbol_mangling::{mangle_internal_symbol, symbol_name_for_instance_in_crate};
2020
use rustc_target::callconv::PassMode;
21-
use rustc_target::spec::PanicStrategy;
2221
use tracing::debug;
2322

2423
use crate::abi::FnAbiLlvmExt;
@@ -674,7 +673,7 @@ fn catch_unwind_intrinsic<'ll, 'tcx>(
674673
catch_func: &'ll Value,
675674
dest: PlaceRef<'tcx, &'ll Value>,
676675
) {
677-
if bx.sess().panic_strategy() == PanicStrategy::Abort {
676+
if !bx.sess().panic_strategy().unwinds() {
678677
let try_func_ty = bx.type_func(&[bx.type_ptr()], bx.type_void());
679678
bx.call(try_func_ty, None, None, try_func, &[data], None, None);
680679
// Return 0 unconditionally from the intrinsic call;

‎compiler/rustc_codegen_llvm/src/llvm/ffi.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ pub(crate) enum MemoryEffects {
710710
None,
711711
ReadOnly,
712712
InaccessibleMemOnly,
713+
ReadOnlyNotPure,
713714
}
714715

715716
/// LLVMOpcode

‎compiler/rustc_codegen_llvm/src/llvm_util.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ unsafe fn configure_llvm(sess: &Session) {
106106

107107
if sess.target.os == "emscripten"
108108
&& !sess.opts.unstable_opts.emscripten_wasm_eh
109-
&& sess.panic_strategy() == PanicStrategy::Unwind
109+
&& sess.panic_strategy().unwinds()
110110
{
111111
add("-enable-emscripten-cxx-exceptions", false);
112112
}

‎compiler/rustc_codegen_ssa/src/back/link.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ use rustc_span::Symbol;
4747
use rustc_target::spec::crt_objects::CrtObjects;
4848
use rustc_target::spec::{
4949
BinaryFormat, Cc, LinkOutputKind, LinkSelfContainedComponents, LinkSelfContainedDefault,
50-
LinkerFeatures, LinkerFlavor, LinkerFlavorCli, Lld, PanicStrategy,RelocModel, RelroLevel,
51-
SanitizerSet,SplitDebuginfo,
50+
LinkerFeatures, LinkerFlavor, LinkerFlavorCli, Lld, RelocModel, RelroLevel,SanitizerSet,
51+
SplitDebuginfo,
5252
};
5353
use tracing::{debug, info, warn};
5454

@@ -2512,10 +2512,10 @@ fn add_order_independent_options(
25122512
if sess.target.os == "emscripten" {
25132513
cmd.cc_arg(if sess.opts.unstable_opts.emscripten_wasm_eh {
25142514
"-fwasm-exceptions"
2515-
} else if sess.panic_strategy() == PanicStrategy::Abort {
2516-
"-sDISABLE_EXCEPTION_CATCHING=1"
2517-
} else {
2515+
} else if sess.panic_strategy().unwinds() {
25182516
"-sDISABLE_EXCEPTION_CATCHING=0"
2517+
} else {
2518+
"-sDISABLE_EXCEPTION_CATCHING=1"
25192519
});
25202520
}
25212521

‎compiler/rustc_interface/messages.ftl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ interface_out_dir_error =
4747
failed to find or create the directory specified by `--out-dir`
4848
4949
interface_proc_macro_crate_panic_abort =
50-
building proc macro crate with `panic=abort` may crash the compiler should the proc-macro panic
50+
building proc macro crate with `panic=abort` or `panic=immediate-abort` may crash the compiler should the proc-macro panic
5151
5252
interface_temps_dir_error =
5353
failed to find or create the directory specified by `--temps-dir`

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /