]> git.lizzy.rs Git - rust.git/commitdiff
rustc: pass Option<&Substs> and Namespace around in ty::item_path.
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Wed, 19 Dec 2018 03:01:06 +0000 (05:01 +0200)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Fri, 15 Mar 2019 11:25:10 +0000 (13:25 +0200)
26 files changed:
src/librustc/ty/item_path.rs
src/librustc/util/ppaux.rs
src/librustc_codegen_utils/symbol_names.rs
src/librustdoc/clean/mod.rs
src/test/pretty/issue-4264.pp
src/test/ui/bad/bad-sized.stderr
src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr
src/test/ui/hygiene/impl_items.rs
src/test/ui/hygiene/impl_items.stderr
src/test/ui/issues/issue-17651.stderr
src/test/ui/issues/issue-22638.rs
src/test/ui/issues/issue-22638.stderr
src/test/ui/issues/issue-24322.stderr
src/test/ui/issues/issue-29124.rs
src/test/ui/issues/issue-29124.stderr
src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr
src/test/ui/issues/issue-39559-2.stderr
src/test/ui/privacy/associated-item-privacy-inherent.rs
src/test/ui/privacy/associated-item-privacy-inherent.stderr
src/test/ui/privacy/private-inferred-type-3.rs
src/test/ui/privacy/private-inferred-type-3.stderr
src/test/ui/privacy/private-inferred-type.rs
src/test/ui/privacy/private-inferred-type.stderr
src/test/ui/qualified/qualified-path-params.stderr
src/test/ui/symbol-names/impl1.rs
src/test/ui/symbol-names/impl1.stderr

index 87859ac00c396f09992274205b8563a2aa47d2c2..d9a8deb80e46ac1a798937926e5121c571b3c547 100644 (file)
@@ -1,8 +1,10 @@
+use crate::hir::def::Namespace;
 use crate::hir::map::DefPathData;
 use crate::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
 use crate::ty::{self, DefIdTree, Ty, TyCtxt};
+use crate::ty::print::PrintCx;
+use crate::ty::subst::{Subst, Substs};
 use crate::middle::cstore::{ExternCrate, ExternCrateSource};
-use ty::print::PrintCx;
 use syntax::ast;
 use syntax::symbol::{keywords, Symbol};
 
@@ -54,18 +56,48 @@ pub fn with_crate_prefix<F: FnOnce() -> R, R>(f: F) -> R {
 }
 
 impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
+    // HACK(eddyb) get rid of `item_path_str` and/or pass `Namespace` explicitly always
+    // (but also some things just print a `DefId` generally so maybe we need this?)
+    fn guess_def_namespace(self, def_id: DefId) -> Namespace {
+        match self.def_key(def_id).disambiguated_data.data {
+            DefPathData::ValueNs(..) |
+            DefPathData::EnumVariant(..) |
+            DefPathData::Field(..) |
+            DefPathData::AnonConst |
+            DefPathData::ClosureExpr |
+            DefPathData::StructCtor => Namespace::ValueNS,
+
+            DefPathData::MacroDef(..) => Namespace::MacroNS,
+
+            _ => Namespace::TypeNS,
+        }
+    }
+
     /// Returns a string identifying this `DefId`. This string is
     /// suitable for user output. It is relative to the current crate
     /// root, unless with_forced_absolute_paths was used.
-    pub fn item_path_str(self, def_id: DefId) -> String {
-        debug!("item_path_str: def_id={:?}", def_id);
+    pub fn item_path_str_with_substs_and_ns(
+        self,
+        def_id: DefId,
+        substs: Option<&Substs<'tcx>>,
+        ns: Namespace,
+    ) -> String {
+        debug!("item_path_str: def_id={:?}, substs={:?}, ns={:?}", def_id, substs, ns);
         if FORCE_ABSOLUTE.with(|force| force.get()) {
-            PrintCx::new(self, AbsolutePathPrinter).print_item_path(def_id)
+            PrintCx::new(self, AbsolutePathPrinter).print_item_path(def_id, substs, ns)
         } else {
-            PrintCx::new(self, LocalPathPrinter).print_item_path(def_id)
+            PrintCx::new(self, LocalPathPrinter).print_item_path(def_id, substs, ns)
         }
     }
 
+    /// Returns a string identifying this def-id. This string is
+    /// suitable for user output. It is relative to the current crate
+    /// root, unless with_forced_absolute_paths was used.
+    pub fn item_path_str(self, def_id: DefId) -> String {
+        let ns = self.guess_def_namespace(def_id);
+        self.item_path_str_with_substs_and_ns(def_id, None, ns)
+    }
+
     /// Returns a string identifying this local node-id.
     pub fn node_path_str(self, id: ast::NodeId) -> String {
         self.item_path_str(self.hir().local_def_id(id))
@@ -75,13 +107,19 @@ pub fn node_path_str(self, id: ast::NodeId) -> String {
     /// suitable for user output. It always begins with a crate identifier.
     pub fn absolute_item_path_str(self, def_id: DefId) -> String {
         debug!("absolute_item_path_str: def_id={:?}", def_id);
-        PrintCx::new(self, AbsolutePathPrinter).print_item_path(def_id)
+        let ns = self.guess_def_namespace(def_id);
+        PrintCx::new(self, AbsolutePathPrinter).print_item_path(def_id, None, ns)
     }
 }
 
 impl<P: ItemPathPrinter> PrintCx<'a, 'gcx, 'tcx, P> {
-    pub fn default_print_item_path(&mut self, def_id: DefId) -> P::Path {
-        debug!("default_print_item_path: def_id={:?}", def_id);
+    pub fn default_print_item_path(
+        &mut self,
+        def_id: DefId,
+        substs: Option<&Substs<'tcx>>,
+        ns: Namespace,
+    ) -> P::Path {
+        debug!("default_print_item_path: def_id={:?}, substs={:?}, ns={:?}", def_id, substs, ns);
         let key = self.tcx.def_key(def_id);
         debug!("default_print_item_path: key={:?}", key);
         match key.disambiguated_data.data {
@@ -91,7 +129,7 @@ pub fn default_print_item_path(&mut self, def_id: DefId) -> P::Path {
             }
 
             DefPathData::Impl => {
-                self.print_impl_path(def_id)
+                self.print_impl_path(def_id, substs, ns)
             }
 
             // Unclear if there is any value in distinguishing these.
@@ -117,18 +155,23 @@ pub fn default_print_item_path(&mut self, def_id: DefId) -> P::Path {
             data @ DefPathData::ImplTrait |
             data @ DefPathData::GlobalMetaData(..) => {
                 let parent_did = self.tcx.parent_def_id(def_id).unwrap();
-                let path = self.print_item_path(parent_did);
+                let path = self.print_item_path(parent_did, None, ns);
                 self.path_append(path, &data.as_interned_str().as_symbol().as_str())
             },
 
             DefPathData::StructCtor => { // present `X` instead of `X::{{constructor}}`
                 let parent_def_id = self.tcx.parent_def_id(def_id).unwrap();
-                self.print_item_path(parent_def_id)
+                self.print_item_path(parent_def_id, substs, ns)
             }
         }
     }
 
-    fn default_print_impl_path(&mut self, impl_def_id: DefId) -> P::Path {
+    fn default_print_impl_path(
+        &mut self,
+        impl_def_id: DefId,
+        substs: Option<&Substs<'tcx>>,
+        ns: Namespace,
+    ) -> P::Path {
         debug!("default_print_impl_path: impl_def_id={:?}", impl_def_id);
         let parent_def_id = self.tcx.parent_def_id(impl_def_id).unwrap();
 
@@ -137,13 +180,19 @@ fn default_print_impl_path(&mut self, impl_def_id: DefId) -> P::Path {
         // 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 self_ty = self.tcx.type_of(impl_def_id);
+        let mut self_ty = self.tcx.type_of(impl_def_id);
+        if let Some(substs) = substs {
+            self_ty = self_ty.subst(self.tcx, substs);
+        }
         let in_self_mod = match characteristic_def_id_of_type(self_ty) {
             None => false,
             Some(ty_def_id) => self.tcx.parent_def_id(ty_def_id) == Some(parent_def_id),
         };
 
-        let impl_trait_ref = self.tcx.impl_trait_ref(impl_def_id);
+        let mut impl_trait_ref = self.tcx.impl_trait_ref(impl_def_id);
+        if let Some(substs) = substs {
+            impl_trait_ref = impl_trait_ref.subst(self.tcx, substs);
+        }
         let in_trait_mod = match impl_trait_ref {
             None => false,
             Some(trait_ref) => self.tcx.parent_def_id(trait_ref.def_id) == Some(parent_def_id),
@@ -153,7 +202,7 @@ fn default_print_impl_path(&mut self, impl_def_id: DefId) -> P::Path {
             // If the impl is not co-located with either self-type or
             // trait-type, then fallback to a format that identifies
             // the module more clearly.
-            let path = self.print_item_path(parent_def_id);
+            let path = self.print_item_path(parent_def_id, None, ns);
             if let Some(trait_ref) = impl_trait_ref {
                 return self.path_append(path, &format!("<impl {} for {}>", trait_ref, self_ty));
             } else {
@@ -174,15 +223,14 @@ fn default_print_impl_path(&mut self, impl_def_id: DefId) -> P::Path {
         // anything other than a simple path.
         match self_ty.sty {
             ty::Adt(adt_def, substs) => {
-                // FIXME(eddyb) always print without <> here.
-                if substs.types().next().is_none() { // ignore regions
-                    self.print_item_path(adt_def.did)
-                } else {
-                    self.path_impl(&format!("<{}>", self_ty))
-                }
+                // FIXME(eddyb) this should recurse to build the path piecewise.
+                // self.print_item_path(adt_def.did, Some(substs), ns)
+                let mut s = String::new();
+                crate::util::ppaux::parameterized(&mut s, adt_def.did, substs, ns).unwrap();
+                self.path_impl(&s)
             }
 
-            ty::Foreign(did) => self.print_item_path(did),
+            ty::Foreign(did) => self.print_item_path(did, None, ns),
 
             ty::Bool |
             ty::Char |
@@ -263,11 +311,21 @@ pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option<DefId> {
 pub trait ItemPathPrinter: Sized {
     type Path;
 
-    fn print_item_path(self: &mut PrintCx<'_, '_, '_, Self>, def_id: DefId) -> Self::Path {
-        self.default_print_item_path(def_id)
+    fn print_item_path(
+        self: &mut PrintCx<'_, '_, 'tcx, Self>,
+        def_id: DefId,
+        substs: Option<&Substs<'tcx>>,
+        ns: Namespace,
+    ) -> Self::Path {
+        self.default_print_item_path(def_id, substs, ns)
     }
-    fn print_impl_path(self: &mut PrintCx<'_, '_, '_, Self>, impl_def_id: DefId) -> Self::Path {
-        self.default_print_impl_path(impl_def_id)
+    fn print_impl_path(
+        self: &mut PrintCx<'_, '_, 'tcx, Self>,
+        impl_def_id: DefId,
+        substs: Option<&Substs<'tcx>>,
+        ns: Namespace,
+    ) -> Self::Path {
+        self.default_print_impl_path(impl_def_id, substs, ns)
     }
 
     fn path_crate(self: &mut PrintCx<'_, '_, '_, Self>, cnum: CrateNum) -> Self::Path;
@@ -312,6 +370,7 @@ impl LocalPathPrinter {
     fn try_print_visible_item_path(
         self: &mut PrintCx<'_, '_, '_, Self>,
         def_id: DefId,
+        ns: Namespace,
     ) -> Option<<Self as ItemPathPrinter>::Path> {
         debug!("try_print_visible_item_path: def_id={:?}", def_id);
 
@@ -343,7 +402,7 @@ fn try_print_visible_item_path(
                 }) => {
                     debug!("try_print_visible_item_path: def_id={:?}", def_id);
                     let path = if !span.is_dummy() {
-                        self.print_item_path(def_id)
+                        self.print_item_path(def_id, None, ns)
                     } else {
                         self.path_crate(cnum)
                     };
@@ -376,7 +435,7 @@ fn try_print_visible_item_path(
         }
 
         let visible_parent = visible_parent_map.get(&def_id).cloned()?;
-        let path = self.try_print_visible_item_path(visible_parent)?;
+        let path = self.try_print_visible_item_path(visible_parent, ns)?;
         let actual_parent = self.tcx.parent(def_id);
 
         let data = cur_def_key.disambiguated_data.data;
@@ -444,11 +503,21 @@ fn try_print_visible_item_path(
 impl ItemPathPrinter for LocalPathPrinter {
     type Path = String;
 
-    fn print_item_path(self: &mut PrintCx<'_, '_, '_, Self>, def_id: DefId) -> Self::Path {
-        self.try_print_visible_item_path(def_id)
-            .unwrap_or_else(|| self.default_print_item_path(def_id))
+    fn print_item_path(
+        self: &mut PrintCx<'_, '_, 'tcx, Self>,
+        def_id: DefId,
+        substs: Option<&Substs<'tcx>>,
+        ns: Namespace,
+    ) -> Self::Path {
+        self.try_print_visible_item_path(def_id, ns)
+            .unwrap_or_else(|| self.default_print_item_path(def_id, substs, ns))
     }
-    fn print_impl_path(self: &mut PrintCx<'_, '_, '_, Self>, impl_def_id: DefId) -> Self::Path {
+    fn print_impl_path(
+        self: &mut PrintCx<'_, '_, 'tcx, Self>,
+        impl_def_id: DefId,
+        substs: Option<&Substs<'tcx>>,
+        ns: Namespace,
+    ) -> Self::Path {
         // Always use types for non-local impls, where types are always
         // available, and filename/line-number is mostly uninteresting.
         let use_types = !impl_def_id.is_local() || {
@@ -463,12 +532,12 @@ fn print_impl_path(self: &mut PrintCx<'_, '_, '_, Self>, impl_def_id: DefId) ->
             // only occur very early in the compiler pipeline.
             // FIXME(eddyb) this should just be using `tcx.def_span(impl_def_id)`
             let parent_def_id = self.tcx.parent_def_id(impl_def_id).unwrap();
-            let path = self.print_item_path(parent_def_id);
+            let path = self.print_item_path(parent_def_id, None, ns);
             let span = self.tcx.def_span(impl_def_id);
             return self.path_append(path, &format!("<impl at {:?}>", span));
         }
 
-        self.default_print_impl_path(impl_def_id)
+        self.default_print_impl_path(impl_def_id, substs, ns)
     }
 
     fn path_crate(self: &mut PrintCx<'_, '_, '_, Self>, cnum: CrateNum) -> Self::Path {
index 94560606cad2ad147b368d35a5868a445e9b9987..092255129f4eeb39e1af90044324fcdef0ac8070 100644 (file)
@@ -317,23 +317,15 @@ fn parameterized(
                 }
             }
         } else {
-            // Try to print `impl`s more like how you'd refer to their associated items.
+            // FIXME(eddyb) recurse through printing a path via `self`, instead
+            // instead of using the `tcx` method that produces a `String`.
+            print!(self, write("{}",
+                self.tcx.item_path_str_with_substs_and_ns(def_id, Some(substs), ns)))?;
+
+            // For impls, the above call already prints relevant generics args.
             if let DefPathData::Impl = key.disambiguated_data.data {
-                if let Some(trait_ref) = self.tcx.impl_trait_ref(def_id) {
-                    // HACK(eddyb) this is in lieu of more specific disambiguation.
-                    print!(self, write("{}", self.tcx.item_path_str(def_id)))?;
-
-                    let trait_ref = trait_ref.subst(self.tcx, substs);
-                    print!(self, print_debug(trait_ref))?;
-                } else {
-                    let self_ty = self.tcx.type_of(def_id).subst(self.tcx, substs);
-                    // FIXME(eddyb) omit the <> where possible.
-                    print!(self, write("<"), print(self_ty), write(">"))?;
-                }
                 return Ok(());
             }
-
-            print!(self, write("{}", self.tcx.item_path_str(def_id)))?;
         }
 
         let mut empty = true;
index 6bd9b159775e3bfb27b5b231a215e63148067c09..a7771f3da18eedda2311b523f197373b39f644b4 100644 (file)
@@ -87,6 +87,7 @@
 //! virtually impossible. Thus, symbol hash generation exclusively relies on
 //! DefPaths which are much more robust in the face of changes to the code base.
 
+use rustc::hir::def::Namespace;
 use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
 use rustc::hir::Node;
 use rustc::hir::CodegenFnAttrFlags;
@@ -225,7 +226,9 @@ fn get_symbol_hash<'a, 'tcx>(
 
 fn def_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::SymbolName {
     item_path::with_forced_absolute_paths(|| {
-        PrintCx::new(tcx, SymbolPathPrinter).print_item_path(def_id).into_interned()
+        PrintCx::new(tcx, SymbolPathPrinter)
+            .print_item_path(def_id, None, Namespace::ValueNS)
+            .into_interned()
     })
 }
 
index d321697f713f88156897eb7bbd95e41a935dc9d7..6714866369efa2e4a81e161b83abd4bbde900bbc 100644 (file)
@@ -18,7 +18,7 @@
 use rustc::middle::stability;
 use rustc::mir::interpret::GlobalId;
 use rustc::hir::{self, GenericArg, HirVec};
-use rustc::hir::def::{self, Def, CtorKind};
+use rustc::hir::def::{self, Def, CtorKind, Namespace};
 use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
 use rustc::ty::subst::{InternalSubsts, SubstsRef};
 use rustc::ty::{self, TyCtxt, Region, RegionVid, Ty, AdtKind};
@@ -4249,7 +4249,8 @@ fn path_append(
         }
     }
 
-    let names = PrintCx::new(tcx, AbsolutePathPrinter).print_item_path(def_id);
+    let names = PrintCx::new(tcx, AbsolutePathPrinter)
+        .print_item_path(def_id, None, Namespace::TypeNS);
 
     hir::Path {
         span: DUMMY_SP,
index b529beba783672b923006659beb704ff1fa4911a..ad663412e77768505d34156a85313ed0afd900e4 100644 (file)
@@ -32,27 +32,27 @@ pub fn bar() ({
                   (($crate::fmt::format as
                        for<'r> fn(std::fmt::Arguments<'r>) -> std::string::String {std::fmt::format})(((<$crate::fmt::Arguments>::new_v1
                                                                                                            as
-                                                                                                           fn(&[&str], &[std::fmt::ArgumentV1<'_>]) -> std::fmt::Arguments<'_> {std::fmt::Arguments<'_>::new_v1})((&([("test"
+                                                                                                           fn(&[&str], &[std::fmt::ArgumentV1<'_>]) -> std::fmt::Arguments<'_> {std::fmt::Arguments::<'_>::new_v1})((&([("test"
+                                                                                                                                                                                                                            as
+                                                                                                                                                                                                                            &'static str)]
                                                                                                                                                                                                                           as
-                                                                                                                                                                                                                          &'static str)]
+                                                                                                                                                                                                                          [&str; 1])
                                                                                                                                                                                                                         as
-                                                                                                                                                                                                                        [&str; 1])
-                                                                                                                                                                                                                      as
-                                                                                                                                                                                                                      &[&str; 1]),
-                                                                                                                                                                                                                  (&(match (()
+                                                                                                                                                                                                                        &[&str; 1]),
+                                                                                                                                                                                                                    (&(match (()
+                                                                                                                                                                                                                                 as
+                                                                                                                                                                                                                                 ())
+                                                                                                                                                                                                                           {
+                                                                                                                                                                                                                           ()
+                                                                                                                                                                                                                           =>
+                                                                                                                                                                                                                           ([]
                                                                                                                                                                                                                                as
-                                                                                                                                                                                                                               ())
-                                                                                                                                                                                                                         {
-                                                                                                                                                                                                                         ()
-                                                                                                                                                                                                                         =>
-                                                                                                                                                                                                                         ([]
-                                                                                                                                                                                                                             as
-                                                                                                                                                                                                                             [std::fmt::ArgumentV1<'_>; 0]),
-                                                                                                                                                                                                                     }
+                                                                                                                                                                                                                               [std::fmt::ArgumentV1<'_>; 0]),
+                                                                                                                                                                                                                       }
+                                                                                                                                                                                                                          as
+                                                                                                                                                                                                                          [std::fmt::ArgumentV1<'_>; 0])
                                                                                                                                                                                                                         as
-                                                                                                                                                                                                                        [std::fmt::ArgumentV1<'_>; 0])
-                                                                                                                                                                                                                      as
-                                                                                                                                                                                                                      &[std::fmt::ArgumentV1<'_>; 0]))
+                                                                                                                                                                                                                        &[std::fmt::ArgumentV1<'_>; 0]))
                                                                                                           as
                                                                                                           std::fmt::Arguments<'_>))
                       as std::string::String);
index 9565888dcc022a0a11a046b73474dffbcf6c0561..51b84745552938e6df88bd7138204c1a930f9100 100644 (file)
@@ -22,7 +22,7 @@ LL |     let x: Vec<Trait + Sized> = Vec::new();
    |
    = help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
-   = note: required by `<std::vec::Vec<T>>::new`
+   = note: required by `std::vec::Vec::<T>::new`
 
 error: aborting due to 3 previous errors
 
index 1fe3d33322fd1c52557e4405d48b9749cf805bad..7ede44c65b83a0479aaf7a7c786a24eb6b5056bb 100644 (file)
@@ -4,7 +4,7 @@ error[E0493]: destructors cannot be evaluated at compile-time
 LL |     const F: u32 = (U::X, 42).1;
    |                    ^^^^^^^^^^ constants cannot evaluate destructors
 
-error: `<std::vec::Vec<T>>::new` is not yet stable as a const fn
+error: `std::vec::Vec::<T>::new` is not yet stable as a const fn
   --> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:18:25
    |
 LL |     const X: Vec<u32> = Vec::new();
index d628573d51707386f0291e5b36363ff2f3a888fe..37794c6e0773c0773af66d9c5b211b6ddf2d065b 100644 (file)
@@ -9,7 +9,7 @@ fn f(&self) {}
     }
 
     pub macro m() {
-        let _: () = S.f(); //~ ERROR type `for<'r> fn(&'r foo::S) {<foo::S>::f}` is private
+        let _: () = S.f(); //~ ERROR type `for<'r> fn(&'r foo::S) {foo::S::f}` is private
     }
 }
 
index 0a273bc98ff619dba33b33388cac8fa5341948b2..418c2c73ba157e36521d53aea367883cfe2301fe 100644 (file)
@@ -1,4 +1,4 @@
-error: type `for<'r> fn(&'r foo::S) {<foo::S>::f}` is private
+error: type `for<'r> fn(&'r foo::S) {foo::S::f}` is private
   --> $DIR/impl_items.rs:12:23
    |
 LL |         let _: () = S.f();
index 72c40ff4b3a0c3f6c5ea6598a9d94afb4c4a56f7..ce9af1524b0879e18c663cb82d68ef8f9b0d21a2 100644 (file)
@@ -6,7 +6,7 @@ LL |     (|| Box::new(*(&[0][..])))();
    |
    = help: the trait `std::marker::Sized` is not implemented for `[{integer}]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
-   = note: required by `<std::boxed::Box<T>>::new`
+   = note: required by `std::boxed::Box::<T>::new`
 
 error: aborting due to previous error
 
index ff58c7aaced03186b1bf5809147ed72fe30a3098..fab24404eba7d43b79965706921f66eab17a59c6 100644 (file)
@@ -50,7 +50,7 @@ pub fn matches<F: Fn()>(&self, f: &F) {
 
 impl D {
     pub fn matches<F: Fn()>(&self, f: &F) {
-        //~^ ERROR reached the type-length limit while instantiating `<D>::matches::<[closure
+        //~^ ERROR reached the type-length limit while instantiating `D::matches::<[closure
         let &D(ref a) = self;
         a.matches(f)
     }
index 65483abe5c7f9a31efcd4bfc20de4ac33b5c0b5d..aff968f3618c1edb8da02f3fdcbf0214d4d66e4c 100644 (file)
@@ -1,4 +1,4 @@
-error: reached the type-length limit while instantiating `<D>::matches::$CLOSURE`
+error: reached the type-length limit while instantiating `D::matches::$CLOSURE`
   --> $DIR/issue-22638.rs:52:5
    |
 LL | /     pub fn matches<F: Fn()>(&self, f: &F) {
index b284c8cf1172c9c4d6ebe452642cc39641070684..def373cf2c0a896b4d3c6a7daaea9d1f43991576 100644 (file)
@@ -5,7 +5,7 @@ LL |     let x: &fn(&B) -> u32 = &B::func;
    |                             ^^^^^^^^ expected fn pointer, found fn item
    |
    = note: expected type `&for<'r> fn(&'r B) -> u32`
-              found type `&for<'r> fn(&'r B) -> u32 {<B>::func}`
+              found type `&for<'r> fn(&'r B) -> u32 {B::func}`
 
 error: aborting due to previous error
 
index 8062045a6c058cbb87018a24b82db4f1a133d6cd..1cd3f84f7a2270ec54df1c7817df02dbfa64707d 100644 (file)
@@ -13,7 +13,7 @@ fn func() -> Ret {
 
 fn main() {
     Obj::func.x();
-    //~^ ERROR no method named `x` found for type `fn() -> Ret {<Obj>::func}` in the current scope
+    //~^ ERROR no method named `x` found for type `fn() -> Ret {Obj::func}` in the current scope
     func.x();
     //~^ ERROR no method named `x` found for type `fn() -> Ret {func}` in the current scope
 }
index 67f188e0588e2e81b459d765c4bc92cb3ffeeccd..3beb728978884e36f08a84cc81d9fa327502edb5 100644 (file)
@@ -1,4 +1,4 @@
-error[E0599]: no method named `x` found for type `fn() -> Ret {<Obj>::func}` in the current scope
+error[E0599]: no method named `x` found for type `fn() -> Ret {Obj::func}` in the current scope
   --> $DIR/issue-29124.rs:15:15
    |
 LL |     Obj::func.x();
index 24b31f43a85aa14ec0cc000f93fa2132c34a7742..c5432190412297a55c372d3a50040289e750908e 100644 (file)
@@ -1,4 +1,4 @@
-error: reached the type-length limit while instantiating `<T as Foo><(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&()...`
+error: reached the type-length limit while instantiating `<(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&(), &())), &...`
   --> $DIR/issue-37311.rs:13:5
    |
 LL | /     fn recurse(&self) {
index ca2f2a5ba284569a57f89592b83e33c23378ceff..700dbe36474978e8798d1474a61b15a7f883f0f1 100644 (file)
@@ -8,7 +8,7 @@ error[E0080]: evaluation of constant value failed
   --> $DIR/issue-39559-2.rs:14:24
    |
 LL |     let array: [usize; Dim3::dim()]
-   |                        ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim><Dim3 as Dim>::dim`
+   |                        ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>::dim`
 
 error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
   --> $DIR/issue-39559-2.rs:17:15
@@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed
   --> $DIR/issue-39559-2.rs:17:15
    |
 LL |         = [0; Dim3::dim()];
-   |               ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim><Dim3 as Dim>::dim`
+   |               ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>::dim`
 
 error: aborting due to 4 previous errors
 
index b6fd22fa669e0d6d34f1688074fc7c52a2245580..c3ae920238f18af71e1c946f5b5f1c13eda1f67d 100644 (file)
@@ -11,11 +11,11 @@ fn method(&self) {}
 
     pub macro mac() {
         let value = Pub::method;
-        //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {<priv_nominal::Pub>::method}` is private
+        //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
         value;
-        //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {<priv_nominal::Pub>::method}` is private
+        //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
         Pub.method();
-        //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {<priv_nominal::Pub>::method}` is private
+        //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
         Pub::CONST;
         //~^ ERROR associated constant `CONST` is private
         // let _: Pub::AssocTy;
index 69be9d2cea6df1a0909cad64a0a0e29c78ae7aee..6471a7914e1039583d65591ce3921eb0fa49b803 100644 (file)
@@ -1,4 +1,4 @@
-error: type `for<'r> fn(&'r priv_nominal::Pub) {<priv_nominal::Pub>::method}` is private
+error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
   --> $DIR/associated-item-privacy-inherent.rs:13:21
    |
 LL |         let value = Pub::method;
@@ -7,7 +7,7 @@ LL |         let value = Pub::method;
 LL |     priv_nominal::mac!();
    |     --------------------- in this macro invocation
 
-error: type `for<'r> fn(&'r priv_nominal::Pub) {<priv_nominal::Pub>::method}` is private
+error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
   --> $DIR/associated-item-privacy-inherent.rs:15:9
    |
 LL |         value;
@@ -16,7 +16,7 @@ LL |         value;
 LL |     priv_nominal::mac!();
    |     --------------------- in this macro invocation
 
-error: type `for<'r> fn(&'r priv_nominal::Pub) {<priv_nominal::Pub>::method}` is private
+error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
   --> $DIR/associated-item-privacy-inherent.rs:17:13
    |
 LL |         Pub.method();
index d885407a1cd37260023523177f5171acbbfefd95..39f2e5d4af2aaeb7fad5185640a0dd1b907875e5 100644 (file)
@@ -6,7 +6,7 @@
 // error-pattern:type `fn() {<u8 as ext::PrivTrait>::method}` is private
 // error-pattern:type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct}` is private
 // error-pattern:type `fn(u8) -> ext::PubTupleStruct {ext::PubTupleStruct}` is private
-// error-pattern:type `for<'r> fn(&'r ext::Pub<u8>) {<ext::Pub<u8>>::priv_method}` is private
+// error-pattern:type `for<'r> fn(&'r ext::Pub<u8>) {ext::Pub::<u8>::priv_method}` is private
 
 #![feature(decl_macro)]
 
index f8b757ea09820f07735ea9329864b0ec893939b3..61cd84762978c6e4ee2ff691db53b405c8ce7df4 100644 (file)
@@ -46,7 +46,7 @@ LL |     ext::m!();
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
-error: type `for<'r> fn(&'r ext::Pub<u8>) {<ext::Pub<u8>>::priv_method}` is private
+error: type `for<'r> fn(&'r ext::Pub<u8>) {ext::Pub::<u8>::priv_method}` is private
   --> $DIR/private-inferred-type-3.rs:16:5
    |
 LL |     ext::m!();
index d98cf5991efeb9e15f50e1eaecce4c89433eeaf2..d9bb421b53f8c5ccf9d10b2a2741d0bd37492f00 100644 (file)
@@ -47,7 +47,7 @@ impl TraitWithAssocConst for Priv {}
         PubTupleStruct;
         //~^ ERROR type `fn(u8) -> m::PubTupleStruct {m::PubTupleStruct}` is private
         Pub(0u8).priv_method();
-        //~^ ERROR type `for<'r> fn(&'r m::Pub<u8>) {<m::Pub<u8>>::priv_method}` is private
+        //~^ ERROR type `for<'r> fn(&'r m::Pub<u8>) {m::Pub::<u8>::priv_method}` is private
     }
 
     trait Trait {}
index baa98292b67b55ce35ac0809ecd2258621b0ac71..4d40b6b7cab32962d78808f5c85dee662eb525eb 100644 (file)
@@ -151,7 +151,7 @@ LL |         PubTupleStruct;
 LL |     m::m!();
    |     -------- in this macro invocation
 
-error: type `for<'r> fn(&'r m::Pub<u8>) {<m::Pub<u8>>::priv_method}` is private
+error: type `for<'r> fn(&'r m::Pub<u8>) {m::Pub::<u8>::priv_method}` is private
   --> $DIR/private-inferred-type.rs:49:18
    |
 LL |         Pub(0u8).priv_method();
index 6315ec2e5126b6df7bb188e459f2725c26311606..926b098040f1498d427e5ec36f8de41368d5dcd7 100644 (file)
@@ -11,7 +11,7 @@ LL |         0 ..= <S as Tr>::A::f::<u8> => {}
    |               ^^^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types
    |
    = note: start type: {integer}
-   = note: end type: fn() {<S>::f::<u8>}
+   = note: end type: fn() {S::f::<u8>}
 
 error: aborting due to 2 previous errors
 
index 97169c33b8cbf81c54a49321a61055d938805368..69cd49e39512ee57b0cbcd6b32f101da9b0ce33f 100644 (file)
@@ -5,7 +5,7 @@ mod foo {
     pub struct Foo { x: u32 }
 
     impl Foo {
-        #[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar
+        #[rustc_symbol_name] //~ ERROR _ZN15impl1..foo..Foo3bar
         #[rustc_item_path] //~ ERROR item-path(foo::Foo::bar)
         fn bar() { }
     }
index e4fefeb601fe0ac54acdc51c6d737d5bd4cd654a..4041eb6b0ba4a4026018cd8eed70daa90adf825c 100644 (file)
@@ -1,4 +1,4 @@
-error: symbol-name(_ZN5impl13foo3Foo3bar17hc487d6ec13fe9124E)
+error: symbol-name(_ZN15impl1..foo..Foo3bar17hc487d6ec13fe9124E)
   --> $DIR/impl1.rs:8:9
    |
 LL |         #[rustc_symbol_name]