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
|
|
@ -15,7 +15,7 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use syntax::ast::*;
|
||||
use syntax::attr;
|
||||
use syntax::source_map::Spanned;
|
||||
use syntax::symbol::keywords;
|
||||
use syntax::symbol::{keywords, sym};
|
||||
use syntax::ptr::P;
|
||||
use syntax::visit::{self, Visitor};
|
||||
use syntax::{span_err, struct_span_err, walk_list};
|
||||
|
|
@ -565,7 +565,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
self.has_proc_macro_decls = true;
|
||||
}
|
||||
|
||||
if attr::contains_name(&item.attrs, "global_allocator") {
|
||||
if attr::contains_name(&item.attrs, sym::global_allocator) {
|
||||
self.has_global_allocator = true;
|
||||
}
|
||||
|
||||
|
|
@ -676,8 +676,8 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
}
|
||||
ItemKind::Mod(_) => {
|
||||
// Ensure that `path` attributes on modules are recorded as used (cf. issue #35584).
|
||||
attr::first_attr_value_str_by_name(&item.attrs, "path");
|
||||
if attr::contains_name(&item.attrs, "warn_directory_ownership") {
|
||||
attr::first_attr_value_str_by_name(&item.attrs, sym::path);
|
||||
if attr::contains_name(&item.attrs, sym::warn_directory_ownership) {
|
||||
let lint = lint::builtin::LEGACY_DIRECTORY_OWNERSHIP;
|
||||
let msg = "cannot declare a new module at this location";
|
||||
self.session.buffer_lint(lint, item.id, item.span, msg);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use rustc::ty::ParamEnv;
|
|||
use rustc::ty::Ty;
|
||||
use rustc::ty::TyCtxt;
|
||||
use syntax::ast::Attribute;
|
||||
use syntax::symbol::sym;
|
||||
|
||||
pub fn test_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
||||
if tcx.features().rustc_attrs {
|
||||
|
|
@ -32,7 +33,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> {
|
|||
|
||||
if let ItemKind::Ty(..) = item.node {
|
||||
for attr in self.tcx.get_attrs(item_def_id).iter() {
|
||||
if attr.check_name("rustc_layout") {
|
||||
if attr.check_name(sym::rustc_layout) {
|
||||
self.dump_layout_of(item_def_id, item, attr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use rustc::ty::query::Providers;
|
|||
use rustc::ty::subst::{InternalSubsts, SubstsRef};
|
||||
use rustc::util::nodemap::{ItemLocalSet, HirIdSet};
|
||||
use rustc::hir;
|
||||
use syntax::symbol::sym;
|
||||
use syntax_pos::{Span, DUMMY_SP};
|
||||
use log::debug;
|
||||
use Promotability::*;
|
||||
|
|
@ -335,7 +336,7 @@ fn check_expr_kind<'a, 'tcx>(
|
|||
|
||||
if v.in_static {
|
||||
for attr in &v.tcx.get_attrs(did)[..] {
|
||||
if attr.check_name("thread_local") {
|
||||
if attr.check_name(sym::thread_local) {
|
||||
debug!("Reference to Static(id={:?}) is unpromotable \
|
||||
due to a #[thread_local] attribute", did);
|
||||
return NotPromotable;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue