Pass a Symbol to check_name, emit_feature_err, and related functions.
This commit is contained in:
parent
79602c87b5
commit
fb084a48e2
114 changed files with 671 additions and 621 deletions
|
|
@ -1,6 +1,7 @@
|
|||
//! Used by `rustc` when compiling a plugin crate.
|
||||
|
||||
use syntax::attr;
|
||||
use syntax::symbol::sym;
|
||||
use syntax_pos::Span;
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::hir;
|
||||
|
|
@ -15,8 +16,7 @@ struct RegistrarFinder {
|
|||
impl<'v> ItemLikeVisitor<'v> for RegistrarFinder {
|
||||
fn visit_item(&mut self, item: &hir::Item) {
|
||||
if let hir::ItemKind::Fn(..) = item.node {
|
||||
if attr::contains_name(&item.attrs,
|
||||
"plugin_registrar") {
|
||||
if attr::contains_name(&item.attrs, sym::plugin_registrar) {
|
||||
self.registrars.push((item.hir_id, item.span));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use std::mem;
|
|||
use std::path::PathBuf;
|
||||
use syntax::ast;
|
||||
use syntax::span_err;
|
||||
use syntax::symbol::sym;
|
||||
use syntax_pos::{Span, DUMMY_SP};
|
||||
|
||||
/// Pointer to a registrar function.
|
||||
|
|
@ -45,7 +46,7 @@ pub fn load_plugins(sess: &Session,
|
|||
// the feature enabled will result in an error later...
|
||||
if sess.features_untracked().plugin {
|
||||
for attr in &krate.attrs {
|
||||
if !attr.check_name("plugin") {
|
||||
if !attr.check_name(sym::plugin) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ pub struct Registry<'a> {
|
|||
pub llvm_passes: Vec<String>,
|
||||
|
||||
#[doc(hidden)]
|
||||
pub attributes: Vec<(String, AttributeType)>,
|
||||
pub attributes: Vec<(Symbol, AttributeType)>,
|
||||
}
|
||||
|
||||
impl<'a> Registry<'a> {
|
||||
|
|
@ -169,7 +169,7 @@ impl<'a> Registry<'a> {
|
|||
/// Registered attributes will bypass the `custom_attribute` feature gate.
|
||||
/// `Whitelisted` attributes will additionally not trigger the `unused_attribute`
|
||||
/// lint. `CrateLevel` attributes will not be allowed on anything other than a crate.
|
||||
pub fn register_attribute(&mut self, name: String, ty: AttributeType) {
|
||||
pub fn register_attribute(&mut self, name: Symbol, ty: AttributeType) {
|
||||
self.attributes.push((name, ty));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue