diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-11-30 00:56:46 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-11-30 00:56:46 +0100 |
| commit | 8ad4d15f3888f1339d52632d40e0a47697dd2a24 (patch) | |
| tree | ae7cc6454831442d6a43b74f0edac117ddc3460c /src/libsyntax/attr | |
| parent | 048201fa7a69b3c3795e76186bc954d06d2ca368 (diff) | |
| download | rust-8ad4d15f3888f1339d52632d40e0a47697dd2a24.tar.gz rust-8ad4d15f3888f1339d52632d40e0a47697dd2a24.zip | |
move AttributeTemplate to builtin_attrs
Diffstat (limited to 'src/libsyntax/attr')
| -rw-r--r-- | src/libsyntax/attr/builtin.rs | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index eaa4a64025a..be53d802eec 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -25,31 +25,6 @@ enum AttrError { UnsupportedLiteral(&'static str, /* is_bytestr */ bool), } -/// A template that the attribute input must match. -/// Only top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is considered now. -#[derive(Clone, Copy)] -pub struct AttributeTemplate { - pub word: bool, - pub list: Option<&'static str>, - pub name_value_str: Option<&'static str>, -} - -impl AttributeTemplate { - pub fn only_word() -> Self { - Self { word: true, list: None, name_value_str: None } - } - - /// Checks that the given meta-item is compatible with this template. - pub fn compatible(&self, meta_item_kind: &ast::MetaItemKind) -> bool { - match meta_item_kind { - ast::MetaItemKind::Word => self.word, - ast::MetaItemKind::List(..) => self.list.is_some(), - ast::MetaItemKind::NameValue(lit) if lit.kind.is_str() => self.name_value_str.is_some(), - ast::MetaItemKind::NameValue(..) => false, - } - } -} - fn handle_errors(sess: &ParseSess, span: Span, error: AttrError) { let diag = &sess.span_diagnostic; match error { |
