Skip to content

run-pass/extern-pass-empty is probably a bogus thing to test #53859

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
pnkfelix opened this issue Aug 31, 2018 · 6 comments
Open

run-pass/extern-pass-empty is probably a bogus thing to test #53859

pnkfelix opened this issue Aug 31, 2018 · 6 comments
Labels
A-FFI Area: Foreign function interface (FFI) A-repr Area: the `#[repr(stuff)]` attribute A-testsuite Area: The testsuite used to check the correctness of rustc P-medium Medium priority S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pnkfelix
Copy link
Member

The following code hits the lint that warns about trying to put #[repr(C)] on an empty struct.

#[repr(C)]
struct Empty;

(This seems like a bogus test that was caught by working on fixing #53764.)

pnkfelix added a commit to pnkfelix/rust that referenced this issue Sep 3, 2018
…est seems bogus.

that is, I suspect it should be retired because it is testing behavior
(namely a `#[repr(C)] struct Empty;`) that, if I understand correctly,
is undefined.

See also rust-lang#53859.
pnkfelix added a commit to pnkfelix/rust that referenced this issue Sep 6, 2018
…est seems bogus.

that is, I suspect it should be retired because it is testing behavior
(namely a `#[repr(C)] struct Empty;`) that, if I understand correctly,
is undefined.

See also rust-lang#53859.
@memoryruins memoryruins added the A-testsuite Area: The testsuite used to check the correctness of rustc label Sep 15, 2018
@pnkfelix pnkfelix added the A-FFI Area: Foreign function interface (FFI) label Sep 22, 2018
@pnkfelix
Copy link
Member Author

If I understand correctly from the history of the test, #12762 explicitly added support for empty structs ... by ignoring them ... (?)

I'm not 100% sure what our policy should be here.

@pnkfelix pnkfelix added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 22, 2018
@pnkfelix
Copy link
Member Author

nominating for discussion at compiler team meeting. (Though it might need to be discussed more broadly than that.)

@pnkfelix
Copy link
Member Author

unsafe code guidelines group actually discussed this very topic, see here: rust-lang/unsafe-code-guidelines#31 (comment)

@nikomatsakis
Copy link
Contributor

@pnkfelix ultimately I think we decided that our current behavior makes sense and effectively documented it here in this section; it matches the extensions provided by gcc and other C compilers (though it does not match the C++ behavior). So it does seem like a good thing to test to me.

@nikomatsakis
Copy link
Contributor

This does not imply that our particular test is well setup.

@nagisa nagisa added P-medium Medium priority S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed I-nominated labels Nov 1, 2018
@nagisa
Copy link
Member

nagisa commented Nov 1, 2018

Discussed during the compiler meeting. It seems that we cannot really make a decision here before UCG becomes an official document.

@fmease fmease added the A-repr Area: the `#[repr(stuff)]` attribute label Apr 30, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-FFI Area: Foreign function interface (FFI) A-repr Area: the `#[repr(stuff)]` attribute A-testsuite Area: The testsuite used to check the correctness of rustc P-medium Medium priority S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants