about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2019-02-03 12:59:37 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2019-03-15 13:25:10 +0200
commita54a41ce47c149fd6587182a4ab87a146844f939 (patch)
treef48533eece21012c999f971adfef58f4b056a48f /src
parent8619edede1496a8d9c4131f9cb2079e71dccd5fb (diff)
downloadrust-a54a41ce47c149fd6587182a4ab87a146844f939.tar.gz
rust-a54a41ce47c149fd6587182a4ab87a146844f939.zip
rustc: provide DisambiguatedDefPathData in ty::print.
Diffstat (limited to 'src')
-rw-r--r--src/librustc/hir/map/definitions.rs6
-rw-r--r--src/librustc/infer/error_reporting/mod.rs6
-rw-r--r--src/librustc/ty/print/mod.rs12
-rw-r--r--src/librustc/ty/print/pretty.rs88
-rw-r--r--src/librustc_codegen_utils/symbol_names.rs26
-rw-r--r--src/librustdoc/clean/mod.rs6
-rw-r--r--src/test/mir-opt/retag.rs2
-rw-r--r--src/test/ui/consts/const-size_of-cycle.stderr8
-rw-r--r--src/test/ui/deprecation/deprecation-lint.rs2
-rw-r--r--src/test/ui/deprecation/deprecation-lint.stderr2
-rw-r--r--src/test/ui/impl-trait/auto-trait-leak.stderr12
-rw-r--r--src/test/ui/issues/issue-17252.stderr2
-rw-r--r--src/test/ui/issues/issue-23302-1.stderr6
-rw-r--r--src/test/ui/issues/issue-23302-2.stderr6
-rw-r--r--src/test/ui/issues/issue-36163.stderr6
-rw-r--r--src/test/ui/issues/issue-44415.stderr8
16 files changed, 127 insertions, 71 deletions
diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs
index f454d691d41..dca4ce4aef8 100644
--- a/src/librustc/hir/map/definitions.rs
+++ b/src/librustc/hir/map/definitions.rs
@@ -679,13 +679,13 @@ impl DefPathData {
                 return name
             }
             // note that this does not show up in user printouts
-            CrateRoot => "{{root}}",
+            CrateRoot => "{{crate}}",
             Impl => "{{impl}}",
-            Misc => "{{?}}",
+            Misc => "{{misc}}",
             ClosureExpr => "{{closure}}",
             StructCtor => "{{constructor}}",
             AnonConst => "{{constant}}",
-            ImplTrait => "{{impl-Trait}}",
+            ImplTrait => "{{opaque}}",
         };
 
         Symbol::intern(s).as_interned_str()
diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs
index 5026074f5e8..2810b5a8e6a 100644
--- a/src/librustc/infer/error_reporting/mod.rs
+++ b/src/librustc/infer/error_reporting/mod.rs
@@ -445,6 +445,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
         sp: Span,
     ) {
         use hir::def_id::CrateNum;
+        use hir::map::DisambiguatedDefPathData;
         use ty::print::Printer;
         use ty::subst::Kind;
 
@@ -504,6 +505,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
             fn path_append_impl(
                 self,
                 _print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
+                _disambiguated_data: &DisambiguatedDefPathData,
                 _self_ty: Ty<'tcx>,
                 _trait_ref: Option<ty::TraitRef<'tcx>>,
             ) -> Result<Self::Path, Self::Error> {
@@ -512,10 +514,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
             fn path_append(
                 self,
                 print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
-                text: &str,
+                disambiguated_data: &DisambiguatedDefPathData,
             ) -> Result<Self::Path, Self::Error> {
                 let mut path = print_prefix(self)?;
-                path.push(text.to_string());
+                path.push(disambiguated_data.data.as_interned_str().to_string());
                 Ok(path)
             }
             fn path_generic_args(
diff --git a/src/librustc/ty/print/mod.rs b/src/librustc/ty/print/mod.rs
index c3f4a26a57e..99b83deab8b 100644
--- a/src/librustc/ty/print/mod.rs
+++ b/src/librustc/ty/print/mod.rs
@@ -1,4 +1,4 @@
-use crate::hir::map::DefPathData;
+use crate::hir::map::{DefPathData, DisambiguatedDefPathData};
 use crate::hir::def_id::{CrateNum, DefId};
 use crate::ty::{self, DefIdTree, Ty, TyCtxt};
 use crate::ty::subst::{Kind, Subst};
@@ -71,13 +71,14 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized {
     fn path_append_impl(
         self,
         print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
+        disambiguated_data: &DisambiguatedDefPathData,
         self_ty: Ty<'tcx>,
         trait_ref: Option<ty::TraitRef<'tcx>>,
     ) -> Result<Self::Path, Self::Error>;
     fn path_append(
         self,
         print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
-        text: &str,
+        disambiguated_data: &DisambiguatedDefPathData,
     ) -> Result<Self::Path, Self::Error>;
     fn path_generic_args(
         self,
@@ -156,7 +157,7 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized {
                     } else {
                         cx.print_def_path(parent_def_id, parent_substs)
                     },
-                    &key.disambiguated_data.data.as_interned_str().as_str(),
+                    &key.disambiguated_data,
                 )
             }
         }
@@ -200,12 +201,14 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized {
         debug!("default_print_impl_path: impl_def_id={:?}, self_ty={}, impl_trait_ref={:?}",
                impl_def_id, self_ty, impl_trait_ref);
 
+        let key = self.tcx().def_key(impl_def_id);
+        let parent_def_id = DefId { index: key.parent.unwrap(), ..impl_def_id };
+
         // Decide whether to print the parent path for the impl.
         // Logically, since impls are global, it's never needed, but
         // users may find it useful. Currently, we omit the parent if
         // the impl is either in the same module as the self-type or
         // as the trait.
-        let parent_def_id = self.tcx().parent(impl_def_id).unwrap();
         let in_self_mod = match characteristic_def_id_of_type(self_ty) {
             None => false,
             Some(ty_def_id) => self.tcx().parent(ty_def_id) == Some(parent_def_id),
@@ -221,6 +224,7 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized {
             // the module more clearly.
             self.path_append_impl(
                 |cx| cx.print_def_path(parent_def_id, &[]),
+                &key.disambiguated_data,
                 self_ty,
                 impl_trait_ref,
             )
diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs
index 54ca63b457a..258903e1f10 100644
--- a/src/librustc/ty/print/pretty.rs
+++ b/src/librustc/ty/print/pretty.rs
@@ -1,6 +1,6 @@
 use crate::hir;
 use crate::hir::def::Namespace;
-use crate::hir::map::DefPathData;
+use crate::hir::map::{DefPathData, DisambiguatedDefPathData};
 use crate::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
 use crate::middle::cstore::{ExternCrate, ExternCrateSource};
 use crate::middle::region;
@@ -313,13 +313,13 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>:
             visible_parent, actual_parent,
         );
 
-        let data = cur_def_key.disambiguated_data.data;
+        let mut data = cur_def_key.disambiguated_data.data;
         debug!(
             "try_print_visible_def_path: data={:?} visible_parent={:?} actual_parent={:?}",
             data, visible_parent, actual_parent,
         );
 
-        let symbol = match data {
+        match data {
             // In order to output a path that could actually be imported (valid and visible),
             // we need to handle re-exports correctly.
             //
@@ -351,27 +351,30 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>:
             // the children of the visible parent (as was done when computing
             // `visible_parent_map`), looking for the specific child we currently have and then
             // have access to the re-exported name.
-            DefPathData::Module(actual_name) |
-            DefPathData::TypeNs(actual_name) if Some(visible_parent) != actual_parent => {
-                self.tcx().item_children(visible_parent)
+            DefPathData::Module(ref mut name) |
+            DefPathData::TypeNs(ref mut name) if Some(visible_parent) != actual_parent => {
+                let reexport = self.tcx().item_children(visible_parent)
                     .iter()
                     .find(|child| child.def.def_id() == def_id)
-                    .map(|child| child.ident.as_str())
-                    .unwrap_or_else(|| actual_name.as_str())
+                    .map(|child| child.ident.as_interned_str());
+                if let Some(reexport) = reexport {
+                    *name = reexport;
+                }
             }
-            _ => {
-                data.get_opt_name().map(|n| n.as_str()).unwrap_or_else(|| {
-                    // Re-exported `extern crate` (#43189).
-                    if let DefPathData::CrateRoot = data {
-                        self.tcx().original_crate_name(def_id.krate).as_str()
-                    } else {
-                        Symbol::intern("<unnamed>").as_str()
-                    }
-                })
-            },
-        };
-        debug!("try_print_visible_def_path: symbol={:?}", symbol);
-        Ok((self.path_append(Ok, &symbol)?, true))
+            // Re-exported `extern crate` (#43189).
+            DefPathData::CrateRoot => {
+                data = DefPathData::Module(
+                    self.tcx().original_crate_name(def_id.krate).as_interned_str(),
+                );
+            }
+            _ => {}
+        }
+        debug!("try_print_visible_def_path: data={:?}", data);
+
+        Ok((self.path_append(Ok, &DisambiguatedDefPathData {
+            data,
+            disambiguator: 0,
+        })?, true))
     }
 
     fn pretty_path_qualified(
@@ -932,10 +935,18 @@ impl<F: fmt::Write> Printer<'gcx, 'tcx> for FmtPrinter<'_, 'gcx, 'tcx, F> {
                 // only occur very early in the compiler pipeline.
                 let parent_def_id = DefId { index: key.parent.unwrap(), ..def_id };
                 let span = self.tcx.def_span(def_id);
-                return self.path_append(
-                    |cx| cx.print_def_path(parent_def_id, &[]),
-                    &format!("<impl at {:?}>", span),
-                );
+
+                self = self.print_def_path(parent_def_id, &[])?;
+
+                // HACK(eddyb) copy of `path_append` to avoid
+                // constructing a `DisambiguatedDefPathData`.
+                if !self.empty_path {
+                    write!(self, "::")?;
+                }
+                write!(self, "<impl at {:?}>", span)?;
+                self.empty_path = false;
+
+                return Ok(self);
             }
         }
 
@@ -995,6 +1006,7 @@ impl<F: fmt::Write> Printer<'gcx, 'tcx> for FmtPrinter<'_, 'gcx, 'tcx, F> {
     fn path_append_impl(
         mut self,
         print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
+        _disambiguated_data: &DisambiguatedDefPathData,
         self_ty: Ty<'tcx>,
         trait_ref: Option<ty::TraitRef<'tcx>>,
     ) -> Result<Self::Path, Self::Error> {
@@ -1012,17 +1024,35 @@ impl<F: fmt::Write> Printer<'gcx, 'tcx> for FmtPrinter<'_, 'gcx, 'tcx, F> {
     fn path_append(
         mut self,
         print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
-        text: &str,
+        disambiguated_data: &DisambiguatedDefPathData,
     ) -> Result<Self::Path, Self::Error> {
         self = print_prefix(self)?;
 
-        // FIXME(eddyb) `text` should never be empty, but it
+        // Skip `::{{constructor}}` on tuple/unit structs.
+        match disambiguated_data.data {
+            DefPathData::StructCtor => return Ok(self),
+            _ => {}
+        }
+
+        // FIXME(eddyb) `name` should never be empty, but it
         // currently is for `extern { ... }` "foreign modules".
-        if !text.is_empty() {
+        let name = disambiguated_data.data.as_interned_str().as_str();
+        if !name.is_empty() {
             if !self.empty_path {
                 write!(self, "::")?;
             }
-            write!(self, "{}", text)?;
+            write!(self, "{}", name)?;
+
+            // FIXME(eddyb) this will print e.g. `{{closure}}#3`, but it
+            // might be nicer to use something else, e.g. `{closure#3}`.
+            let dis = disambiguated_data.disambiguator;
+            let print_dis =
+                disambiguated_data.data.get_opt_name().is_none() ||
+                dis != 0 && self.tcx.sess.verbose();
+            if print_dis {
+                write!(self, "#{}", dis)?;
+            }
+
             self.empty_path = false;
         }
 
diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs
index 262ba8a1c74..0fa935199f9 100644
--- a/src/librustc_codegen_utils/symbol_names.rs
+++ b/src/librustc_codegen_utils/symbol_names.rs
@@ -90,7 +90,7 @@
 use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
 use rustc::hir::Node;
 use rustc::hir::CodegenFnAttrFlags;
-use rustc::hir::map::definitions::DefPathData;
+use rustc::hir::map::{DefPathData, DisambiguatedDefPathData};
 use rustc::ich::NodeIdHashingMode;
 use rustc::ty::print::{PrettyPrinter, Printer, Print};
 use rustc::ty::query::Providers;
@@ -492,11 +492,23 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'_, 'tcx> {
     fn path_append_impl(
         self,
         print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
+        _disambiguated_data: &DisambiguatedDefPathData,
         self_ty: Ty<'tcx>,
         trait_ref: Option<ty::TraitRef<'tcx>>,
     ) -> Result<Self::Path, Self::Error> {
         self.pretty_path_append_impl(
-            |cx| cx.path_append(print_prefix, ""),
+            |mut cx| {
+                cx = print_prefix(cx)?;
+
+                if cx.keep_within_component {
+                    // HACK(eddyb) print the path similarly to how `FmtPrinter` prints it.
+                    cx.write_str("::")?;
+                } else {
+                    cx.path.finalize_pending_component();
+                }
+
+                Ok(cx)
+            },
             self_ty,
             trait_ref,
         )
@@ -504,10 +516,16 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'_, 'tcx> {
     fn path_append(
         mut self,
         print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
-        text: &str,
+        disambiguated_data: &DisambiguatedDefPathData,
     ) -> Result<Self::Path, Self::Error> {
         self = print_prefix(self)?;
 
+        // Skip `::{{constructor}}` on tuple/unit structs.
+        match disambiguated_data.data {
+            DefPathData::StructCtor => return Ok(self),
+            _ => {}
+        }
+
         if self.keep_within_component {
             // HACK(eddyb) print the path similarly to how `FmtPrinter` prints it.
             self.write_str("::")?;
@@ -515,7 +533,7 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'_, 'tcx> {
             self.path.finalize_pending_component();
         }
 
-        self.write_str(text)?;
+        self.write_str(&disambiguated_data.data.as_interned_str().as_str())?;
         Ok(self)
     }
     fn path_generic_args(
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index da73eb0cda5..c80fd8fcd81 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -20,6 +20,7 @@ use rustc::mir::interpret::GlobalId;
 use rustc::hir::{self, GenericArg, HirVec};
 use rustc::hir::def::{self, Def, CtorKind};
 use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
+use rustc::hir::map::DisambiguatedDefPathData;
 use rustc::ty::subst::{Kind, InternalSubsts, SubstsRef};
 use rustc::ty::{self, DefIdTree, TyCtxt, Region, RegionVid, Ty, AdtKind};
 use rustc::ty::fold::TypeFolder;
@@ -4288,6 +4289,7 @@ pub fn get_path_for_type(
         fn path_append_impl(
             self,
             print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
+            _disambiguated_data: &DisambiguatedDefPathData,
             self_ty: Ty<'tcx>,
             trait_ref: Option<ty::TraitRef<'tcx>>,
         ) -> Result<Self::Path, Self::Error> {
@@ -4306,10 +4308,10 @@ pub fn get_path_for_type(
         fn path_append(
             self,
             print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
-            text: &str,
+            disambiguated_data: &DisambiguatedDefPathData,
         ) -> Result<Self::Path, Self::Error> {
             let mut path = print_prefix(self)?;
-            path.push(text.to_string());
+            path.push(disambiguated_data.data.as_interned_str().to_string());
             Ok(path)
         }
         fn path_generic_args(
diff --git a/src/test/mir-opt/retag.rs b/src/test/mir-opt/retag.rs
index cdf63556737..3b333b5431c 100644
--- a/src/test/mir-opt/retag.rs
+++ b/src/test/mir-opt/retag.rs
@@ -98,7 +98,7 @@ fn main() {
 // }
 // END rustc.main.EraseRegions.after.mir
 // START rustc.main-{{closure}}.EraseRegions.after.mir
-// fn main::{{closure}}(_1: &[closure@HirId { owner: DefIndex(0:7), local_id: 70 }], _2: &i32) -> &i32 {
+// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(0:7), local_id: 70 }], _2: &i32) -> &i32 {
 //     ...
 //     bb0: {
 //         Retag([fn entry] _1);
diff --git a/src/test/ui/consts/const-size_of-cycle.stderr b/src/test/ui/consts/const-size_of-cycle.stderr
index 8f8eb38e938..3762f5e3d6a 100644
--- a/src/test/ui/consts/const-size_of-cycle.stderr
+++ b/src/test/ui/consts/const-size_of-cycle.stderr
@@ -1,22 +1,22 @@
-error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}`
+error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}#0`
   --> $DIR/const-size_of-cycle.rs:6:17
    |
 LL |     bytes: [u8; std::mem::size_of::<Foo>()]
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
+note: ...which requires const-evaluating `Foo::bytes::{{constant}}#0`...
   --> $SRC_DIR/libcore/mem.rs:LL:COL
    |
 LL |     intrinsics::size_of::<T>()
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires computing layout of `Foo`...
    = note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All, def_id: None }, value: [u8; _] }`...
-note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`...
+note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}#0`...
   --> $DIR/const-size_of-cycle.rs:6:17
    |
 LL |     bytes: [u8; std::mem::size_of::<Foo>()]
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle
+   = note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}#0`, completing the cycle
 note: cycle used when processing `Foo`
   --> $DIR/const-size_of-cycle.rs:5:1
    |
diff --git a/src/test/ui/deprecation/deprecation-lint.rs b/src/test/ui/deprecation/deprecation-lint.rs
index 033d6eebbb2..26271395005 100644
--- a/src/test/ui/deprecation/deprecation-lint.rs
+++ b/src/test/ui/deprecation/deprecation-lint.rs
@@ -314,7 +314,7 @@ mod this_crate {
         let _ = || {
             #[deprecated]
             fn bar() { }
-            bar(); //~ ERROR use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}::bar'
+            bar(); //~ ERROR use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}#0::bar'
         };
     }
 
diff --git a/src/test/ui/deprecation/deprecation-lint.stderr b/src/test/ui/deprecation/deprecation-lint.stderr
index 50cbe3846bb..ffbcb259754 100644
--- a/src/test/ui/deprecation/deprecation-lint.stderr
+++ b/src/test/ui/deprecation/deprecation-lint.stderr
@@ -298,7 +298,7 @@ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
 LL |         <Foo as Trait>::trait_deprecated_text(&foo);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}::bar'
+error: use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}#0::bar'
   --> $DIR/deprecation-lint.rs:317:13
    |
 LL |             bar();
diff --git a/src/test/ui/impl-trait/auto-trait-leak.stderr b/src/test/ui/impl-trait/auto-trait-leak.stderr
index b936fed85f4..4e79dfc3f7c 100644
--- a/src/test/ui/impl-trait/auto-trait-leak.stderr
+++ b/src/test/ui/impl-trait/auto-trait-leak.stderr
@@ -1,4 +1,4 @@
-error[E0391]: cycle detected when processing `cycle1::{{impl-Trait}}`
+error[E0391]: cycle detected when processing `cycle1::{{opaque}}#0`
   --> $DIR/auto-trait-leak.rs:14:16
    |
 LL | fn cycle1() -> impl Clone {
@@ -10,7 +10,7 @@ note: ...which requires processing `cycle1`...
 LL | fn cycle1() -> impl Clone {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
-note: ...which requires processing `cycle2::{{impl-Trait}}`...
+note: ...which requires processing `cycle2::{{opaque}}#0`...
   --> $DIR/auto-trait-leak.rs:23:16
    |
 LL | fn cycle2() -> impl Clone {
@@ -21,7 +21,7 @@ note: ...which requires processing `cycle2`...
 LL | fn cycle2() -> impl Clone {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
-   = note: ...which again requires processing `cycle1::{{impl-Trait}}`, completing the cycle
+   = note: ...which again requires processing `cycle1::{{opaque}}#0`, completing the cycle
 note: cycle used when checking item types in top-level module
   --> $DIR/auto-trait-leak.rs:3:1
    |
@@ -34,7 +34,7 @@ LL | |     Rc::new(String::from("foo"))
 LL | | }
    | |_^
 
-error[E0391]: cycle detected when processing `cycle1::{{impl-Trait}}`
+error[E0391]: cycle detected when processing `cycle1::{{opaque}}#0`
   --> $DIR/auto-trait-leak.rs:14:16
    |
 LL | fn cycle1() -> impl Clone {
@@ -46,7 +46,7 @@ note: ...which requires processing `cycle1`...
 LL | fn cycle1() -> impl Clone {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
-note: ...which requires processing `cycle2::{{impl-Trait}}`...
+note: ...which requires processing `cycle2::{{opaque}}#0`...
   --> $DIR/auto-trait-leak.rs:23:16
    |
 LL | fn cycle2() -> impl Clone {
@@ -56,7 +56,7 @@ note: ...which requires processing `cycle2`...
    |
 LL | fn cycle2() -> impl Clone {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: ...which again requires processing `cycle1::{{impl-Trait}}`, completing the cycle
+   = note: ...which again requires processing `cycle1::{{opaque}}#0`, completing the cycle
 note: cycle used when checking item types in top-level module
   --> $DIR/auto-trait-leak.rs:3:1
    |
diff --git a/src/test/ui/issues/issue-17252.stderr b/src/test/ui/issues/issue-17252.stderr
index c993588f553..da3e2e763af 100644
--- a/src/test/ui/issues/issue-17252.stderr
+++ b/src/test/ui/issues/issue-17252.stderr
@@ -5,7 +5,7 @@ LL | const FOO: usize = FOO;
    |                    ^^^
    |
    = note: ...which again requires processing `FOO`, completing the cycle
-note: cycle used when processing `main::{{constant}}`
+note: cycle used when processing `main::{{constant}}#0`
   --> $DIR/issue-17252.rs:4:18
    |
 LL |     let _x: [u8; FOO]; // caused stack overflow prior to fix
diff --git a/src/test/ui/issues/issue-23302-1.stderr b/src/test/ui/issues/issue-23302-1.stderr
index 5fa82f8b786..43effc0b3b9 100644
--- a/src/test/ui/issues/issue-23302-1.stderr
+++ b/src/test/ui/issues/issue-23302-1.stderr
@@ -1,11 +1,11 @@
-error[E0391]: cycle detected when processing `X::A::{{constant}}`
+error[E0391]: cycle detected when processing `X::A::{{constant}}#0`
   --> $DIR/issue-23302-1.rs:4:9
    |
 LL |     A = X::A as isize,
    |         ^^^^^^^^^^^^^
    |
-   = note: ...which again requires processing `X::A::{{constant}}`, completing the cycle
-note: cycle used when const-evaluating `X::A::{{constant}}`
+   = note: ...which again requires processing `X::A::{{constant}}#0`, completing the cycle
+note: cycle used when const-evaluating `X::A::{{constant}}#0`
   --> $DIR/issue-23302-1.rs:4:9
    |
 LL |     A = X::A as isize,
diff --git a/src/test/ui/issues/issue-23302-2.stderr b/src/test/ui/issues/issue-23302-2.stderr
index 5b77baed73c..707d4fa7ed3 100644
--- a/src/test/ui/issues/issue-23302-2.stderr
+++ b/src/test/ui/issues/issue-23302-2.stderr
@@ -1,11 +1,11 @@
-error[E0391]: cycle detected when processing `Y::A::{{constant}}`
+error[E0391]: cycle detected when processing `Y::A::{{constant}}#0`
   --> $DIR/issue-23302-2.rs:4:9
    |
 LL |     A = Y::B as isize,
    |         ^^^^^^^^^^^^^
    |
-   = note: ...which again requires processing `Y::A::{{constant}}`, completing the cycle
-note: cycle used when const-evaluating `Y::A::{{constant}}`
+   = note: ...which again requires processing `Y::A::{{constant}}#0`, completing the cycle
+note: cycle used when const-evaluating `Y::A::{{constant}}#0`
   --> $DIR/issue-23302-2.rs:4:9
    |
 LL |     A = Y::B as isize,
diff --git a/src/test/ui/issues/issue-36163.stderr b/src/test/ui/issues/issue-36163.stderr
index 94de4c76927..4c3f726180d 100644
--- a/src/test/ui/issues/issue-36163.stderr
+++ b/src/test/ui/issues/issue-36163.stderr
@@ -1,4 +1,4 @@
-error[E0391]: cycle detected when processing `Foo::B::{{constant}}`
+error[E0391]: cycle detected when processing `Foo::B::{{constant}}#0`
   --> $DIR/issue-36163.rs:4:9
    |
 LL |     B = A,
@@ -9,8 +9,8 @@ note: ...which requires processing `A`...
    |
 LL | const A: isize = Foo::B as isize;
    |                  ^^^^^^^^^^^^^^^
-   = note: ...which again requires processing `Foo::B::{{constant}}`, completing the cycle
-note: cycle used when const-evaluating `Foo::B::{{constant}}`
+   = note: ...which again requires processing `Foo::B::{{constant}}#0`, completing the cycle
+note: cycle used when const-evaluating `Foo::B::{{constant}}#0`
   --> $DIR/issue-36163.rs:4:9
    |
 LL |     B = A,
diff --git a/src/test/ui/issues/issue-44415.stderr b/src/test/ui/issues/issue-44415.stderr
index 3f377fd27e7..df8e804c87a 100644
--- a/src/test/ui/issues/issue-44415.stderr
+++ b/src/test/ui/issues/issue-44415.stderr
@@ -1,22 +1,22 @@
-error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}`
+error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}#0`
   --> $DIR/issue-44415.rs:6:17
    |
 LL |     bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
    |                 ^^^^^^
    |
-note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
+note: ...which requires const-evaluating `Foo::bytes::{{constant}}#0`...
   --> $DIR/issue-44415.rs:6:26
    |
 LL |     bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires computing layout of `Foo`...
    = note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All, def_id: None }, value: [u8; _] }`...
-note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`...
+note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}#0`...
   --> $DIR/issue-44415.rs:6:17
    |
 LL |     bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
    |                 ^^^^^^
-   = note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle
+   = note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}#0`, completing the cycle
 note: cycle used when processing `Foo`
   --> $DIR/issue-44415.rs:5:1
    |