Uh oh!
There was an error while loading. Please reload this page.
Individualize feature gates for const fn invocation - #43017
Conversation
rust-highfive
commented
Jul 2, 2017
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
eddyb
commented
Jul 2, 2017
cc @rust-lang/lang |
WRT deprecations, we prefer to do those a release or two after. |
Mark-Simulacrum
commented
Jul 2, 2017
|
durka
commented
Jul 2, 2017
Fixed botched rebase. |
358d2d2 to
d0fc8fcComparewithoutboats
commented
Jul 2, 2017
@rfcbot fcp merge |
SimonSapin
commented
Jul 2, 2017
Do we have a mechanism yet to make something deprecated in some future version? (In this case 1.22+, I think.) It’s bothersome if Nightly warns and says to use instead something that is not available in the Stable channel yet. |
SimonSapin
commented
Jul 2, 2017
#42859 adds |
Team member @withoutboats has proposed to merge this. The next step is review by the rest of the tagged teams: Concerns:
Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
brson
commented
Jul 4, 2017
No, please don't deprecate during the same release as the replacement. Give it a while. |
joshtriplett
commented
Jul 6, 2017
This is a bit of a tangent, but I'd assume this applies to |
nikomatsakis
commented
Jul 6, 2017
@rfcbot concern constness In discussion in the @rust-lang/lang meeting, the question was raised whether we want to have the ability to control whether to stabilize the "constness" of individual functions. So, for example, one might imagine making |
joshtriplett
commented
Jul 6, 2017
@rust-lang/lang was generally in favor of making this change, and stabilizing There was also some discussion about whether this automatically makes the constness of all const functions in the library immediately stable, which might not have been anticipated. There was discussion elsewhere about whether there might be future extensions of some such functions/traits that may be non-const. |
eddyb
commented
Jul 6, 2017
@joshtriplett |
durka
commented
Jul 6, 2017
via email
As written, yes, it stabilizes the constness of const fns in core/std. It
seems rather useless to stabilize uses of const fn, but not declarations,
and then not declare any const fns :)
If we have to be hyper-conservative and start with just size_of/align_of, I
guess that's OK, but I'm also excited to get rid of tons of lazy_statics
which only exist in order to call Cell::new etc!
I'm not 100% sure how we would implement stabilizable-constness. One
approach that comes to mind is a build script for core and std that checks
which train we are compiling, and sets a cfg flag. But then for a user if
you *are* on nightly, there's no opt-in, you just get a const. …On Thu, Jul 6, 2017 at 3:45 PM, Eduard-Mihai Burtescu < ***@***.***> wrote:
@joshtriplett <https://github.com/joshtriplett> std::mem is a mere
reexport of core::mem so yes, they are the same functions.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#43017 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n9jAY5Oj_QqARZHnm7R08DiCciqWks5sLTllgaJpZM4OLrkp>
.
|
durka
commented
Jul 6, 2017
We could also just un-constify the rest of that list, breaking nightly users until we figure out which library functions can be const. Are there any specific concerns, though? |
nikomatsakis
commented
Jul 10, 2017
I have no problem being more aggressive than such a minimal starting set, but it seems like it'd be useful to have the ability to add things later that we don't stabilize immediately. |
nikomatsakis
commented
Jul 10, 2017
That said, perhaps un-constifying is indeed a viable alternative. |
durka
commented
Jul 10, 2017
All I can think of is adding a magic function attribute |
bors
commented
Sep 16, 2017
Individualize feature gates for const fn invocation This PR changes the meaning of `#![feature(const_fn)]` so it is only required to declare a const fn but not to call one. Based on discussion at #24111. I was hoping we could have an FCP here in order to move that conversation forward. This sets the stage for future stabilization of the constness of several functions in the standard library (listed below), so could someone please tag the lang team for review. - `std::cell` - `Cell::new` - `RefCell::new` - `UnsafeCell::new` - `std::mem` - `size_of` - `align_of` - `std::ptr` - `null` - `null_mut` - `std::sync` - `atomic` - `Atomic{Bool,Ptr,Isize,Usize}::new` - `once` - `Once::new` - primitives - `{integer}::min_value` - `{integer}::max_value` Some other functions are const but they are also unstable or hidden, e.g. `Unique::new` so they don't have to be considered at this time. After this stabilization, the following `*_INIT` constants in the standard library can be deprecated. I wasn't sure whether to include those deprecations in the current PR. - `std::sync` - `atomic` - `ATOMIC_{BOOL,ISIZE,USIZE}_INIT` - `once` - `ONCE_INIT`
bors
commented
Sep 16, 2017
☀️ Test successful - status-appveyor, status-travis |
durka
commented
Sep 16, 2017
via email
Thanks for bearing with me @kennytm and @eddyb (and @bors). Next up,
figuring out which of these are actually uncontroversial to stabilize! …On Sep 16, 2017 15:55, "bors" ***@***.***> wrote:
Merged #43017 <#43017>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#43017 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n6lgClFDCPpVSyAxgnNjIfGr1ev1ks5sjCepgaJpZM4OLrkp>
.
|
Upgrade to rustc 1.22.0-nightly (277476c4f 2017-09-16) rust-lang/rust#43017 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18541) <!-- Reviewable:end -->
Upgrade to rustc 1.22.0-nightly (277476c4f 2017-09-16) rust-lang/rust#43017 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18541) <!-- Reviewable:end -->
This seems to be required now, due to rust-lang/rust#43017
…-09-16) (from servo:rustup); r=SimonSapin rust-lang/rust#43017 Source-Repo: https://github.com/servo/servo Source-Revision: c28cf7490f2def7335c7c12e70e12e343eb1ec05 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 1e2b6d8c2339a47ed373f4a00dcea43348c04a99
…-09-16) (from servo:rustup); r=SimonSapin rust-lang/rust#43017 Source-Repo: https://github.com/servo/servo Source-Revision: c28cf7490f2def7335c7c12e70e12e343eb1ec05
…-09-16) (from servo:rustup); r=SimonSapin rust-lang/rust#43017 Source-Repo: https://github.com/servo/servo Source-Revision: c28cf7490f2def7335c7c12e70e12e343eb1ec05
mystor
commented
Oct 29, 2017
@durka Did you ever open a bug to try to stabilize the uncontroversial const functions? It seemed from reading this that size_of and align_of, for example, are not controversial, yet I couldn't find a bug tracking their stabilization. |
durka
commented
Oct 29, 2017
I'll try to get that process started. I guess #24111 is still tracking all the const fns -- maybe that's too confusing. |
…-09-16) (from servo:rustup); r=SimonSapin rust-lang/rust#43017 Source-Repo: https://github.com/servo/servo Source-Revision: c28cf7490f2def7335c7c12e70e12e343eb1ec05 UltraBlame original commit: 14d7326af64d60a6be900427b468f94c7a2d2fda
…-09-16) (from servo:rustup); r=SimonSapin rust-lang/rust#43017 Source-Repo: https://github.com/servo/servo Source-Revision: c28cf7490f2def7335c7c12e70e12e343eb1ec05 UltraBlame original commit: 14d7326af64d60a6be900427b468f94c7a2d2fda
…-09-16) (from servo:rustup); r=SimonSapin rust-lang/rust#43017 Source-Repo: https://github.com/servo/servo Source-Revision: c28cf7490f2def7335c7c12e70e12e343eb1ec05 UltraBlame original commit: 14d7326af64d60a6be900427b468f94c7a2d2fda
…-09-16) (from servo:rustup); r=SimonSapin rust-lang/rust#43017 Source-Repo: https://github.com/servo/servo Source-Revision: c28cf7490f2def7335c7c12e70e12e343eb1ec05
This PR changes the meaning of
#![feature(const_fn)]so it is only required to declare a const fn but not to call one. Based on discussion at #24111. I was hoping we could have an FCP here in order to move that conversation forward.This sets the stage for future stabilization of the constness of several functions in the standard library (listed below), so could someone please tag the lang team for review.
std::cellCell::newRefCell::newUnsafeCell::newstd::memsize_ofalign_ofstd::ptrnullnull_mutstd::syncatomicAtomic{Bool,Ptr,Isize,Usize}::newonceOnce::new{integer}::min_value{integer}::max_valueSome other functions are const but they are also unstable or hidden, e.g.
Unique::newso they don't have to be considered at this time.After this stabilization, the following
*_INITconstants in the standard library can be deprecated. I wasn't sure whether to include those deprecations in the current PR.std::syncatomicATOMIC_{BOOL,ISIZE,USIZE}_INITonceONCE_INIT