Revert revert of constness in #86003 by usbalbin · Pull Request #86295 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation37 Commits11 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

usbalbin

Re-constify mem::swap, mem::replace, ptr::write which were marked as not const in #86003

Once the checks pass, this should solve #86236

@rust-highfive

r? @Mark-Simulacrum

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

@rust-log-analyzer

This comment has been minimized.

@usbalbin

Would it make sense to make a tracking issue for const_ptr_write?

RalfJung

@RalfJung

@pnkfelix any objections to this? I am not sure why these were de-constified to begin with, so just making sure I am not missing anything here. :)

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

RalfJung

@RalfJung

@usbalbin we also lost src/test/ui/consts/copy-intrinsic.rs in #86003; could you add that back as well?

@RalfJung

LGTM -- r=me, except that it'd be good to hear back from @pnkfelix. Let's give them a few more days.

r? @RalfJung

@rust-log-analyzer

This comment has been minimized.

@usbalbin

Sorry but I am not quite sure what to do with the errors (or rather lack of errors)

@usbalbin

Are those things that are no longer checked? Should I remove those tests or somehow make sure the errors are detected again?

@RalfJung

Something is strange, it looks like none of the errors showed up -- but the exit status is still 1...?

@RalfJung

Ah, I think I know what happens: the errors now have the wrong span; they are shown with spans in the standard library.

To fix this, you should call the intrinsics directly in this test. You will probably need to add a extern "rust-intrinsic" block to import them.

@RalfJung

So, something like this. But at least on the playground this doesn't change the spans that are shown...

@usbalbin

Thanks :)

What should I do about

error: module has missing stability attribute
  --> src/main.rs:2:1

?
Same error in your playground

@RalfJung

Ah... well we'll need to add a stability attribute. This should do it:

#![stable(feature = "dummy", since = "1.0.0")]

@usbalbin

So if you write code which calls unstable code than you have to be explicit about the stabilitiy of your code?

Again thanks :)

Would you like me to squash the two latest commits (2faa57a and d1ae4e2) onto one?

@RalfJung

A chain of things happens here:

Would you like me to squash the two latest commits (2faa57a and d1ae4e2) onto one?

Seems fine to me to keep this separate.

@usbalbin

@usbalbin usbalbin marked this pull request as ready for review

June 15, 2021 19:06

@RalfJung

@pnkfelix confirmed that as long as we don't touch copy/copy_nonoverlapping, we should be good. So, let's (re-)land this. Thanks @usbalbin :)
@bors r+

@rust-log-analyzer

This comment has been minimized.

@bors

@bors bors added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

and removed S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

labels

Jun 27, 2021

@RalfJung

Looks like #86194 changed the output of some tests added here.

@usbalbin

@usbalbin

@usbalbin

@usbalbin

@usbalbin

@usbalbin

@usbalbin

@usbalbin

…opy and copy_nonoverlapping' 5f6016f

@usbalbin

@usbalbin

@rust-log-analyzer

This comment has been minimized.

@usbalbin

usbalbin

@usbalbin

@pnkfelix confirmed that as long as we don't touch copy/copy_nonoverlapping, we should be good. So, let's (re-)land this. Thanks @usbalbin :)
@bors r+

Thank you :)

@RalfJung

@bors

📌 Commit 4aa1267 has been approved by RalfJung

@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

Jun 27, 2021

@bors

@bors

@eddyb eddyb mentioned this pull request

Jun 28, 2021

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.