]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #68114 - ecstatic-morse:fix-feature-gating, r=Centril
authorMazdak Farrokhzad <twingoow@gmail.com>
Sat, 11 Jan 2020 11:36:14 +0000 (12:36 +0100)
committerGitHub <noreply@github.com>
Sat, 11 Jan 2020 11:36:14 +0000 (12:36 +0100)
Don't require `allow_internal_unstable` unless `staged_api` is enabled.

#63770 changed `qualify_min_const_fn` to require `allow_internal_unstable` for *all* crates that used an unstable feature, regardless of whether `staged_api` was enabled or the `fn` that used that feature was stably const. In practice, this meant that every crate in the ecosystem that wanted to use nightly features added `#![feature(const_fn)]`, which skips `qualify_min_const_fn` entirely.

After this PR, crates that do not have `#![feature(staged_api)]` will only need to enable the feature they are interested in. For example, `#![feature(const_if_match)]` will be enough to enable `if` and `match` in constants. Crates with `staged_api` (e.g., `libstd`) require `#[allow_internal_unstable]` to be added to a function if it uses nightly features unless that function is also marked `#[rustc_const_unstable]`. This prevents proliferation of `#[allow_internal_unstable]` into functions that are not callable in a `const` context on stable.

r? @oli-obk (author of #63770)
cc @Centril

1  2 
src/libcore/tests/lib.rs
src/librustdoc/lib.rs
src/libsyntax/lib.rs

Simple merge
Simple merge
Simple merge