diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-11-12 23:42:42 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-11-20 19:35:03 +0300 |
| commit | 993bb072ff30a0e6fbc4689ba1639dfdb951888c (patch) | |
| tree | 8ecec80ce62bb7bde501c06d255115a4cf5e65de /compiler/rustc_resolve | |
| parent | ae6aa22cf26fede2177abe4ff974030058885b7a (diff) | |
| download | rust-993bb072ff30a0e6fbc4689ba1639dfdb951888c.tar.gz rust-993bb072ff30a0e6fbc4689ba1639dfdb951888c.zip | |
rustc_expand: Mark inner `#![test]` attributes as soft-unstable
Diffstat (limited to 'compiler/rustc_resolve')
| -rw-r--r-- | compiler/rustc_resolve/src/macros.rs | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index 1ee96f81e4f..c8dbe685128 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -22,7 +22,7 @@ use rustc_hir::def::{self, DefKind, NonMacroAttrKind}; use rustc_hir::def_id; use rustc_middle::middle::stability; use rustc_middle::ty; -use rustc_session::lint::builtin::UNUSED_MACROS; +use rustc_session::lint::builtin::{SOFT_UNSTABLE, UNUSED_MACROS}; use rustc_session::parse::feature_err; use rustc_session::Session; use rustc_span::edition::Edition; @@ -459,22 +459,21 @@ impl<'a> Resolver<'a> { } // We are trying to avoid reporting this error if other related errors were reported. - if inner_attr + if res != Res::Err + && inner_attr && !self.session.features_untracked().custom_inner_attributes - && path != &sym::test - && res != Res::Err { - feature_err( - &self.session.parse_sess, - sym::custom_inner_attributes, - path.span, - match res { - Res::Def(..) => "inner macro attributes are unstable", - Res::NonMacroAttr(..) => "custom inner attributes are unstable", - _ => unreachable!(), - }, - ) - .emit(); + let msg = match res { + Res::Def(..) => "inner macro attributes are unstable", + Res::NonMacroAttr(..) => "custom inner attributes are unstable", + _ => unreachable!(), + }; + if path == &sym::test { + self.session.parse_sess.buffer_lint(SOFT_UNSTABLE, path.span, node_id, msg); + } else { + feature_err(&self.session.parse_sess, sym::custom_inner_attributes, path.span, msg) + .emit(); + } } Ok((ext, res)) |
