]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/dead.rs
Auto merge of #59033 - GuillaumeGomez:duplicated-bounds, r=Dylan-DPC
[rust.git] / src / librustc / middle / dead.rs
index a0107ed0546ddd2209245caa06445a344084da69..04f5b35a0061aa4141ca4dca059fe84ce205cec4 100644 (file)
@@ -19,6 +19,7 @@
 
 use syntax::{ast, source_map};
 use syntax::attr;
+use syntax::symbol::sym;
 use syntax_pos;
 
 // Any local node that may call something in its body block should be
@@ -71,13 +72,13 @@ fn insert_def_id(&mut self, def_id: DefId) {
     fn handle_res(&mut self, res: Res) {
         match res {
             Res::Def(DefKind::Const, _)
-            | Res::Def(DefKind::AssociatedConst, _)
+            | Res::Def(DefKind::AssocConst, _)
             | Res::Def(DefKind::TyAlias, _) => {
                 self.check_def_id(res.def_id());
             }
             _ if self.in_pat => {},
             Res::PrimTy(..) | Res::SelfTy(..) | Res::SelfCtor(..) |
-            Res::Local(..) | Res::Upvar(..) => {}
+            Res::Local(..) => {}
             Res::Def(DefKind::Ctor(CtorOf::Variant, ..), ctor_def_id) => {
                 let variant_id = self.tcx.parent(ctor_def_id).unwrap();
                 let enum_id = self.tcx.parent(variant_id).unwrap();
@@ -304,22 +305,22 @@ fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
 fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
                                     id: hir::HirId,
                                     attrs: &[ast::Attribute]) -> bool {
-    if attr::contains_name(attrs, "lang") {
+    if attr::contains_name(attrs, sym::lang) {
         return true;
     }
 
     // Stable attribute for #[lang = "panic_impl"]
-    if attr::contains_name(attrs, "panic_handler") {
+    if attr::contains_name(attrs, sym::panic_handler) {
         return true;
     }
 
     // (To be) stable attribute for #[lang = "oom"]
-    if attr::contains_name(attrs, "alloc_error_handler") {
+    if attr::contains_name(attrs, sym::alloc_error_handler) {
         return true;
     }
 
     // Don't lint about global allocators
-    if attr::contains_name(attrs, "global_allocator") {
+    if attr::contains_name(attrs, sym::global_allocator) {
         return true;
     }