Skip to content

Commit bce552a

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

File tree

54 files changed

+175
-175
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

+175
-175
lines changed

src/librustc/dep_graph/dep_node.rs

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

723723
fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String {
724-
tcx.item_path_str(*self)
724+
tcx.def_path_str(*self)
725725
}
726726
}
727727

@@ -733,7 +733,7 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefIndex {
733733
}
734734

735735
fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String {
736-
tcx.item_path_str(DefId::local(*self))
736+
tcx.def_path_str(DefId::local(*self))
737737
}
738738
}
739739

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
@@ -449,10 +449,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
449449
// Only external crates, if either is from a local
450450
// module we could have false positives
451451
if !(did1.is_local() || did2.is_local()) && did1.krate != did2.krate {
452-
let exp_path = self.tcx.item_path_str(did1);
453-
let found_path = self.tcx.item_path_str(did2);
454-
let exp_abs_path = self.tcx.absolute_item_path_str(did1);
455-
let found_abs_path = self.tcx.absolute_item_path_str(did2);
452+
let exp_path = self.tcx.def_path_str(did1);
453+
let found_path = self.tcx.def_path_str(did2);
454+
let exp_abs_path = self.tcx.absolute_def_path_str(did1);
455+
let found_abs_path = self.tcx.absolute_def_path_str(did2);
456456
// We compare strings because DefPath can be different
457457
// for imported and non-imported crates
458458
if exp_path == found_path || exp_abs_path == found_abs_path {
@@ -650,7 +650,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
650650
return Some(());
651651
}
652652
if let &ty::Adt(def, _) = &ta.sty {
653-
let path_ = self.tcx.item_path_str(def.did.clone());
653+
let path_ = self.tcx.def_path_str(def.did.clone());
654654
if path_ == other_path {
655655
self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty);
656656
return Some(());
@@ -755,8 +755,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
755755
let sub_no_defaults_1 = self.strip_generic_default_params(def1.did, sub1);
756756
let sub_no_defaults_2 = self.strip_generic_default_params(def2.did, sub2);
757757
let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new());
758-
let path1 = self.tcx.item_path_str(def1.did.clone());
759-
let path2 = self.tcx.item_path_str(def2.did.clone());
758+
let path1 = self.tcx.def_path_str(def1.did.clone());
759+
let path2 = self.tcx.def_path_str(def2.did.clone());
760760
if def1.did == def2.did {
761761
// Easy case. Replace same types with `_` to shorten the output and highlight
762762
// the differing ones.
@@ -1011,7 +1011,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
10111011
if exp_is_struct && &exp_found.expected == ret_ty.skip_binder() {
10121012
let message = format!(
10131013
"did you mean `{}(/* fields */)`?",
1014-
self.tcx.item_path_str(def_id)
1014+
self.tcx.def_path_str(def_id)
10151015
);
10161016
diag.span_label(span, message);
10171017
}

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
@@ -186,15 +186,15 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
186186
cause.span(&self.tcx),
187187
&format!(
188188
"implementation of `{}` is not general enough",
189-
self.tcx.item_path_str(trait_def_id),
189+
self.tcx.def_path_str(trait_def_id),
190190
),
191191
);
192192

193193
match cause.code {
194194
ObligationCauseCode::ItemObligation(def_id) => {
195195
err.note(&format!(
196196
"Due to a where-clause on `{}`,",
197-
self.tcx.item_path_str(def_id),
197+
self.tcx.def_path_str(def_id),
198198
));
199199
}
200200
_ => (),

src/librustc/middle/stability.rs

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

606606
if let Some(since) = deprecated_in_future_version {
607-
let path = self.item_path_str(def_id);
607+
let path = self.def_path_str(def_id);
608608
let message = format!("use of item '{}' \
609609
that will be deprecated in future version {}",
610610
path,
@@ -616,7 +616,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
616616
&message,
617617
lint::builtin::DEPRECATED_IN_FUTURE);
618618
} else if !skip {
619-
let path = self.item_path_str(def_id);
619+
let path = self.def_path_str(def_id);
620620
let message = format!("use of deprecated item '{}'", path);
621621
lint_deprecated(def_id,
622622
id,
@@ -642,7 +642,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
642642
if let Some(&Stability{rustc_depr: Some(attr::RustcDeprecation { reason, since }), ..})
643643
= stability {
644644
if let Some(id) = id {
645-
let path = self.item_path_str(def_id);
645+
let path = self.def_path_str(def_id);
646646
if deprecation_in_effect(&since.as_str()) {
647647
let message = format!("use of deprecated item '{}'", path);
648648
lint_deprecated(def_id,

src/librustc/mir/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,7 @@ impl<'tcx> Debug for Place<'tcx> {
20432043
Static(box self::Static { def_id, ty }) => write!(
20442044
fmt,
20452045
"({}: {:?})",
2046-
ty::tls::with(|tcx| tcx.item_path_str(def_id)),
2046+
ty::tls::with(|tcx| tcx.def_path_str(def_id)),
20472047
ty
20482048
),
20492049
Promoted(ref promoted) => write!(fmt, "({:?}: {:?})", promoted.0, promoted.1),
@@ -2701,7 +2701,7 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: ty::Const<'_>) -> fmt::Resul
27012701
}
27022702
// print function definitions
27032703
if let FnDef(did, _) = ty.sty {
2704-
return write!(f, "{}", item_path_str(did));
2704+
return write!(f, "{}", def_path_str(did));
27052705
}
27062706
// print string literals
27072707
if let ConstValue::Slice(ptr, len) = value {
@@ -2726,8 +2726,8 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: ty::Const<'_>) -> fmt::Resul
27262726
write!(f, "{:?}:{}", value, ty)
27272727
}
27282728

2729-
fn item_path_str(def_id: DefId) -> String {
2730-
ty::tls::with(|tcx| tcx.item_path_str(def_id))
2729+
fn def_path_str(def_id: DefId) -> String {
2730+
ty::tls::with(|tcx| tcx.def_path_str(def_id))
27312731
}
27322732

27332733
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
@@ -1239,11 +1239,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
12391239
let span = self.sess.source_map().def_span(span);
12401240
let mut err = struct_span_err!(self.sess, span, E0072,
12411241
"recursive type `{}` has infinite size",
1242-
self.item_path_str(type_def_id));
1242+
self.def_path_str(type_def_id));
12431243
err.span_label(span, "recursive type has infinite size");
12441244
err.help(&format!("insert indirection (e.g., a `Box`, `Rc`, or `&`) \
12451245
at some point to make `{}` representable",
1246-
self.item_path_str(type_def_id)));
1246+
self.def_path_str(type_def_id)));
12471247
err
12481248
}
12491249

@@ -1253,7 +1253,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
12531253
violations: Vec<ObjectSafetyViolation>)
12541254
-> DiagnosticBuilder<'tcx>
12551255
{
1256-
let trait_str = self.item_path_str(trait_def_id);
1256+
let trait_str = self.def_path_str(trait_def_id);
12571257
let span = self.sess.source_map().def_span(span);
12581258
let mut err = struct_span_err!(
12591259
self.sess, span, E0038,
@@ -1478,7 +1478,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
14781478
region, object_ty));
14791479
}
14801480
ObligationCauseCode::ItemObligation(item_def_id) => {
1481-
let item_name = tcx.item_path_str(item_def_id);
1481+
let item_name = tcx.def_path_str(item_def_id);
14821482
let msg = format!("required by `{}`", item_name);
14831483

14841484
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
@@ -647,7 +647,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>(
647647
) -> bool {
648648
debug!("type_known_to_meet_bound_modulo_regions(ty={:?}, bound={:?})",
649649
ty,
650-
infcx.tcx.item_path_str(def_id));
650+
infcx.tcx.def_path_str(def_id));
651651

652652
let trait_ref = ty::TraitRef {
653653
def_id,
@@ -662,7 +662,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>(
662662

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

667667
if result && (ty.has_infer_types() || ty.has_closure_types()) {
668668
// Because of inference "guessing", selection can sometimes claim
@@ -689,13 +689,13 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>(
689689
Ok(()) => {
690690
debug!("type_known_to_meet_bound_modulo_regions: ty={:?} bound={} success",
691691
ty,
692-
infcx.tcx.item_path_str(def_id));
692+
infcx.tcx.def_path_str(def_id));
693693
true
694694
}
695695
Err(e) => {
696696
debug!("type_known_to_meet_bound_modulo_regions: ty={:?} bound={} errors={:?}",
697697
ty,
698-
infcx.tcx.item_path_str(def_id),
698+
infcx.tcx.def_path_str(def_id),
699699
e);
700700
false
701701
}

src/librustc/traits/object_safety.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
132132
ast::CRATE_NODE_ID,
133133
*span,
134134
&format!("the trait `{}` cannot be made into an object",
135-
self.item_path_str(trait_def_id)),
135+
self.def_path_str(trait_def_id)),
136136
&violation.error_msg());
137137
false
138138
} 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)