Skip to content

Commit e0c75ff

Browse files
committed
rustc: rename item_path to def_path (except the module in ty).
1 parent f1af5a7 commit e0c75ff

File tree

54 files changed

+174
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+174
-174
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefId {
724724
}
725725

726726
fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String {
727-
tcx.item_path_str(*self)
727+
tcx.def_path_str(*self)
728728
}
729729
}
730730

@@ -736,7 +736,7 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefIndex {
736736
}
737737

738738
fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String {
739-
tcx.item_path_str(DefId::local(*self))
739+
tcx.def_path_str(DefId::local(*self))
740740
}
741741
}
742742

src/librustc/hir/def_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl DefId {
249249
if self.is_local() && self.index == CRATE_DEF_INDEX {
250250
format!("top-level module")
251251
} else {
252-
format!("module `{}`", tcx.item_path_str(*self))
252+
format!("module `{}`", tcx.def_path_str(*self))
253253
}
254254
}
255255
}

src/librustc/infer/error_reporting/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
448448
// Only external crates, if either is from a local
449449
// module we could have false positives
450450
if !(did1.is_local() || did2.is_local()) && did1.krate != did2.krate {
451-
let exp_path = self.tcx.item_path_str(did1);
452-
let found_path = self.tcx.item_path_str(did2);
453-
let exp_abs_path = self.tcx.absolute_item_path_str(did1);
454-
let found_abs_path = self.tcx.absolute_item_path_str(did2);
451+
let exp_path = self.tcx.def_path_str(did1);
452+
let found_path = self.tcx.def_path_str(did2);
453+
let exp_abs_path = self.tcx.absolute_def_path_str(did1);
454+
let found_abs_path = self.tcx.absolute_def_path_str(did2);
455455
// We compare strings because DefPath can be different
456456
// for imported and non-imported crates
457457
if exp_path == found_path || exp_abs_path == found_abs_path {
@@ -658,7 +658,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
658658
return Some(());
659659
}
660660
if let &ty::Adt(def, _) = &ta.sty {
661-
let path_ = self.tcx.item_path_str(def.did.clone());
661+
let path_ = self.tcx.def_path_str(def.did.clone());
662662
if path_ == other_path {
663663
self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty);
664664
return Some(());
@@ -757,8 +757,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
757757
let sub_no_defaults_1 = self.strip_generic_default_params(def1.did, sub1);
758758
let sub_no_defaults_2 = self.strip_generic_default_params(def2.did, sub2);
759759
let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new());
760-
let path1 = self.tcx.item_path_str(def1.did.clone());
761-
let path2 = self.tcx.item_path_str(def2.did.clone());
760+
let path1 = self.tcx.def_path_str(def1.did.clone());
761+
let path2 = self.tcx.def_path_str(def2.did.clone());
762762
if def1.did == def2.did {
763763
// Easy case. Replace same types with `_` to shorten the output and highlight
764764
// the differing ones.
@@ -1013,7 +1013,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
10131013
if exp_is_struct && &exp_found.expected == ret_ty.skip_binder() {
10141014
let message = format!(
10151015
"did you mean `{}(/* fields */)`?",
1016-
self.tcx.item_path_str(def_id)
1016+
self.tcx.def_path_str(def_id)
10171017
);
10181018
diag.span_label(span, message);
10191019
}

src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,15 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
193193
cause.span(&self.tcx()),
194194
&format!(
195195
"implementation of `{}` is not general enough",
196-
self.tcx().item_path_str(trait_def_id),
196+
self.tcx().def_path_str(trait_def_id),
197197
),
198198
);
199199

200200
match cause.code {
201201
ObligationCauseCode::ItemObligation(def_id) => {
202202
err.note(&format!(
203203
"Due to a where-clause on `{}`,",
204-
self.tcx().item_path_str(def_id),
204+
self.tcx().def_path_str(def_id),
205205
));
206206
}
207207
_ => (),

src/librustc/middle/stability.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
593593
.map_or(false, |parent_depr| parent_depr.same_origin(&depr_entry));
594594

595595
if !skip {
596-
let path = self.item_path_str(def_id);
596+
let path = self.def_path_str(def_id);
597597
let message = format!("use of deprecated item '{}'", path);
598598
lint_deprecated(def_id,
599599
id,
@@ -620,7 +620,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
620620
if let Some(id) = id {
621621
if let Some(stability) = stability {
622622
if let Some(depr) = &stability.rustc_depr {
623-
let path = self.item_path_str(def_id);
623+
let path = self.def_path_str(def_id);
624624
if deprecation_in_effect(&depr.since.as_str()) {
625625
let message = format!("use of deprecated item '{}'", path);
626626
lint_deprecated(def_id,

src/librustc/mir/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ impl<'tcx> Debug for Place<'tcx> {
20622062
Base(PlaceBase::Static(box self::Static { def_id, ty })) => write!(
20632063
fmt,
20642064
"({}: {:?})",
2065-
ty::tls::with(|tcx| tcx.item_path_str(def_id)),
2065+
ty::tls::with(|tcx| tcx.def_path_str(def_id)),
20662066
ty
20672067
),
20682068
Base(PlaceBase::Promoted(ref promoted)) => write!(
@@ -2731,7 +2731,7 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: ty::Const<'_>) -> fmt::Resul
27312731
}
27322732
// print function definitions
27332733
if let FnDef(did, _) = ty.sty {
2734-
return write!(f, "{}", item_path_str(did));
2734+
return write!(f, "{}", def_path_str(did));
27352735
}
27362736
// print string literals
27372737
if let ConstValue::Slice(ptr, len) = value {
@@ -2756,8 +2756,8 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: ty::Const<'_>) -> fmt::Resul
27562756
write!(f, "{:?}:{}", value, ty)
27572757
}
27582758

2759-
fn item_path_str(def_id: DefId) -> String {
2760-
ty::tls::with(|tcx| tcx.item_path_str(def_id))
2759+
fn def_path_str(def_id: DefId) -> String {
2760+
ty::tls::with(|tcx| tcx.def_path_str(def_id))
27612761
}
27622762

27632763
impl<'tcx> graph::DirectedGraph for Mir<'tcx> {

src/librustc/traits/error_reporting.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,11 +1285,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
12851285
let span = self.sess.source_map().def_span(span);
12861286
let mut err = struct_span_err!(self.sess, span, E0072,
12871287
"recursive type `{}` has infinite size",
1288-
self.item_path_str(type_def_id));
1288+
self.def_path_str(type_def_id));
12891289
err.span_label(span, "recursive type has infinite size");
12901290
err.help(&format!("insert indirection (e.g., a `Box`, `Rc`, or `&`) \
12911291
at some point to make `{}` representable",
1292-
self.item_path_str(type_def_id)));
1292+
self.def_path_str(type_def_id)));
12931293
err
12941294
}
12951295

@@ -1299,7 +1299,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
12991299
violations: Vec<ObjectSafetyViolation>)
13001300
-> DiagnosticBuilder<'tcx>
13011301
{
1302-
let trait_str = self.item_path_str(trait_def_id);
1302+
let trait_str = self.def_path_str(trait_def_id);
13031303
let span = self.sess.source_map().def_span(span);
13041304
let mut err = struct_span_err!(
13051305
self.sess, span, E0038,
@@ -1524,7 +1524,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
15241524
region, object_ty));
15251525
}
15261526
ObligationCauseCode::ItemObligation(item_def_id) => {
1527-
let item_name = tcx.item_path_str(item_def_id);
1527+
let item_name = tcx.def_path_str(item_def_id);
15281528
let msg = format!("required by `{}`", item_name);
15291529

15301530
if let Some(sp) = tcx.hir().span_if_local(item_def_id) {

src/librustc/traits/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>(
650650
) -> bool {
651651
debug!("type_known_to_meet_bound_modulo_regions(ty={:?}, bound={:?})",
652652
ty,
653-
infcx.tcx.item_path_str(def_id));
653+
infcx.tcx.def_path_str(def_id));
654654

655655
let trait_ref = ty::TraitRef {
656656
def_id,
@@ -665,7 +665,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>(
665665

666666
let result = infcx.predicate_must_hold_modulo_regions(&obligation);
667667
debug!("type_known_to_meet_ty={:?} bound={} => {:?}",
668-
ty, infcx.tcx.item_path_str(def_id), result);
668+
ty, infcx.tcx.def_path_str(def_id), result);
669669

670670
if result && (ty.has_infer_types() || ty.has_closure_types()) {
671671
// Because of inference "guessing", selection can sometimes claim
@@ -692,13 +692,13 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>(
692692
Ok(()) => {
693693
debug!("type_known_to_meet_bound_modulo_regions: ty={:?} bound={} success",
694694
ty,
695-
infcx.tcx.item_path_str(def_id));
695+
infcx.tcx.def_path_str(def_id));
696696
true
697697
}
698698
Err(e) => {
699699
debug!("type_known_to_meet_bound_modulo_regions: ty={:?} bound={} errors={:?}",
700700
ty,
701-
infcx.tcx.item_path_str(def_id),
701+
infcx.tcx.def_path_str(def_id),
702702
e);
703703
false
704704
}

src/librustc/traits/object_safety.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
133133
hir::CRATE_HIR_ID,
134134
*span,
135135
&format!("the trait `{}` cannot be made into an object",
136-
self.item_path_str(trait_def_id)),
136+
self.def_path_str(trait_def_id)),
137137
&violation.error_msg());
138138
false
139139
} else {

src/librustc/traits/on_unimplemented.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedFormatString {
276276
-> String
277277
{
278278
let name = tcx.item_name(trait_ref.def_id);
279-
let trait_str = tcx.item_path_str(trait_ref.def_id);
279+
let trait_str = tcx.def_path_str(trait_ref.def_id);
280280
let generics = tcx.generics_of(trait_ref.def_id);
281281
let generic_map = generics.params.iter().filter_map(|param| {
282282
let value = match param.kind {

0 commit comments

Comments
 (0)