diff options
| author | bors <bors@rust-lang.org> | 2019-09-07 22:08:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-07 22:08:30 +0000 |
| commit | f7b05af814f02681d8973438df4ed5792f581841 (patch) | |
| tree | d19b29534ae871eaa6fdf621d2658dd041672075 /src/libsyntax | |
| parent | 43a5ff4222e1f217ac14331afd59f82ec4204d12 (diff) | |
| parent | cd3cb281da9a4387f5896db75129d7dd73cca8f4 (diff) | |
| download | rust-f7b05af814f02681d8973438df4ed5792f581841.tar.gz rust-f7b05af814f02681d8973438df4ed5792f581841.zip | |
Auto merge of #64269 - Centril:rollup-y4dm32c, r=Centril
Rollup of 5 pull requests Successful merges: - #64052 (Rename test locals to work around LLDB bug) - #64066 (Support "soft" feature-gating using a lint) - #64177 (resolve: Do not afraid to set current module to enums and traits) - #64229 (Reduce span to function name in unreachable calls) - #64255 (Add methods for converting `bool` to `Option<T>`) Failed merges: r? @ghost
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/attr/builtin.rs | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index 5fb513783fb..b5037b75f79 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -154,23 +154,10 @@ pub struct Stability { #[derive(RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Copy, Clone, Debug, Eq, Hash)] pub enum StabilityLevel { // Reason for the current stability level and the relevant rust-lang issue - Unstable { reason: Option<Symbol>, issue: u32 }, + Unstable { reason: Option<Symbol>, issue: u32, is_soft: bool }, Stable { since: Symbol }, } -impl Stability { - pub fn unstable(feature: Symbol, reason: Option<Symbol>, issue: u32) -> Stability { - Stability { - level: StabilityLevel::Unstable { reason, issue }, - feature, - rustc_depr: None, - const_stability: None, - promotable: false, - allow_const_fn_ptr: false, - } - } -} - impl StabilityLevel { pub fn is_unstable(&self) -> bool { if let StabilityLevel::Unstable {..} = *self { @@ -356,19 +343,27 @@ fn find_stability_generic<'a, I>(sess: &ParseSess, let mut feature = None; let mut reason = None; let mut issue = None; + let mut is_soft = false; for meta in metas { if let Some(mi) = meta.meta_item() { match mi.name_or_empty() { sym::feature => if !get(mi, &mut feature) { continue 'outer }, sym::reason => if !get(mi, &mut reason) { continue 'outer }, sym::issue => if !get(mi, &mut issue) { continue 'outer }, + sym::soft => { + if !mi.is_word() { + let msg = "`soft` should not have any arguments"; + sess.span_diagnostic.span_err(mi.span, msg); + } + is_soft = true; + } _ => { handle_errors( sess, meta.span(), AttrError::UnknownMetaItem( mi.path.to_string(), - &["feature", "reason", "issue"] + &["feature", "reason", "issue", "soft"] ), ); continue 'outer @@ -400,7 +395,8 @@ fn find_stability_generic<'a, I>(sess: &ParseSess, "incorrect 'issue'"); continue } - } + }, + is_soft, }, feature, rustc_depr: None, |
