Skip to content

Commit 587b9ab

Browse files
committed
Retire rustc::ty::Attributes enum.
1 parent 81f0e90 commit 587b9ab

File tree

2 files changed

+10
-33
lines changed

2 files changed

+10
-33
lines changed

src/librustc_middle/ty/mod.rs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc_data_structures::fx::FxHashMap;
2929
use rustc_data_structures::fx::FxIndexMap;
3030
use rustc_data_structures::sorted_map::SortedIndexMultiMap;
3131
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
32-
use rustc_data_structures::sync::{self, par_iter, Lrc, ParallelIterator};
32+
use rustc_data_structures::sync::{self, par_iter, ParallelIterator};
3333
use rustc_hir as hir;
3434
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Namespace, Res};
3535
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, CRATE_DEF_INDEX};
@@ -2760,22 +2760,7 @@ impl BorrowKind {
27602760
}
27612761
}
27622762

2763-
#[derive(Debug, Clone)]
2764-
pub enum Attributes<'tcx> {
2765-
Owned(Lrc<[ast::Attribute]>),
2766-
Borrowed(&'tcx [ast::Attribute]),
2767-
}
2768-
2769-
impl<'tcx> ::std::ops::Deref for Attributes<'tcx> {
2770-
type Target = [ast::Attribute];
2771-
2772-
fn deref(&self) -> &[ast::Attribute] {
2773-
match self {
2774-
&Attributes::Owned(ref data) => &data,
2775-
&Attributes::Borrowed(data) => data,
2776-
}
2777-
}
2778-
}
2763+
pub type Attributes<'tcx> = &'tcx [ast::Attribute];
27792764

27802765
#[derive(Debug, PartialEq, Eq)]
27812766
pub enum ImplOverlapKind {
@@ -3011,9 +2996,9 @@ impl<'tcx> TyCtxt<'tcx> {
30112996
/// Gets the attributes of a definition.
30122997
pub fn get_attrs(self, did: DefId) -> Attributes<'tcx> {
30132998
if let Some(id) = self.hir().as_local_hir_id(did) {
3014-
Attributes::Borrowed(self.hir().attrs(id))
2999+
self.hir().attrs(id)
30153000
} else {
3016-
Attributes::Borrowed(self.item_attrs(did))
3001+
self.item_attrs(did)
30173002
}
30183003
}
30193004

src/librustdoc/clean/mod.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,13 +2178,9 @@ impl Clean<Vec<Item>> for doctree::ExternCrate<'_> {
21782178

21792179
let res = Res::Def(DefKind::Mod, DefId { krate: self.cnum, index: CRATE_DEF_INDEX });
21802180

2181-
if let Some(items) = inline::try_inline(
2182-
cx,
2183-
res,
2184-
self.name,
2185-
Some(rustc_middle::ty::Attributes::Borrowed(self.attrs)),
2186-
&mut visited,
2187-
) {
2181+
if let Some(items) =
2182+
inline::try_inline(cx, res, self.name, Some(self.attrs), &mut visited)
2183+
{
21882184
return items;
21892185
}
21902186
}
@@ -2245,13 +2241,9 @@ impl Clean<Vec<Item>> for doctree::Import<'_> {
22452241
}
22462242
if !denied {
22472243
let mut visited = FxHashSet::default();
2248-
if let Some(items) = inline::try_inline(
2249-
cx,
2250-
path.res,
2251-
name,
2252-
Some(rustc_middle::ty::Attributes::Borrowed(self.attrs)),
2253-
&mut visited,
2254-
) {
2244+
if let Some(items) =
2245+
inline::try_inline(cx, path.res, name, Some(self.attrs), &mut visited)
2246+
{
22552247
return items;
22562248
}
22572249
}

0 commit comments

Comments
 (0)