Skip to content

Commit 962e451

Browse files
committed
Replace all uses of path.res.def_id() with path.def_id()
1 parent 82b52e1 commit 962e451

File tree

10 files changed

+19
-19
lines changed

10 files changed

+19
-19
lines changed

src/librustdoc/clean/auto_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
691691

692692
fn is_fn_trait(&self, path: &Path) -> bool {
693693
let tcx = self.cx.tcx;
694-
let did = path.res.def_id();
694+
let did = path.def_id();
695695
did == tcx.require_lang_item(LangItem::Fn, None)
696696
|| did == tcx.require_lang_item(LangItem::FnMut, None)
697697
|| did == tcx.require_lang_item(LangItem::FnOnce, None)

src/librustdoc/clean/inline.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ crate fn build_impl(
454454
// Return if the trait itself or any types of the generic parameters are doc(hidden).
455455
let mut stack: Vec<&Type> = vec![&for_];
456456

457-
if let Some(did) = trait_.as_ref().map(|t| t.res.def_id()) {
457+
if let Some(did) = trait_.as_ref().map(|t| t.def_id()) {
458458
if tcx.get_attrs(did).lists(sym::doc).has_word(sym::hidden) {
459459
return;
460460
}
@@ -474,7 +474,7 @@ crate fn build_impl(
474474
}
475475
}
476476

477-
if let Some(did) = trait_.as_ref().map(|t| t.res.def_id()) {
477+
if let Some(did) = trait_.as_ref().map(|t| t.def_id()) {
478478
record_extern_trait(cx, did);
479479
}
480480

@@ -628,7 +628,7 @@ fn filter_non_trait_generics(trait_did: DefId, mut g: clean::Generics) -> clean:
628628
} if *s == kw::SelfUpper => {
629629
bounds.retain(|bound| match bound {
630630
clean::GenericBound::TraitBound(clean::PolyTrait { trait_, .. }, _) => {
631-
trait_.res.def_id() != trait_did
631+
trait_.def_id() != trait_did
632632
}
633633
_ => true,
634634
});
@@ -642,7 +642,7 @@ fn filter_non_trait_generics(trait_did: DefId, mut g: clean::Generics) -> clean:
642642
ty: clean::QPath { self_type: box clean::Generic(ref s), trait_, name: _, .. },
643643
bounds,
644644
..
645-
} => !(bounds.is_empty() || *s == kw::SelfUpper && trait_.res.def_id() == trait_did),
645+
} => !(bounds.is_empty() || *s == kw::SelfUpper && trait_.def_id() == trait_did),
646646
_ => true,
647647
});
648648
g

src/librustdoc/clean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ impl Clean<Item> for ty::AssocItem {
11001100
if *name != my_name {
11011101
return None;
11021102
}
1103-
if trait_.res.def_id() != self.container.id() {
1103+
if trait_.def_id() != self.container.id() {
11041104
return None;
11051105
}
11061106
match **self_type {

src/librustdoc/clean/simplify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ crate fn merge_bounds(
102102
// If this QPath's trait `trait_did` is the same as, or a supertrait
103103
// of, the bound's trait `did` then we can keep going, otherwise
104104
// this is just a plain old equality bound.
105-
if !trait_is_same_or_supertrait(cx, trait_ref.trait_.res.def_id(), trait_did) {
105+
if !trait_is_same_or_supertrait(cx, trait_ref.trait_.def_id(), trait_did) {
106106
return false;
107107
}
108108
let last = trait_ref.trait_.segments.last_mut().expect("segments were empty");

src/librustdoc/clean/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1499,13 +1499,13 @@ impl Type {
14991499
QPath { self_type, trait_, name, .. } => (self_type, trait_, name),
15001500
_ => return None,
15011501
};
1502-
Some((&self_, trait_.res.def_id(), *name))
1502+
Some((&self_, trait_.def_id(), *name))
15031503
}
15041504

15051505
fn inner_def_id(&self, cache: Option<&Cache>) -> Option<DefId> {
15061506
let t: PrimitiveType = match *self {
15071507
ResolvedPath { did, .. } => return Some(did),
1508-
DynTrait(ref bounds, _) => return Some(bounds[0].trait_.res.def_id()),
1508+
DynTrait(ref bounds, _) => return Some(bounds[0].trait_.def_id()),
15091509
Primitive(p) => return cache.and_then(|c| c.primitive_locations.get(&p).cloned()),
15101510
BorrowedRef { type_: box Generic(..), .. } => PrimitiveType::Reference,
15111511
BorrowedRef { ref type_, .. } => return type_.inner_def_id(cache),

src/librustdoc/html/format.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ fn fmt_type<'cx>(
914914
clean::QPath { ref name, ref self_type, ref trait_, ref self_def_id } => {
915915
let should_show_cast = !trait_.segments.is_empty()
916916
&& self_def_id
917-
.zip(Some(trait_.res.def_id()))
917+
.zip(Some(trait_.def_id()))
918918
.map_or(!self_type.is_self_type(), |(id, trait_)| id != trait_);
919919
if f.alternate() {
920920
if should_show_cast {
@@ -939,7 +939,7 @@ fn fmt_type<'cx>(
939939
// the ugliness comes from inlining across crates where
940940
// everything comes in as a fully resolved QPath (hard to
941941
// look at).
942-
match href(trait_.res.def_id(), cx) {
942+
match href(trait_.def_id(), cx) {
943943
Ok((ref url, _, ref path)) if !f.alternate() => {
944944
write!(
945945
f,
@@ -972,7 +972,7 @@ impl clean::Path {
972972
&'a self,
973973
cx: &'a Context<'tcx>,
974974
) -> impl fmt::Display + 'b + Captures<'tcx> {
975-
display_fn(move |f| resolved_path(f, self.res.def_id(), self, false, false, cx))
975+
display_fn(move |f| resolved_path(f, self.def_id(), self, false, false, cx))
976976
}
977977
}
978978

src/librustdoc/html/render/cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ crate fn get_real_types<'tcx>(
322322
if let Some(bound) = generics.params.iter().find(|g| g.is_type() && g.name == arg_s) {
323323
for bound in bound.get_bounds().unwrap_or(&[]) {
324324
if let Some(path) = bound.get_trait_path() {
325-
let ty = Type::ResolvedPath { did: path.res.def_id(), path };
325+
let ty = Type::ResolvedPath { did: path.def_id(), path };
326326
let adds = get_real_types(generics, &ty, tcx, recurse + 1, res);
327327
nb_added += adds;
328328
if adds == 0 && !ty.is_full_generic() {

src/librustdoc/html/render/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2389,7 +2389,7 @@ fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec<String> {
23892389
}
23902390
clean::Type::QPath { self_type, trait_, .. } => {
23912391
work.push_back(*self_type);
2392-
process_path(trait_.res.def_id());
2392+
process_path(trait_.def_id());
23932393
}
23942394
_ => {}
23952395
}

src/librustdoc/json/conversions.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ impl FromWithTcx<clean::GenericBound> for GenericBound {
365365
TraitBound(clean::PolyTrait { trait_, generic_params }, modifier) => {
366366
// FIXME: should `trait_` be a clean::Path equivalent in JSON?
367367
let trait_ =
368-
clean::ResolvedPath { did: trait_.res.def_id(), path: trait_ }.into_tcx(tcx);
368+
clean::ResolvedPath { did: trait_.def_id(), path: trait_ }.into_tcx(tcx);
369369
GenericBound::TraitBound {
370370
trait_,
371371
generic_params: generic_params.into_iter().map(|x| x.into_tcx(tcx)).collect(),
@@ -401,7 +401,7 @@ impl FromWithTcx<clean::Type> for Type {
401401

402402
Type::ResolvedPath {
403403
name: first_trait.whole_name(),
404-
id: from_item_id(first_trait.res.def_id().into()),
404+
id: from_item_id(first_trait.def_id().into()),
405405
args: first_trait
406406
.segments
407407
.last()
@@ -436,7 +436,7 @@ impl FromWithTcx<clean::Type> for Type {
436436
},
437437
QPath { name, self_type, trait_, .. } => {
438438
// FIXME: should `trait_` be a clean::Path equivalent in JSON?
439-
let trait_ = ResolvedPath { did: trait_.res.def_id(), path: trait_ }.into_tcx(tcx);
439+
let trait_ = ResolvedPath { did: trait_.def_id(), path: trait_ }.into_tcx(tcx);
440440
Type::QualifiedPath {
441441
name: name.to_string(),
442442
self_type: Box::new((*self_type).into_tcx(tcx)),
@@ -513,7 +513,7 @@ impl FromWithTcx<clean::Impl> for Impl {
513513
} = impl_;
514514
// FIXME: should `trait_` be a clean::Path equivalent in JSON?
515515
let trait_ = trait_.map(|path| {
516-
let did = path.res.def_id();
516+
let did = path.def_id();
517517
clean::ResolvedPath { path, did }.into_tcx(tcx)
518518
});
519519
Impl {

src/librustdoc/passes/collect_trait_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ crate fn collect_trait_impls(krate: Crate, cx: &mut DocContext<'_>) -> Crate {
8282
cleaner.keep_impl(for_)
8383
|| trait_
8484
.as_ref()
85-
.map_or(false, |t| cleaner.keep_impl_with_def_id(t.res.def_id().into()))
85+
.map_or(false, |t| cleaner.keep_impl_with_def_id(t.def_id().into()))
8686
|| blanket_impl.is_some()
8787
} else {
8888
true

0 commit comments

Comments
 (0)