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

Make intrinsics::write_bytes const #90081

Merged
merged 1 commit into from
Dec 12, 2021
Merged

Make intrinsics::write_bytes const #90081

merged 1 commit into from
Dec 12, 2021

Conversation

lilasta
Copy link
Contributor

@lilasta lilasta commented Oct 20, 2021

This is required to constify MaybeUninit::zeroed and (*mut T)::write_bytes.

Tracking issue: #86302

@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(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 Oct 20, 2021
@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Oct 20, 2021

blocked on #90041

@oli-obk oli-obk added the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Oct 20, 2021
@rust-log-analyzer

This comment has been minimized.

@lilasta lilasta marked this pull request as draft October 24, 2021 10:08
@rust-log-analyzer

This comment has been minimized.

@lilasta lilasta marked this pull request as ready for review October 25, 2021 06:13
@oli-obk
Copy link
Contributor

oli-obk commented Oct 25, 2021

Should I create a tracking issue?

I think you can just point to the const_mut_refs tracking issue, as there is no reason not to stabilize write_bytes as const once we have mutable references

@lilasta
Copy link
Contributor Author

lilasta commented Oct 25, 2021

I just found the const_ptr_write tracking issue (86302), so I changed to it.

@oli-obk
Copy link
Contributor

oli-obk commented Oct 25, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Oct 25, 2021

📌 Commit 15c2613a86a227937058a7d4ff68068cce5f4f1e has been approved by oli-obk

@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. S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Oct 25, 2021
@oli-obk
Copy link
Contributor

oli-obk commented Oct 25, 2021

@bors rollup

@WaffleLapkin
Copy link
Member

blocked on #90041

Isn't it still blocked?

@oli-obk
Copy link
Contributor

oli-obk commented Oct 25, 2021

@bors r- uuuh gotta check. Sorry, thanks for the ping

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 25, 2021
@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 28, 2021
@bors
Copy link
Contributor

bors commented Nov 13, 2021

☔ The latest upstream changes (presumably #90041) made this pull request unmergeable. Please resolve the merge conflicts.

@lilasta
Copy link
Contributor Author

lilasta commented Nov 16, 2021

Rebased.

Comment on lines 2253 to 2256
#[cfg(not(bootstrap))]
const fn compiletime_check<T>(_ptr: *mut T) {
// The CTFE-engine checks if the pointer is correctly aligned and not null.
}
Copy link
Contributor

Choose a reason for hiding this comment

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

similarly to the other PR, please just call this function nop and mention on the const_eval_select call that it's just a debug assertion and so it's not a problem if CTFE does not check it, even if it checks some of the rules

@ecstatic-morse
Copy link
Contributor

ecstatic-morse commented Nov 23, 2021

@woppopo MaybeUninit::zeroed was one of the functions that the Rust-for-Linux devs mentioned specifically in today's CTCFT as being useful in a const context. Any chance you'd be able to incorporate Oli's feedback in the near future? It would be nice to get this onto nightly now that it's unblocked.

@lilasta
Copy link
Contributor Author

lilasta commented Nov 23, 2021

Thank you for telling me. I added #[cfg(debug_assertions)] to the functions needed for checking, and unified with the same style as #90041.

@oli-obk
Copy link
Contributor

oli-obk commented Nov 23, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 23, 2021

📌 Commit e8e02d9 has been approved by oli-obk

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 23, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 23, 2021
Make `intrinsics::write_bytes` const

This is required to constify `MaybeUninit::zeroed` and `(*mut T)::write_bytes`.

Tracking issue: rust-lang#86302
@camelid
Copy link
Member

camelid commented Dec 10, 2021

It seems this branch was pushed to after the PR was approved, so it needs a new review.

@camelid
Copy link
Member

camelid commented Dec 10, 2021

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 10, 2021
@camelid camelid added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 10, 2021
@camelid camelid assigned oli-obk and unassigned joshtriplett Dec 10, 2021
@oli-obk
Copy link
Contributor

oli-obk commented Dec 11, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Dec 11, 2021

📌 Commit 89b2e0c has been approved by oli-obk

@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 Dec 11, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 11, 2021
Make `intrinsics::write_bytes` const

This is required to constify `MaybeUninit::zeroed` and `(*mut T)::write_bytes`.

Tracking issue: rust-lang#86302
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 12, 2021
…askrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#90081 (Make `intrinsics::write_bytes` const)
 - rust-lang#91643 (asm: Allow using r9 (ARM) and x18 (AArch64) if they are not reserved by the current target)
 - rust-lang#91737 (Make certain panicky stdlib functions behave better under panic_immediate_abort)
 - rust-lang#91750 (rustdoc: Add regression test for Iterator as notable trait on &T)
 - rust-lang#91764 (Do not ICE when suggesting elided lifetimes on non-existent spans.)
 - rust-lang#91780 (Remove hir::Node::hir_id.)
 - rust-lang#91797 (Fix zero-sized reference to deallocated memory)
 - rust-lang#91806 (Make `Unique`s methods `const`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9383a49 into rust-lang:master Dec 12, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 12, 2021
@lilasta lilasta deleted the const_write_bytes branch December 12, 2021 03:57
@lilasta lilasta mentioned this pull request Dec 13, 2021
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.