rust/compiler/rustc_builtin_macros/src/util.rs

13 lines
530 B
Rust
Raw Normal View History

2020-04-27 12:56:11 -05:00
use rustc_ast::MetaItem;
use rustc_expand::base::ExtCtxt;
2019-11-29 19:34:18 -06:00
use rustc_feature::AttributeTemplate;
2019-12-22 16:42:04 -06:00
use rustc_parse::validate_attr;
use rustc_span::Symbol;
2019-10-08 07:15:26 -05:00
pub fn check_builtin_macro_attribute(ecx: &ExtCtxt<'_>, meta_item: &MetaItem, name: Symbol) {
// All the built-in macro attributes are "words" at the moment.
2019-12-30 12:38:43 -06:00
let template = AttributeTemplate { word: true, ..Default::default() };
2019-10-08 07:15:26 -05:00
let attr = ecx.attribute(meta_item.clone());
validate_attr::check_builtin_attribute(&ecx.sess.parse_sess, &attr, name, template);
2019-10-08 07:15:26 -05:00
}