diff options
author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-28 09:35:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-28 09:35:12 +0200 |
commit | 5d7db936008110f9760dcf5e74912c6662d2bd4f (patch) | |
tree | 58c51da355cc2a6b72df6203f9371c9326376bd1 /tests/ui/lint | |
parent | 58d0730fb82463d68b622903aab694c69f4e7c5e (diff) | |
parent | 19d5568ad3a83d48b152f5c7182c364005ee969e (diff) |
Rollup merge of #130953 - workingjubilee:rename-a-few-ctypes-tests, r=fee1-dead
Rename a few tests to make tidy happier
A somewhat random smattering of tests that I have recently looked at, and thus had cause to research and write down the reason for their existence.
Diffstat (limited to 'tests/ui/lint')
-rw-r--r-- | tests/ui/lint/improper_ctypes/allow-phantomdata-in-ffi.rs (renamed from tests/ui/lint/issue-34798.rs) | 2 | ||||
-rw-r--r-- | tests/ui/lint/improper_ctypes/repr-rust-is-undefined.rs (renamed from tests/ui/lint/issue-14309.rs) | 4 | ||||
-rw-r--r-- | tests/ui/lint/improper_ctypes/repr-rust-is-undefined.stderr (renamed from tests/ui/lint/issue-14309.stderr) | 22 |
3 files changed, 17 insertions, 11 deletions
diff --git a/tests/ui/lint/issue-34798.rs b/tests/ui/lint/improper_ctypes/allow-phantomdata-in-ffi.rs index 064fc7c4ad6..a90159d2b58 100644 --- a/tests/ui/lint/issue-34798.rs +++ b/tests/ui/lint/improper_ctypes/allow-phantomdata-in-ffi.rs @@ -1,6 +1,8 @@ //@ run-pass #![forbid(improper_ctypes)] #![allow(dead_code)] +// issue https://github.com/rust-lang/rust/issues/34798 +// We allow PhantomData in FFI so bindgen can bind templated C++ structs with "unused generic args" #[repr(C)] pub struct Foo { diff --git a/tests/ui/lint/issue-14309.rs b/tests/ui/lint/improper_ctypes/repr-rust-is-undefined.rs index 328a4c982b8..379c4132404 100644 --- a/tests/ui/lint/issue-14309.rs +++ b/tests/ui/lint/improper_ctypes/repr-rust-is-undefined.rs @@ -1,6 +1,10 @@ #![deny(improper_ctypes)] #![allow(dead_code)] +// issue https://github.com/rust-lang/rust/issues/14309 +// Validates we lint on repr(Rust) structs and not repr(C) structs in FFI, to implement RFC 79: +// https://rust-lang.github.io/rfcs/0079-undefined-struct-layout.html + struct A { x: i32 } diff --git a/tests/ui/lint/issue-14309.stderr b/tests/ui/lint/improper_ctypes/repr-rust-is-undefined.stderr index 9ce62a6b804..5f0465bcf00 100644 --- a/tests/ui/lint/issue-14309.stderr +++ b/tests/ui/lint/improper_ctypes/repr-rust-is-undefined.stderr @@ -1,5 +1,5 @@ error: `extern` block uses type `A`, which is not FFI-safe - --> $DIR/issue-14309.rs:30:15 + --> $DIR/repr-rust-is-undefined.rs:34:15 | LL | fn foo(x: A); | ^ not FFI-safe @@ -7,18 +7,18 @@ LL | fn foo(x: A); = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here - --> $DIR/issue-14309.rs:4:1 + --> $DIR/repr-rust-is-undefined.rs:8:1 | LL | struct A { | ^^^^^^^^ note: the lint level is defined here - --> $DIR/issue-14309.rs:1:9 + --> $DIR/repr-rust-is-undefined.rs:1:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ error: `extern` block uses type `A`, which is not FFI-safe - --> $DIR/issue-14309.rs:31:15 + --> $DIR/repr-rust-is-undefined.rs:35:15 | LL | fn bar(x: B); | ^ not FFI-safe @@ -26,13 +26,13 @@ LL | fn bar(x: B); = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here - --> $DIR/issue-14309.rs:4:1 + --> $DIR/repr-rust-is-undefined.rs:8:1 | LL | struct A { | ^^^^^^^^ error: `extern` block uses type `A`, which is not FFI-safe - --> $DIR/issue-14309.rs:33:15 + --> $DIR/repr-rust-is-undefined.rs:37:15 | LL | fn qux(x: A2); | ^^ not FFI-safe @@ -40,13 +40,13 @@ LL | fn qux(x: A2); = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here - --> $DIR/issue-14309.rs:4:1 + --> $DIR/repr-rust-is-undefined.rs:8:1 | LL | struct A { | ^^^^^^^^ error: `extern` block uses type `A`, which is not FFI-safe - --> $DIR/issue-14309.rs:34:16 + --> $DIR/repr-rust-is-undefined.rs:38:16 | LL | fn quux(x: B2); | ^^ not FFI-safe @@ -54,13 +54,13 @@ LL | fn quux(x: B2); = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here - --> $DIR/issue-14309.rs:4:1 + --> $DIR/repr-rust-is-undefined.rs:8:1 | LL | struct A { | ^^^^^^^^ error: `extern` block uses type `A`, which is not FFI-safe - --> $DIR/issue-14309.rs:36:16 + --> $DIR/repr-rust-is-undefined.rs:40:16 | LL | fn fred(x: D); | ^ not FFI-safe @@ -68,7 +68,7 @@ LL | fn fred(x: D); = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here - --> $DIR/issue-14309.rs:4:1 + --> $DIR/repr-rust-is-undefined.rs:8:1 | LL | struct A { | ^^^^^^^^ |