diff options
| author | bors <bors@rust-lang.org> | 2018-09-01 11:26:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-09-01 11:26:24 +0000 |
| commit | fea32f1b775b3f37fc4abfa6391c1bebe48af9d1 (patch) | |
| tree | ab51afef12f740e9b7e2ffd7595ce0869c7e45a1 /src/libsyntax | |
| parent | e6381a7f37402dd5f346256b3773ae2e72853fc3 (diff) | |
| parent | 2839f4f0e8d58c295e146999961b78e2cc47354f (diff) | |
| download | rust-fea32f1b775b3f37fc4abfa6391c1bebe48af9d1.tar.gz rust-fea32f1b775b3f37fc4abfa6391c1bebe48af9d1.zip | |
Auto merge of #53604 - oli-obk:min_const_fn, r=Centril,varkor
Implement the `min_const_fn` feature gate cc @RalfJung @eddyb r? @Centril implements the feature gate for #53555 I added a hack so the `const_fn` feature gate also enables the `min_const_fn` feature gate. This ensures that nightly users of `const_fn` don't have to touch their code at all. The `min_const_fn` checks are run first, and if they succeeded, the `const_fn` checks are run additionally to ensure we didn't miss anything.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/attr/builtin.rs | 26 | ||||
| -rw-r--r-- | src/libsyntax/attr/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 29 |
3 files changed, 34 insertions, 23 deletions
diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index ecd52a62eab..3eecdf14a4e 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -107,7 +107,11 @@ pub struct Stability { pub level: StabilityLevel, pub feature: Symbol, pub rustc_depr: Option<RustcDeprecation>, - pub rustc_const_unstable: Option<RustcConstUnstable>, + /// `None` means the function is stable but needs to be allowed by the + /// `min_const_fn` feature + /// `Some` contains the feature gate required to be able to use the function + /// as const fn + pub const_stability: Option<Symbol>, } /// The available stability levels. @@ -141,11 +145,6 @@ pub struct RustcDeprecation { pub reason: Symbol, } -#[derive(RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Clone, Debug, Eq, Hash)] -pub struct RustcConstUnstable { - pub feature: Symbol, -} - /// Check if `attrs` contains an attribute like `#![feature(feature_name)]`. /// This will not perform any "sanity checks" on the form of the attributes. pub fn contains_feature_attr(attrs: &[Attribute], feature_name: &str) -> bool { @@ -176,7 +175,7 @@ fn find_stability_generic<'a, I>(diagnostic: &Handler, let mut stab: Option<Stability> = None; let mut rustc_depr: Option<RustcDeprecation> = None; - let mut rustc_const_unstable: Option<RustcConstUnstable> = None; + let mut rustc_const_unstable: Option<Symbol> = None; 'outer: for attr in attrs_iter { if 