Skip to content

Commit bc4376f

Browse files
committed
Auto merge of #143026 - jdonszelmann:rollup-z7mkuyt, r=jdonszelmann
Rollup of 7 pull requests Successful merges: - #142146 (Withdraw the claim `extern "C-cmse-nonsecure-*"` always matches `extern "C"`) - #142200 (`tests/ui`: A New Order [8/N]) - #142724 (Add runtime check to avoid overwrite arg in `Diag`) - #142809 (Add PrintTAFn flag for targeted type analysis printing) - #142976 (Check CoerceUnsized impl validity before coercing) - #142992 (Convert some ABI tests to use `extern "rust-invalid"`) - #143000 (Make `Sub`, `Mul`, `Div` and `Rem` `const_traits`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 0fa4ec6 + c001128 commit bc4376f

File tree

118 files changed

+963
-941
lines changed

Some content is hidden

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

118 files changed

+963
-941
lines changed

compiler/rustc_abi/src/canon_abi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ impl fmt::Display for CanonAbi {
6363
CanonAbi::Custom => ExternAbi::Custom,
6464
CanonAbi::Arm(arm_call) => match arm_call {
6565
ArmCall::Aapcs => ExternAbi::Aapcs { unwind: false },
66-
ArmCall::CCmseNonSecureCall => ExternAbi::CCmseNonSecureCall,
67-
ArmCall::CCmseNonSecureEntry => ExternAbi::CCmseNonSecureEntry,
66+
ArmCall::CCmseNonSecureCall => ExternAbi::CmseNonSecureCall,
67+
ArmCall::CCmseNonSecureEntry => ExternAbi::CmseNonSecureEntry,
6868
},
6969
CanonAbi::GpuKernel => ExternAbi::GpuKernel,
7070
CanonAbi::Interrupt(interrupt_kind) => match interrupt_kind {

compiler/rustc_abi/src/extern_abi.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ pub enum ExternAbi {
5959
unwind: bool,
6060
},
6161
/// extremely constrained barely-C ABI for TrustZone
62-
CCmseNonSecureCall,
62+
CmseNonSecureCall,
6363
/// extremely constrained barely-C ABI for TrustZone
64-
CCmseNonSecureEntry,
64+
CmseNonSecureEntry,
6565

6666
/* gpu */
6767
/// An entry-point function called by the GPU's host
@@ -140,8 +140,6 @@ macro_rules! abi_impls {
140140
abi_impls! {
141141
ExternAbi = {
142142
C { unwind: false } =><= "C",
143-
CCmseNonSecureCall =><= "C-cmse-nonsecure-call",
144-
CCmseNonSecureEntry =><= "C-cmse-nonsecure-entry",
145143
C { unwind: true } =><= "C-unwind",
146144
Rust =><= "Rust",
147145
Aapcs { unwind: false } =><= "aapcs",
@@ -150,6 +148,8 @@ abi_impls! {
150148
AvrNonBlockingInterrupt =><= "avr-non-blocking-interrupt",
151149
Cdecl { unwind: false } =><= "cdecl",
152150
Cdecl { unwind: true } =><= "cdecl-unwind",
151+
CmseNonSecureCall =><= "cmse-nonsecure-call",
152+
CmseNonSecureEntry =><= "cmse-nonsecure-entry",
153153
Custom =><= "custom",
154154
EfiApi =><= "efiapi",
155155
Fastcall { unwind: false } =><= "fastcall",

compiler/rustc_ast_lowering/src/stability.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
127127
feature: sym::abi_riscv_interrupt,
128128
explain: GateReason::Experimental,
129129
}),
130-
ExternAbi::CCmseNonSecureCall => Err(UnstableAbi {
130+
ExternAbi::CmseNonSecureCall => Err(UnstableAbi {
131131
abi,
132-
feature: sym::abi_c_cmse_nonsecure_call,
132+
feature: sym::abi_cmse_nonsecure_call,
133133
explain: GateReason::Experimental,
134134
}),
135-
ExternAbi::CCmseNonSecureEntry => Err(UnstableAbi {
135+
ExternAbi::CmseNonSecureEntry => Err(UnstableAbi {
136136
abi,
137137
feature: sym::cmse_nonsecure_entry,
138138
explain: GateReason::Experimental,

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,8 +1284,14 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
12841284
&& !spans.is_empty()
12851285
{
12861286
let mut span: MultiSpan = spans.clone().into();
1287+
err.arg("ty", param_ty.to_string());
1288+
let msg = err.dcx.eagerly_translate_to_string(
1289+
fluent::borrowck_moved_a_fn_once_in_call_def,
1290+
err.args.iter(),
1291+
);
1292+
err.remove_arg("ty");
12871293
for sp in spans {
1288-
span.push_span_label(sp, fluent::borrowck_moved_a_fn_once_in_call_def);
1294+
span.push_span_label(sp, msg.clone());
12891295
}
12901296
span.push_span_label(
12911297
fn_call_span,

compiler/rustc_builtin_macros/src/errors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ impl Subdiagnostic for FormatUnusedArg {
660660
fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
661661
diag.arg("named", self.named);
662662
let msg = diag.eagerly_translate(crate::fluent_generated::builtin_macros_format_unused_arg);
663+
diag.remove_arg("named");
663664
diag.span_label(self.span, msg);
664665
}
665666
}

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ fn thin_lto(
587587
}
588588

589589
fn enable_autodiff_settings(ad: &[config::AutoDiff]) {
590-
for &val in ad {
590+
for val in ad {
591591
// We intentionally don't use a wildcard, to not forget handling anything new.
592592
match val {
593593
config::AutoDiff::PrintPerf => {
@@ -599,6 +599,10 @@ fn enable_autodiff_settings(ad: &[config::AutoDiff]) {
599599
config::AutoDiff::PrintTA => {
600600
llvm::set_print_type(true);
601601
}
602+
config::AutoDiff::PrintTAFn(fun) => {
603+
llvm::set_print_type(true); // Enable general type printing
604+
llvm::set_print_type_fun(&fun); // Set specific function to analyze
605+
}
602606
config::AutoDiff::Inline => {
603607
llvm::set_inline(true);
604608
}

compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,19 @@ pub(crate) use self::Enzyme_AD::*;
5757

5858
#[cfg(llvm_enzyme)]
5959
pub(crate) mod Enzyme_AD {
60+
use std::ffi::{CString, c_char};
61+
6062
use libc::c_void;
63+
6164
unsafe extern "C" {
6265
pub(crate) fn EnzymeSetCLBool(arg1: *mut ::std::os::raw::c_void, arg2: u8);
66+
pub(crate) fn EnzymeSetCLString(arg1: *mut ::std::os::raw::c_void, arg2: *const c_char);
6367
}
6468
unsafe extern "C" {
6569
static mut EnzymePrintPerf: c_void;
6670
static mut EnzymePrintActivity: c_void;
6771
static mut EnzymePrintType: c_void;
72+
static mut EnzymeFunctionToAnalyze: c_void;
6873
static mut EnzymePrint: c_void;
6974
static mut EnzymeStrictAliasing: c_void;
7075
static mut looseTypeAnalysis: c_void;
@@ -86,6 +91,15 @@ pub(crate) mod Enzyme_AD {
8691
EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrintType), print as u8);
8792
}
8893
}
94+
pub(crate) fn set_print_type_fun(fun_name: &str) {
95+
let c_fun_name = CString::new(fun_name).unwrap();
96+
unsafe {
97+
EnzymeSetCLString(
98+
std::ptr::addr_of_mut!(EnzymeFunctionToAnalyze),
99+
c_fun_name.as_ptr() as *const c_char,
100+
);
101+
}
102+
}
89103
pub(crate) fn set_print(print: bool) {
90104
unsafe {
91105
EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrint), print as u8);
@@ -132,6 +146,9 @@ pub(crate) mod Fallback_AD {
132146
pub(crate) fn set_print_type(print: bool) {
133147
unimplemented!()
134148
}
149+
pub(crate) fn set_print_type_fun(fun_name: &str) {
150+
unimplemented!()
151+
}
135152
pub(crate) fn set_print(print: bool) {
136153
unimplemented!()
137154
}

compiler/rustc_const_eval/src/errors.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ impl Subdiagnostic for FrameNote {
291291
span.push_span_label(self.span, fluent::const_eval_frame_note_last);
292292
}
293293
let msg = diag.eagerly_translate(fluent::const_eval_frame_note);
294+
diag.remove_arg("times");
295+
diag.remove_arg("where_");
296+
diag.remove_arg("instance");
294297
diag.span_note(span, msg);
295298
}
296299
}

compiler/rustc_error_codes/src/error_codes/E0775.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Erroneous code example:
88
```ignore (no longer emitted)
99
#![feature(cmse_nonsecure_entry)]
1010
11-
pub extern "C-cmse-nonsecure-entry" fn entry_function() {}
11+
pub extern "cmse-nonsecure-entry" fn entry_function() {}
1212
```
1313

1414
To fix this error, compile your code for a Rust target that supports the
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
The `C-cmse-nonsecure-call` ABI can only be used with function pointers.
1+
The `cmse-nonsecure-call` ABI can only be used with function pointers.
22

33
Erroneous code example:
44

55
```compile_fail,E0781
6-
#![feature(abi_c_cmse_nonsecure_call)]
6+
#![feature(abi_cmse_nonsecure_call)]
77
8-
pub extern "C-cmse-nonsecure-call" fn test() {}
8+
pub extern "cmse-nonsecure-call" fn test() {}
99
```
1010

11-
The `C-cmse-nonsecure-call` ABI should be used by casting function pointers to
11+
The `cmse-nonsecure-call` ABI should be used by casting function pointers to
1212
specific addresses.

0 commit comments

Comments
 (0)