Repository navigation
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language teamdisposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Description
This is a tracking issue for the RFC "Allow if and match in constants" (rust-lang/rfcs#2342).
Please redirect constification of specific functions or issues you want to report to fresh issues and label them appropriately with F-const_if_match so that this issues doesn't get flooded with ephemeral comments obscuring important developments.
Steps:
- Implement the RFC
- Adjust documentation (see instructions on forge)
- Stabilization PR (see instructions on forge): Stabilize
#![feature(const_if_match)]and#![feature(const_loop)]#72437 -
letbindings in constants that use&&and||short circuiting operations. These are treated as&and|insideconstandstaticitems right now.
Unresolved questions:
None
Reacted by Jacob Pratt, Eyal Kalderon, Charles Samborski, Alexander Regueiro, Greg Morenz, Mateusz Mikuła, Roman Ivanov, Arkadiusz Piekarz, Elichai Turkel, Stepan Koltsov and 32 more
Reacted by mark, mosh, extrawurst, Kat Marchán, Connor Gray, Sayan, Brandon H. Gomes and Felipe S. S. Schneider
Reacted by MSxDOS, Nikolai Vazquez, hugecheese, Simon and Brandon H. Gomes
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language teamdisposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Activity
oli-obk commentedon Mar 19, 2018
switchandswitchIntterminators in https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/qualify_consts.rs#L347 need to have custom code in case the feature gate is activeeddyb commentedon Mar 19, 2018
@oli-obk It's a bit trickier because the complex control-flow means dataflow analysis needs to be employed. I need to get back to @alexreg and figure out how to integrate their changes.
alexreg commentedon Mar 19, 2018
@eddyb A good starting point would probably be to take my
const-qualifbranch (minus the top commit), rebase it over master (not going to be fun), and then add data annotation stuff, right?mark-i-m commentedon Apr 25, 2018
alexreg commentedon Apr 26, 2018
@mark-i-m Alas no. I think @eddyb has been very busy indeed, because I've not even been able to ping him on IRC for the last few weeks hah. Sadly my const-qualif branch doesn't even compile since I last rebased it over master. (I don't believe I've pushed yet though.)
alexreg commentedon Apr 26, 2018
Okay, funnily enough, I rebased again just today and it seems to be building all fine now! Looks like there was a regression, and it just got fixed. All over to @eddyb now.
eddyb commentedon Apr 26, 2018
@alexreg Sorry, I've switched to a local sleep schedule and I see you've pinged me when I wake up but then you're offline all day when I'm awake (ugh timezones).
Should I just make a PR out of your branch? I forgot what we were supposed to do with it?
alexreg commentedon Apr 26, 2018
@eddyb That's alright heh. You must be off to bed early, since I'm usually on from 8:00PM GMT, but it's all good! :-)
Rollup merge of rust-lang#50233 - mark-i-m:const_vec, r=kennytm
eddyb commentedon May 4, 2018
I'm really sorry, took me a while to realize that the series of patches in question requires removing
Qualif::STATIC{,_REF}, i.e. the errors about accessing statics at compile-time. OTOH, this is already broken in terms ofconst fns and access tostatics:This is not detected statically, instead
miricomplains that "dangling pointer was dereferenced" (which should really say something aboutstatics instead of "dangling pointer").So I think reading
statics at compile-time should be fine, but some people wantconst fnto be "pure" (i.e. "referentially transparent" or thereabouts) at runtime, which would mean that aconst fnreading from behind a reference it got as an argument is fine, but aconst fnshould never be able to obtain a reference to astaticout of thin air (including fromconsts).I think then we can keep statically denying mentioning
statics (even if only to take their reference) inconsts,const fn, and other constant contexts (including promoteds).But we still have to remove the
STATIC_REFhack which allowsstatics to take the reference of otherstatics but (poorly tries and fails to) deny reading from behind those references.Do we need an RFC for this?
alexreg commentedon May 4, 2018
Sounds fair w.r.t. reading from statics. Doubt it needs an RFC, maybe just a crater run, but then I’m probably not the best one to say.
eddyb commentedon May 4, 2018
Note that we wouldn't be restricting anything, we'd be relaxing a restriction that's already broken.
130 remaining items
Stabilize some Option methods as const
Rollup merge of rust-lang#76135 - CDirkx:const-option, r=dtolnay,oli-obk
Auto merge of rust-lang#76136 - CDirkx:const-result, r=dtolnay
QuineDot commentedon Nov 26, 2020
The E0744 documentation is now out of date.
Trying to use
?in aconstcontext gives an error (playground):E0744 links to this tracking issue, and also says
However, the
?can be replaced with amatch.This came up on the user forum. Let me know if a new issue should be opened.
RalfJung commentedon Nov 26, 2020
@QuineDot this was recently fixed, but it will take a bit until the fix hits stable: #79087.
Bump MSRV to Rust 1.45+
Bump MSRV to Rust 1.46+
ci: bump MSRV to 1.46
ci: bump MSRV to 1.46
Updating crate `socket2#0.4.0`
Bump MSRV to 1.46
Makefile: do not compile rust/download_web with old toolchain
Use nightly build
nickfarrow commentedon Jul 17, 2021
I was able to fix this error by running
rustup updaterelease: 0.8.0 (#162)