-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.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 teamfinal-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.
Description
The feature called const_indexing
allows the indexing operation to be performed while calculating a true constant like an array length.
See the implementation at #25570
Metadata
Metadata
Assignees
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.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 teamfinal-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
add feature gate `const_indexing`
debris commentedon Dec 3, 2015
I've updated rust nightly today and i've stumbled upon
const_indexing
issue in my lib.The code was compiling fine on
1.4.0
,beta
and oldnightly
, so I assume it might be the issue with new feature itself, not my code. After quick investigation I worked around the issue in this commit: debris/tiny-keccak@591d611 . Hope it helps with stabilization!oli-obk commentedon Dec 3, 2015
oh... not good. I know what's going on. You are using the index operation on the rhs of a bitshift operation. So during
check_const
the rhs isconst_eval
ed, which triggers this... Fixing this makes the code rather ugly. Basically I need to make sure that during compiler checks no feature gate errors are emitted but simply const eval fails...frewsxcv commentedon Dec 5, 2015
A similar regression also happened here: ende76/brotli-rs#14
Auto merge of #30202 - oli-obk:fix/const_index_feature_gate, r=Aatch
nikomatsakis commentedon Nov 11, 2016
@eddyb do you see any reason not to stabilize this? Seems like we're going to wind up with a model that supports this sort of thing, at least in some cases.
eddyb commentedon Nov 11, 2016
The actual addresses would be different... probably fine though, we already do the same thing in trans.
EDIT: ignore me, this only matters in trans. If
qualify_consts
passes then miri likely can eval it.@oli-obk @solson Any objections regarding miri? Doubt it but just in case.
solson commentedon Nov 11, 2016
Indexing will force allocations in miri, unlike most things supported by legacy const eval, but it wouldn't be the only thing (e.g. I think
*&42
is valid in consts today). It sounds fine.quadrupleslap commentedon Jan 25, 2017
Is this going to be stabilised soon? I tried it on stable, and it works without any issues, but it's feature-gated only on nightly. Why does it seem to work on stable?
oli-obk commentedon Jan 25, 2017
@quadrupleslap: that sounds buggy, can you give an example code exhibiting that behaviour?
33 remaining items
Auto merge of #46882 - oli-obk:miri3, r=<try>
nikomatsakis commentedon Feb 6, 2018
@oli-obk is there a PR for stabilizing this work? I guess landing miri would probably do it...?
oli-obk commentedon Feb 6, 2018
Yes this is part of the miri pr