Skip to content

tracking issue for const_indexing stabilization #29947

@oli-obk

Description

@oli-obk
Contributor

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

Activity

added a commit that references this issue on Nov 20, 2015
debris

debris commented on Dec 3, 2015

@debris
Contributor

I've updated rust nightly today and i've stumbled upon const_indexing issue in my lib.

const indexing is an unstable feature

The code was compiling fine on 1.4.0, beta and old nightly, 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

oli-obk commented on Dec 3, 2015

@oli-obk
ContributorAuthor

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 is const_evaled, 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

frewsxcv commented on Dec 5, 2015

@frewsxcv
Member

A similar regression also happened here: ende76/brotli-rs#14

added a commit that references this issue on Dec 7, 2015
added
B-unstableBlocker: Implemented in the nightly compiler and unstable.
T-langRelevant to the language team
on Jan 6, 2016
nikomatsakis

nikomatsakis commented on Nov 11, 2016

@nikomatsakis
Contributor

@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

eddyb commented on Nov 11, 2016

@eddyb
Member

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

solson commented on Nov 11, 2016

@solson
Member

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

quadrupleslap commented on Jan 25, 2017

@quadrupleslap

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

oli-obk commented on Jan 25, 2017

@oli-obk
ContributorAuthor

@quadrupleslap: that sounds buggy, can you give an example code exhibiting that behaviour?

33 remaining items

added a commit that references this issue on Feb 6, 2018
570838a
nikomatsakis

nikomatsakis commented on Feb 6, 2018

@nikomatsakis
Contributor

@oli-obk is there a PR for stabilizing this work? I guess landing miri would probably do it...?

oli-obk

oli-obk commented on Feb 6, 2018

@oli-obk
ContributorAuthor

Yes this is part of the miri pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamfinal-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @solson@eddyb@nikomatsakis@oli-obk@mrhota

      Issue actions

        tracking issue for `const_indexing` stabilization · Issue #29947 · rust-lang/rust