about summary refs log tree commit diff
path: root/tests/debuginfo
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-10-12 23:00:55 +0200
committerGitHub <noreply@github.com>2024-10-12 23:00:55 +0200
commit57be141f8a03edd6236dc00a3772fc27673a64c3 (patch)
tree9db209e80f16798851f9e7ac7e8149573f32a7ac /tests/debuginfo
parent6b9676b45431a1e531b9c5f7bd289fc36a312749 (diff)
parent867e776fa6220b17963c34b572fb3c8aa0ace2a3 (diff)
downloadrust-57be141f8a03edd6236dc00a3772fc27673a64c3.tar.gz
rust-57be141f8a03edd6236dc00a3772fc27673a64c3.zip
Rollup merge of #128784 - tdittr:check-abi-on-fn-ptr, r=compiler-errors
Check ABI target compatibility for function pointers

Tracking issue: https://github.com/rust-lang/rust/issues/130260
Related tracking issue: #87678

Compatibility of an ABI for a target was previously only performed on function definitions and `extern` blocks. This PR adds it also to function pointers to be consistent.

This might have broken some of the `tests/ui/` depending on the platform, so a try run seems like a good idea.

Also this might break existing code, because we now emit extra errors. Does this require a crater run?

# Example
```rust
// build with: --target=x86_64-unknown-linux-gnu

// These raise E0570
extern "thiscall" fn foo() {}
extern "thiscall" { fn bar() }

// This did not raise any error
fn baz(f: extern "thiscall" fn()) { f() }
```

# Open Questions
* [x] Should this report a future incompatibility warning like #87678 ?
* [ ] Is this the best place to perform the check?
Diffstat (limited to 'tests/debuginfo')
-rw-r--r--tests/debuginfo/type-names.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/debuginfo/type-names.rs b/tests/debuginfo/type-names.rs
index 6831786c228..4caaf3fc97f 100644
--- a/tests/debuginfo/type-names.rs
+++ b/tests/debuginfo/type-names.rs
@@ -17,7 +17,7 @@
 // gdb-check:type = type_names::GenericStruct<type_names::mod1::Struct2, type_names::mod1::mod2::Struct3>
 
 // gdb-command:whatis generic_struct2
-// gdb-check:type = type_names::GenericStruct<type_names::Struct1, extern "fastcall" fn(isize) -> usize>
+// gdb-check:type = type_names::GenericStruct<type_names::Struct1, extern "system" fn(isize) -> usize>
 
 // gdb-command:whatis mod_struct
 // gdb-check:type = type_names::mod1::Struct2
@@ -372,7 +372,7 @@ fn main() {
     let simple_struct = Struct1;
     let generic_struct1: GenericStruct<mod1::Struct2, mod1::mod2::Struct3> =
         GenericStruct(PhantomData);
-    let generic_struct2: GenericStruct<Struct1, extern "fastcall" fn(isize) -> usize> =
+    let generic_struct2: GenericStruct<Struct1, extern "system" fn(isize) -> usize> =
         GenericStruct(PhantomData);
     let mod_struct = mod1::Struct2;