Skip to content

Commit abd9cba

Browse files
committed
Auto merge of #144556 - matthiaskrgr:rollup-aayo3h5, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang/rust#143607 (Port the proc macro attributes to the new attribute parsing infrastructure) - rust-lang/rust#144471 (Remove `compiler-builtins-{no-asm,mangled-names}`) - rust-lang/rust#144495 (bump cargo_metadata) - rust-lang/rust#144523 (rustdoc: save target modifiers) - rust-lang/rust#144534 (check_static_item: explain should_check_for_sync choices) - rust-lang/rust#144535 (miri: for ABI mismatch errors, say which argument is the problem) Failed merges: - rust-lang/rust#144536 (miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3ad4ba9 + a0157ef commit abd9cba

21 files changed

+19
-22
lines changed

src/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ pub fn report_error<'tcx>(
382382
helps.push(note_span!(span, "{:?} was deallocated here:", alloc_id));
383383
}
384384
}
385-
AbiMismatchArgument { .. } | AbiMismatchReturn { .. } => {
385+
AbiMismatchArgument { .. } => {
386386
helps.push(note!("this means these two types are not *guaranteed* to be ABI-compatible across all targets"));
387387
helps.push(note!("if you think this code should be accepted anyway, please report an issue with Miri"));
388388
}

src/helpers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
10791079
.position(|b| !b)
10801080
{
10811081
throw_ub!(AbiMismatchArgument {
1082+
arg_idx: index,
10821083
caller_ty: caller_fn_abi.args[index].layout.ty,
10831084
callee_ty: callee_fn_abi.args[index].layout.ty
10841085
});

tests/fail/function_pointers/abi_mismatch_array_vs_struct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ fn main() {
1717
// These two types have the same size but are still not compatible.
1818
let g = unsafe { std::mem::transmute::<fn(S), fn(A)>(f) };
1919

20-
g(Default::default()) //~ ERROR: calling a function with argument of type S passing data of type [i32; 4]
20+
g(Default::default()) //~ ERROR: type S passing argument of type [i32; 4]
2121
}

tests/fail/function_pointers/abi_mismatch_array_vs_struct.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: calling a function with argument of type S passing data of type [i32; 4]
1+
error: Undefined Behavior: calling a function whose parameter #1 has type S passing argument of type [i32; 4]
22
--> tests/fail/function_pointers/abi_mismatch_array_vs_struct.rs:LL:CC
33
|
44
LL | g(Default::default())

tests/fail/function_pointers/abi_mismatch_int_vs_float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ fn main() {
33

44
let g = unsafe { std::mem::transmute::<fn(f32), fn(i32)>(f) };
55

6-
g(42) //~ ERROR: calling a function with argument of type f32 passing data of type i32
6+
g(42) //~ ERROR: type f32 passing argument of type i32
77
}

tests/fail/function_pointers/abi_mismatch_int_vs_float.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: calling a function with argument of type f32 passing data of type i32
1+
error: Undefined Behavior: calling a function whose parameter #1 has type f32 passing argument of type i32
22
--> tests/fail/function_pointers/abi_mismatch_int_vs_float.rs:LL:CC
33
|
44
LL | g(42)

tests/fail/function_pointers/abi_mismatch_raw_pointer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ fn main() {
33

44
let g = unsafe { std::mem::transmute::<fn(*const [i32]), fn(*const i32)>(f) };
55

6-
g(&42 as *const i32) //~ ERROR: calling a function with argument of type *const [i32] passing data of type *const i32
6+
g(&42 as *const i32) //~ ERROR: type *const [i32] passing argument of type *const i32
77
}

tests/fail/function_pointers/abi_mismatch_raw_pointer.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: calling a function with argument of type *const [i32] passing data of type *const i32
1+
error: Undefined Behavior: calling a function whose parameter #1 has type *const [i32] passing argument of type *const i32
22
--> tests/fail/function_pointers/abi_mismatch_raw_pointer.rs:LL:CC
33
|
44
LL | g(&42 as *const i32)

tests/fail/function_pointers/abi_mismatch_repr_C.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ fn main() {
1212
let fnptr: fn(S2) = callee;
1313
let fnptr: fn(S1) = unsafe { std::mem::transmute(fnptr) };
1414
fnptr(S1(NonZero::new(1).unwrap()));
15-
//~^ ERROR: calling a function with argument of type S2 passing data of type S1
15+
//~^ ERROR: type S2 passing argument of type S1
1616
}

tests/fail/function_pointers/abi_mismatch_repr_C.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: calling a function with argument of type S2 passing data of type S1
1+
error: Undefined Behavior: calling a function whose parameter #1 has type S2 passing argument of type S1
22
--> tests/fail/function_pointers/abi_mismatch_repr_C.rs:LL:CC
33
|
44
LL | fnptr(S1(NonZero::new(1).unwrap()));

0 commit comments

Comments
 (0)