]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/collect.rs
Store `Ident` rather than just `Name` in HIR types `Item` and `ForeignItem`.
[rust.git] / src / librustc_typeck / collect.rs
index 3b8b6d47d913085d873533b22e1dbf90200dc374..1aede7cf14c3cf8858df3f7012182b4098978fde 100644 (file)
@@ -1,13 +1,3 @@
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 //! "Collection" is the process of determining the type and other external
 //! details of each item in Rust. Collection is specifically concerned
 //! with *interprocedural* things -- for example, for a function
@@ -43,7 +33,7 @@
 use rustc_target::spec::abi;
 
 use syntax::ast;
-use syntax::ast::MetaItemKind;
+use syntax::ast::{Ident, MetaItemKind};
 use syntax::attr::{InlineAttr, list_contains_name, mark_used};
 use syntax::source_map::Spanned;
 use syntax::feature_gate;
@@ -395,7 +385,7 @@ fn is_param<'a, 'tcx>(
 
 fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) {
     let it = tcx.hir().expect_item(item_id);
-    debug!("convert: item {} with id {}", it.name, it.id);
+    debug!("convert: item {} with id {}", it.ident, it.id);
     let def_id = tcx.hir().local_def_id(item_id);
     match it.node {
         // These don't define types.
@@ -543,7 +533,7 @@ fn convert_enum_variant_types<'a, 'tcx>(
                     format!("overflowed on value after {}", prev_discr.unwrap()),
                 ).note(&format!(
                     "explicitly set `{} = {}` if that is desired outcome",
-                    variant.node.name, wrapped_discr
+                    variant.node.ident, wrapped_discr
                 ))
                 .emit();
                 None
@@ -566,7 +556,7 @@ fn convert_enum_variant_types<'a, 'tcx>(
 fn convert_variant<'a, 'tcx>(
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     did: DefId,
-    name: ast::Name,
+    ident: Ident,
     discr: ty::VariantDiscr,
     def: &hir::VariantData,
     adt_kind: ty::AdtKind,
@@ -603,12 +593,13 @@ fn convert_variant<'a, 'tcx>(
         .collect();
     ty::VariantDef::new(tcx,
         did,
-        name,
+        ident,
         discr,
         fields,
         adt_kind,
         CtorKind::from_hir(def),
-        attribute_def_id)
+        attribute_def_id
+    )
 }
 
 fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef {
@@ -638,7 +629,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad
                         };
                         distance_from_explicit += 1;
 
-                        convert_variant(tcx, did, v.node.name, discr, &v.node.data, AdtKind::Enum,
+                        convert_variant(tcx, did, v.node.ident, discr, &v.node.data, AdtKind::Enum,
                                         did)
                     })
                     .collect(),
@@ -656,7 +647,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad
                 std::iter::once(convert_variant(
                     tcx,
                     ctor_id.unwrap_or(def_id),
-                    item.name,
+                    item.ident,
                     ty::VariantDiscr::Relative(0),
                     def,
                     AdtKind::Struct,
@@ -669,7 +660,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad
             std::iter::once(convert_variant(
                 tcx,
                 def_id,
-                item.name,
+                item.ident,
                 ty::VariantDiscr::Relative(0),
                 def,
                 AdtKind::Union,
@@ -2207,6 +2198,8 @@ fn from_target_feature(
                 Some("sse4a_target_feature") => rust_features.sse4a_target_feature,
                 Some("tbm_target_feature") => rust_features.tbm_target_feature,
                 Some("wasm_target_feature") => rust_features.wasm_target_feature,
+                Some("cmpxchg16b_target_feature") => rust_features.cmpxchg16b_target_feature,
+                Some("adx_target_feature") => rust_features.adx_target_feature,
                 Some(name) => bug!("unknown target feature gate {}", name),
                 None => true,
             };