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

regression: pointer functions not yet stable as const fn #123284

Closed
Mark-Simulacrum opened this issue Mar 31, 2024 · 4 comments
Closed

regression: pointer functions not yet stable as const fn #123284

Mark-Simulacrum opened this issue Mar 31, 2024 · 4 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@Mark-Simulacrum
Copy link
Member

Mark-Simulacrum commented Mar 31, 2024

[INFO] [stdout] error: `core::ptr::const_ptr::<impl *const T>::copy_to_nonoverlapping` is not yet stable as a const fn
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/bnum-0.8.0/src/bint/endian.rs:146:25
[INFO] [stdout]     |
[INFO] [stdout] 146 | /                         slice_ptr
[INFO] [stdout] 147 | |                             .add(i << digit::$Digit::BYTE_SHIFT)
[INFO] [stdout] 148 | |                             .copy_to_nonoverlapping(ptr, digit::$Digit::BYTES as usize);
[INFO] [stdout]     | |_______________________________________________________________________________________^
[INFO] [stdout] ...
[INFO] [stdout] 240 |   crate::macro_impl!(endian);
[INFO] [stdout]     |   -------------------------- in this macro invocation
[INFO] [stdout]     |
[INFO] [stdout]     = note: this error originates in the macro `endian` which comes from the expansion of the macro `crate::macro_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] 

non-bnum cases:

@Mark-Simulacrum Mark-Simulacrum added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Mar 31, 2024
@Mark-Simulacrum Mark-Simulacrum added this to the 1.78.0 milestone Mar 31, 2024
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 31, 2024
@Mark-Simulacrum
Copy link
Member Author

Docs indicate these aren't const-stable (e.g., https://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.copy_to_nonoverlapping-1 has const: unstable). But this code seems to have worked before, so either (a) we aren't checking const-stability prior to 1.78 on inherent pointer methods or (b) something else fishy is going on.

@Mark-Simulacrum Mark-Simulacrum added E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Mar 31, 2024
@zachs18
Copy link
Contributor

zachs18 commented Mar 31, 2024

IIUC these were intentionally destabilized by #117905, which was merged after 1.77 branched but before 1.78 branched.

Yeah, they were const-stable in 1.77.1 https://doc.rust-lang.org/1.77.1/std/primitive.pointer.html#method.copy_to_nonoverlapping-1 but no longer are.

@Mark-Simulacrum
Copy link
Member Author

I see. The vast majority of the regressions seem to still be bnum (likely mostly due to Crater not bumping the lockfiles for committed lockfiles). It seems like this is pretty similar in spirit to #123285 where we're mostly just detecting a bunch of new UB now (just via de-stabilization).

I think that means we're likely to move forward here but will want to call this out in release notes.

@Mark-Simulacrum Mark-Simulacrum removed E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 31, 2024
@RalfJung
Copy link
Member

Closing as this was a deliberate de-stabilization. #80697 tracks this now-again-unstable feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. 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

4 participants