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

fix Miri errors in libcore doctests #84052

Merged
merged 1 commit into from
Apr 10, 2021
Merged

Conversation

RalfJung
Copy link
Member

Now that Miri can run doctests, it found some issues in the libcore doctests:

  • The AtomicPtr tests accessed dangling memory! AtomicPtr::new(&mut 10); makes the 10 a temporary that is deallocated after the end of this expression.
  • The tests for set_ptr_value used &array[0] as *const _ to get a pointer to the array; this needs to be array.as_ptr() instead (Cc Stacked Borrows: raw pointer usable only for T too strict? unsafe-code-guidelines#134).
  • I reduced a buffer size in a MaybeUninit test to make it less slow in Miri, and added a spin loop hint to fix a diverging loop in Miri.

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 10, 2021
@Mark-Simulacrum
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 10, 2021

📌 Commit b35ac69 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 10, 2021
@bors
Copy link
Contributor

bors commented Apr 10, 2021

⌛ Testing commit b35ac69 with merge 72c63de...

@bors
Copy link
Contributor

bors commented Apr 10, 2021

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 72c63de to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 10, 2021
@bors bors merged commit 72c63de into rust-lang:master Apr 10, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 10, 2021
@RalfJung RalfJung deleted the libcore-miri branch April 11, 2021 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants