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

Enforce min_const_fn by default in staged_api with opt-out #64285

Closed
Centril opened this issue Sep 8, 2019 · 1 comment
Closed

Enforce min_const_fn by default in staged_api with opt-out #64285

Centril opened this issue Sep 8, 2019 · 1 comment
Assignees
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-const-eval Area: Constant evaluation (MIR interpretation) A-stability Area: `#[stable]`, `#[unstable]` etc. C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Centril
Copy link
Contributor

Centril commented Sep 8, 2019

We want to switch to a scheme where everything inside the standard library requires min_const_fn by default. If an additional #[rustc_not_min_const_fn] is present, then the function will be uncallable from any min_const_fn.

It's also important to note that a function #[rustc_const_unstable(feature "foo")] const fn bar() {} without #[rustc_not_min_const_fn] should a) enforce that that the function is min_const_fn even without the feature gate active, b) not be callable as min_const_fn without the the feature gate active.

Relevant code exists in:


Context: Centril@93ad760#r34994115 (also see my branch master...Centril:stabilize-vec-new-const)

Conversation replayed (keep-safe):

@oli-obk:

One thing that could be done is what's essentially the opposite scheme. Everything requires min_const_fn by default, unless it has an additional rustc_not_min_const_fn attribute (which makes the function uncallable from any min_const_fn).

Or rename the attribute to rustc_require_min_const_fn, to make it sound less like an override

@Centril:

One thing that could be done is what's essentially the opposite scheme.

Oh... I like that! -- but what about user-land const fn? Do we only enforce this for staged_api crates?

@oli-obk:

user land const fn just keeps doing what it does now. As long as there's a const fn feature gate active, everything is not min_const_fn. The reason we have a complex scheme in libstd is stability. Users using nightly with feature gates already opt out of stability.

@Centril Centril added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-attributes Area: Attributes (`#[…]`, `#![…]`) P-medium Medium priority A-stability Area: `#[stable]`, `#[unstable]` etc. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-const-eval Area: Constant evaluation (MIR interpretation) labels Sep 8, 2019
@Centril
Copy link
Contributor Author

Centril commented Dec 14, 2019

Fixed by @oli-obk in #67136.

@Centril Centril closed this as completed Dec 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-const-eval Area: Constant evaluation (MIR interpretation) A-stability Area: `#[stable]`, `#[unstable]` etc. C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Medium priority 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

2 participants