diff options
| author | Alexander Regueiro <alexreg@me.com> | 2019-09-06 03:56:45 +0100 |
|---|---|---|
| committer | Alexander Regueiro <alexreg@me.com> | 2019-09-07 16:29:04 +0100 |
| commit | 49d2fd1725510fd3bf6f2937e178b1aa055ddb02 (patch) | |
| tree | a04455dea49b29d2c981573bd920116f0418024b /src/libsyntax/feature_gate | |
| parent | ef54f57c5b9d894a38179d09b00610c1b337b086 (diff) | |
| download | rust-49d2fd1725510fd3bf6f2937e178b1aa055ddb02.tar.gz rust-49d2fd1725510fd3bf6f2937e178b1aa055ddb02.zip | |
Aggregation of cosmetic changes made during work on REPL PRs: libsyntax
Diffstat (limited to 'src/libsyntax/feature_gate')
| -rw-r--r-- | src/libsyntax/feature_gate/active.rs | 18 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate/builtin_attrs.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate/check.rs | 4 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/libsyntax/feature_gate/active.rs b/src/libsyntax/feature_gate/active.rs index c947b09fdcb..a15fc050141 100644 --- a/src/libsyntax/feature_gate/active.rs +++ b/src/libsyntax/feature_gate/active.rs @@ -1,9 +1,11 @@ //! List of the active feature gates. +use super::{State, Feature}; + use crate::edition::Edition; use crate::symbol::{Symbol, sym}; + use syntax_pos::Span; -use super::{State, Feature}; macro_rules! set { ($field: ident) => {{ @@ -37,9 +39,9 @@ macro_rules! declare_features { /// A set of features to be used by later passes. #[derive(Clone)] pub struct Features { - /// `#![feature]` attrs for language features, for error reporting + /// `#![feature]` attrs for language features, for error reporting. pub declared_lang_features: Vec<(Symbol, Span, Option<Symbol>)>, - /// `#![feature]` attrs for non-language (library) features + /// `#![feature]` attrs for non-language (library) features. pub declared_lib_features: Vec<(Symbol, Span)>, $( $(#[doc = $doc])* @@ -66,11 +68,11 @@ macro_rules! declare_features { } impl Feature { - /// Set this feature in `Features`. Panics if called on a non-active feature. + /// Sets this feature in `Features`. Panics if called on a non-active feature. pub fn set(&self, features: &mut Features, span: Span) { match self.state { State::Active { set } => set(features, span), - _ => panic!("Called `set` on feature `{}` which is not `active`", self.name) + _ => panic!("called `set` on feature `{}` which is not `active`", self.name) } } } @@ -478,7 +480,7 @@ declare_features! ( (active, precise_pointer_size_matching, "1.32.0", Some(56354), None), /// Allows relaxing the coherence rules such that - /// `impl<T> ForeignTrait<LocalType> for ForeignType<T> is permitted. + /// `impl<T> ForeignTrait<LocalType> for ForeignType<T>` is permitted. (active, re_rebalance_coherence, "1.32.0", Some(55437), None), /// Allows using `#[ffi_returns_twice]` on foreign functions. @@ -520,7 +522,7 @@ declare_features! ( /// Allows `async || body` closures. (active, async_closure, "1.37.0", Some(62290), None), - /// Allows the use of `#[cfg(doctest)]`, set when rustdoc is collecting doctests + /// Allows the use of `#[cfg(doctest)]`; set when rustdoc is collecting doctests. (active, cfg_doctest, "1.37.0", Some(62210), None), /// Allows `[x; N]` where `x` is a constant (RFC 2203). @@ -529,7 +531,7 @@ declare_features! ( /// Allows `impl Trait` to be used inside type aliases (RFC 2515). (active, type_alias_impl_trait, "1.38.0", Some(63063), None), - /// Allows the use of or-patterns, e.g. `0 | 1`. + /// Allows the use of or-patterns (e.g., `0 | 1`). (active, or_patterns, "1.38.0", Some(54883), None), // ------------------------------------------------------------------------- diff --git a/src/libsyntax/feature_gate/builtin_attrs.rs b/src/libsyntax/feature_gate/builtin_attrs.rs index ee7ac3b15d9..763c3ffd782 100644 --- a/src/libsyntax/feature_gate/builtin_attrs.rs +++ b/src/libsyntax/feature_gate/builtin_attrs.rs @@ -169,7 +169,7 @@ const INTERAL_UNSTABLE: &str = "this is an internal attribute that will never be pub type BuiltinAttribute = (Symbol, AttributeType, AttributeTemplate, AttributeGate); -/// Attributes that have a special meaning to rustc or rustdoc +/// Attributes that have a special meaning to rustc or rustdoc. pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // ========================================================================== // Stable attributes: diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index f3a9d135125..5711b269ff0 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -920,9 +920,9 @@ pub enum UnstableFeatures { impl UnstableFeatures { pub fn from_environment() -> UnstableFeatures { - // Whether this is a feature-staged build, i.e., on the beta or stable channel + // `true` if this is a feature-staged build, i.e., on the beta or stable channel. let disable_unstable_features = option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some(); - // Whether we should enable unstable features for bootstrapping + // `true` if we should enable unstable features for bootstrapping. let bootstrap = env::var("RUSTC_BOOTSTRAP").is_ok(); match (disable_unstable_features, bootstrap) { (_, true) => UnstableFeatures::Cheat, |
