Retire rustc::ty::Attributes enum.
This commit is contained in:
parent
81f0e90c62
commit
587b9abd4e
2 changed files with 10 additions and 33 deletions
|
|
@ -29,7 +29,7 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::sorted_map::SortedIndexMultiMap;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_data_structures::sync::{self, par_iter, Lrc, ParallelIterator};
|
||||
use rustc_data_structures::sync::{self, par_iter, ParallelIterator};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Namespace, Res};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, CRATE_DEF_INDEX};
|
||||
|
|
@ -2760,22 +2760,7 @@ impl BorrowKind {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Attributes<'tcx> {
|
||||
Owned(Lrc<[ast::Attribute]>),
|
||||
Borrowed(&'tcx [ast::Attribute]),
|
||||
}
|
||||
|
||||
impl<'tcx> ::std::ops::Deref for Attributes<'tcx> {
|
||||
type Target = [ast::Attribute];
|
||||
|
||||
fn deref(&self) -> &[ast::Attribute] {
|
||||
match self {
|
||||
&Attributes::Owned(ref data) => &data,
|
||||
&Attributes::Borrowed(data) => data,
|
||||
}
|
||||
}
|
||||
}
|
||||
pub type Attributes<'tcx> = &'tcx [ast::Attribute];
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum ImplOverlapKind {
|
||||
|
|
@ -3011,9 +2996,9 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
/// Gets the attributes of a definition.
|
||||
pub fn get_attrs(self, did: DefId) -> Attributes<'tcx> {
|
||||
if let Some(id) = self.hir().as_local_hir_id(did) {
|
||||
Attributes::Borrowed(self.hir().attrs(id))
|
||||
self.hir().attrs(id)
|
||||
} else {
|
||||
Attributes::Borrowed(self.item_attrs(did))
|
||||
self.item_attrs(did)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2178,13 +2178,9 @@ impl Clean<Vec<Item>> for doctree::ExternCrate<'_> {
|
|||
|
||||
let res = Res::Def(DefKind::Mod, DefId { krate: self.cnum, index: CRATE_DEF_INDEX });
|
||||
|
||||
if let Some(items) = inline::try_inline(
|
||||
cx,
|
||||
res,
|
||||
self.name,
|
||||
Some(rustc_middle::ty::Attributes::Borrowed(self.attrs)),
|
||||
&mut visited,
|
||||
) {
|
||||
if let Some(items) =
|
||||
inline::try_inline(cx, res, self.name, Some(self.attrs), &mut visited)
|
||||
{
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
|
@ -2245,13 +2241,9 @@ impl Clean<Vec<Item>> for doctree::Import<'_> {
|
|||
}
|
||||
if !denied {
|
||||
let mut visited = FxHashSet::default();
|
||||
if let Some(items) = inline::try_inline(
|
||||
cx,
|
||||
path.res,
|
||||
name,
|
||||
Some(rustc_middle::ty::Attributes::Borrowed(self.attrs)),
|
||||
&mut visited,
|
||||
) {
|
||||
if let Some(items) =
|
||||
inline::try_inline(cx, path.res, name, Some(self.attrs), &mut visited)
|
||||
{
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue