Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove CString drop test. #36741

Merged
merged 1 commit into from
Sep 29, 2016
Merged

Remove CString drop test. #36741

merged 1 commit into from
Sep 29, 2016

Conversation

matklad
Copy link
Member

@matklad matklad commented Sep 26, 2016

The test relies on the undefined behavior, and so may fail in some
circumstances. This can be worked around by stubbing a memory allocator
in the test, but it is a bit of work, and LLVM could still theoretically
eliminate the write of the zero byte in release mode (which is
intended).

So let's just remove the test and mark the function as inline. It
shouldn't be optimized away when inlined into the debug build of user's
code.

Supersedes #36607

r? @alexcrichton

#[stable(feature = "cstring_drop", since = "1.13.0")]
impl Drop for CString {
#[inline(always)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think #[inline] should be plenty here in general (always is best left to LLVM to decide)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

The test relies on the undefined behavior, and so may fail in some
circumstances. This can be worked around by stubbing a memory allocator
in the test, but it is a bit of work, and LLVM could still theoretically
eliminate the write of the zero byte in release mode (which is
intended).

So let's just remove the test and mark the function as inline. It
shouldn't be optimized away when inlined into the debug build of user's
code.
@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Sep 28, 2016

📌 Commit 300e138 has been approved by alexcrichton

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Sep 29, 2016
Remove CString drop test.

The test relies on the undefined behavior, and so may fail in some
circumstances. This can be worked around by stubbing a memory allocator
in the test, but it is a bit of work, and LLVM could still theoretically
eliminate the write of the zero byte in release mode (which is
intended).

So let's just remove the test and mark the function as inline. It
shouldn't be optimized away when inlined into the debug build of user's
code.

Supersedes rust-lang#36607

r? @alexcrichton
bors added a commit that referenced this pull request Sep 29, 2016
Rollup of 12 pull requests

- Successful merges: #35286, #35892, #36460, #36704, #36741, #36760, #36787, #36789, #36794, #36803, #36811, #36813
- Failed merges:
@bors bors merged commit 300e138 into rust-lang:master Sep 29, 2016
@matklad matklad deleted the no-flacky-test branch July 9, 2019 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants