diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2020-11-27 00:35:22 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-03-09 19:23:07 +0100 |
| commit | 4bab93a03924c4044f20e7aee6e0036f6a96d586 (patch) | |
| tree | d33a911b21c7ef070fd22bfdba9b10946223b0ff /compiler | |
| parent | c298744da7208ebb37a76909eefdce2cc5698f79 (diff) | |
| download | rust-4bab93a03924c4044f20e7aee6e0036f6a96d586.tar.gz rust-4bab93a03924c4044f20e7aee6e0036f6a96d586.zip | |
Remove hir::ForeignItem::attrs.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/item.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/stable_hash_impls.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_hir_pretty/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/weak_lang_items.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_save_analysis/src/lib.rs | 9 |
6 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 3cb1a9e994f..bb3af1b7ac9 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -700,10 +700,10 @@ impl<'hir> LoweringContext<'_, 'hir> { fn lower_foreign_item(&mut self, i: &ForeignItem) -> hir::ForeignItem<'hir> { let hir_id = self.lower_node_id(i.id); let def_id = hir_id.expect_owner(); + self.lower_attrs(hir_id, &i.attrs); hir::ForeignItem { def_id, ident: i.ident, - attrs: self.lower_attrs(hir_id, &i.attrs), kind: match i.kind { ForeignItemKind::Fn(box FnKind(_, ref sig, ref generics, _)) => { let fdec = &sig.decl; diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 5f56cca5fc9..e280314d882 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2916,7 +2916,6 @@ pub struct ForeignItemRef<'hir> { #[derive(Debug)] pub struct ForeignItem<'hir> { pub ident: Ident, - pub attrs: &'hir [Attribute], pub kind: ForeignItemKind<'hir>, pub def_id: LocalDefId, pub span: Span, @@ -3083,5 +3082,5 @@ mod size_asserts { rustc_data_structures::static_assert_size!(super::Item<'static>, 200); rustc_data_structures::static_assert_size!(super::TraitItem<'static>, 144); rustc_data_structures::static_assert_size!(super::ImplItem<'static>, 168); - rustc_data_structures::static_assert_size!(super::ForeignItem<'static>, 152); + rustc_data_structures::static_assert_size!(super::ForeignItem<'static>, 136); } diff --git a/compiler/rustc_hir/src/stable_hash_impls.rs b/compiler/rustc_hir/src/stable_hash_impls.rs index 87b41d36915..5a061559576 100644 --- a/compiler/rustc_hir/src/stable_hash_impls.rs +++ b/compiler/rustc_hir/src/stable_hash_impls.rs @@ -178,11 +178,10 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for ImplItem<'_> { impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for ForeignItem<'_> { fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) { - let ForeignItem { def_id: _, ident, ref attrs, ref kind, span, ref vis } = *self; + let ForeignItem { def_id: _, ident, ref kind, span, ref vis } = *self; hcx.hash_hir_item_like(|hcx| { ident.name.hash_stable(hcx, hasher); - attrs.hash_stable(hcx, hasher); kind.hash_stable(hcx, hasher); span.hash_stable(hcx, hasher); vis.hash_stable(hcx, hasher); diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 5f2498c231e..c355d736d49 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -453,7 +453,7 @@ impl<'a> State<'a> { pub fn print_foreign_item(&mut self, item: &hir::ForeignItem<'_>) { self.hardbreak_if_not_bol(); self.maybe_print_comment(item.span.lo()); - self.print_outer_attributes(&item.attrs); + self.print_outer_attributes(self.attrs(item.hir_id())); match item.kind { hir::ForeignItemKind::Fn(ref decl, ref arg_names, ref generics) => { self.head(""); diff --git a/compiler/rustc_passes/src/weak_lang_items.rs b/compiler/rustc_passes/src/weak_lang_items.rs index daff94cb6d3..de369ba9bbb 100644 --- a/compiler/rustc_passes/src/weak_lang_items.rs +++ b/compiler/rustc_passes/src/weak_lang_items.rs @@ -97,7 +97,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> { fn visit_foreign_item(&mut self, i: &hir::ForeignItem<'_>) { let check_name = |attr, sym| self.tcx.sess.check_name(attr, sym); - if let Some((lang_item, _)) = lang_items::extract(check_name, &i.attrs) { + let attrs = self.tcx.hir().attrs(i.hir_id()); + if let Some((lang_item, _)) = lang_items::extract(check_name, attrs) { self.register(lang_item, i.span); } intravisit::walk_foreign_item(self, i) diff --git a/compiler/rustc_save_analysis/src/lib.rs b/compiler/rustc_save_analysis/src/lib.rs index 2bd7aa58afa..d0e7be63891 100644 --- a/compiler/rustc_save_analysis/src/lib.rs +++ b/compiler/rustc_save_analysis/src/lib.rs @@ -139,6 +139,7 @@ impl<'tcx> SaveContext<'tcx> { pub fn get_extern_item_data(&self, item: &hir::ForeignItem<'_>) -> Option<Data> { let def_id = item.def_id.to_def_id(); let qualname = format!("::{}", self.tcx.def_path_str(def_id)); + let attrs = self.tcx.hir().attrs(item.hir_id()); match item.kind { hir::ForeignItemKind::Fn(ref decl, arg_names, ref generics) => { filter!(self.span_utils, item.ident.span); @@ -169,9 +170,9 @@ impl<'tcx> SaveContext<'tcx> { parent: None, children: vec![], decl_id: None, - docs: self.docs_for_attrs(&item.attrs), + docs: self.docs_for_attrs(attrs), sig: sig::foreign_item_signature(item, self), - attributes: lower_attributes(item.attrs.to_vec(), self), + attributes: lower_attributes(attrs.to_vec(), self), })) } hir::ForeignItemKind::Static(ref ty, _) => { @@ -190,9 +191,9 @@ impl<'tcx> SaveContext<'tcx> { parent: None, children: vec![], decl_id: None, - docs: self.docs_for_attrs(&item.attrs), + docs: self.docs_for_attrs(attrs), sig: sig::foreign_item_signature(item, self), - attributes: lower_attributes(item.attrs.to_vec(), self), + attributes: lower_attributes(attrs.to_vec(), self), })) } // FIXME(plietar): needs a new DefKind in rls-data |
