From: Eduard-Mihai Burtescu Date: Wed, 19 Dec 2018 03:01:06 +0000 (+0200) Subject: rustc: pass Option<&Substs> and Namespace around in ty::item_path. X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=3e1cef700753ef4802c244f7e48d59de5d4324dd;p=rust.git rustc: pass Option<&Substs> and Namespace around in ty::item_path. --- diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs index 87859ac00c3..d9a8deb80e4 100644 --- a/src/librustc/ty/item_path.rs +++ b/src/librustc/ty/item_path.rs @@ -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 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 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!("", 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 { 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<::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!("", 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 { diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 94560606cad..092255129f4 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -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; diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index 6bd9b159775..a7771f3da18 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -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() }) } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index d321697f713..6714866369e 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -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, diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp index b529beba783..ad663412e77 100644 --- a/src/test/pretty/issue-4264.pp +++ b/src/test/pretty/issue-4264.pp @@ -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); diff --git a/src/test/ui/bad/bad-sized.stderr b/src/test/ui/bad/bad-sized.stderr index 9565888dcc0..51b84745552 100644 --- a/src/test/ui/bad/bad-sized.stderr +++ b/src/test/ui/bad/bad-sized.stderr @@ -22,7 +22,7 @@ LL | let x: Vec = Vec::new(); | = help: the trait `std::marker::Sized` is not implemented for `dyn Trait` = note: to learn more, visit - = note: required by `>::new` + = note: required by `std::vec::Vec::::new` error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr index 1fe3d33322f..7ede44c65b8 100644 --- a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr +++ b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr @@ -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: `>::new` is not yet stable as a const fn +error: `std::vec::Vec::::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 = Vec::new(); diff --git a/src/test/ui/hygiene/impl_items.rs b/src/test/ui/hygiene/impl_items.rs index d628573d517..37794c6e077 100644 --- a/src/test/ui/hygiene/impl_items.rs +++ b/src/test/ui/hygiene/impl_items.rs @@ -9,7 +9,7 @@ fn f(&self) {} } pub macro m() { - let _: () = S.f(); //~ ERROR type `for<'r> fn(&'r foo::S) {::f}` is private + let _: () = S.f(); //~ ERROR type `for<'r> fn(&'r foo::S) {foo::S::f}` is private } } diff --git a/src/test/ui/hygiene/impl_items.stderr b/src/test/ui/hygiene/impl_items.stderr index 0a273bc98ff..418c2c73ba1 100644 --- a/src/test/ui/hygiene/impl_items.stderr +++ b/src/test/ui/hygiene/impl_items.stderr @@ -1,4 +1,4 @@ -error: type `for<'r> fn(&'r 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(); diff --git a/src/test/ui/issues/issue-17651.stderr b/src/test/ui/issues/issue-17651.stderr index 72c40ff4b3a..ce9af1524b0 100644 --- a/src/test/ui/issues/issue-17651.stderr +++ b/src/test/ui/issues/issue-17651.stderr @@ -6,7 +6,7 @@ LL | (|| Box::new(*(&[0][..])))(); | = help: the trait `std::marker::Sized` is not implemented for `[{integer}]` = note: to learn more, visit - = note: required by `>::new` + = note: required by `std::boxed::Box::::new` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22638.rs b/src/test/ui/issues/issue-22638.rs index ff58c7aaced..fab24404eba 100644 --- a/src/test/ui/issues/issue-22638.rs +++ b/src/test/ui/issues/issue-22638.rs @@ -50,7 +50,7 @@ pub fn matches(&self, f: &F) { impl D { pub fn matches(&self, f: &F) { - //~^ ERROR reached the type-length limit while instantiating `::matches::<[closure + //~^ ERROR reached the type-length limit while instantiating `D::matches::<[closure let &D(ref a) = self; a.matches(f) } diff --git a/src/test/ui/issues/issue-22638.stderr b/src/test/ui/issues/issue-22638.stderr index 65483abe5c7..aff968f3618 100644 --- a/src/test/ui/issues/issue-22638.stderr +++ b/src/test/ui/issues/issue-22638.stderr @@ -1,4 +1,4 @@ -error: reached the type-length limit while instantiating `::matches::$CLOSURE` +error: reached the type-length limit while instantiating `D::matches::$CLOSURE` --> $DIR/issue-22638.rs:52:5 | LL | / pub fn matches(&self, f: &F) { diff --git a/src/test/ui/issues/issue-24322.stderr b/src/test/ui/issues/issue-24322.stderr index b284c8cf117..def373cf2c0 100644 --- a/src/test/ui/issues/issue-24322.stderr +++ b/src/test/ui/issues/issue-24322.stderr @@ -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 {::func}` + found type `&for<'r> fn(&'r B) -> u32 {B::func}` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-29124.rs b/src/test/ui/issues/issue-29124.rs index 8062045a6c0..1cd3f84f7a2 100644 --- a/src/test/ui/issues/issue-29124.rs +++ b/src/test/ui/issues/issue-29124.rs @@ -13,7 +13,7 @@ fn func() -> Ret { fn main() { Obj::func.x(); - //~^ ERROR no method named `x` found for type `fn() -> Ret {::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 } diff --git a/src/test/ui/issues/issue-29124.stderr b/src/test/ui/issues/issue-29124.stderr index 67f188e0588..3beb7289788 100644 --- a/src/test/ui/issues/issue-29124.stderr +++ b/src/test/ui/issues/issue-29124.stderr @@ -1,4 +1,4 @@ -error[E0599]: no method named `x` found for type `fn() -> Ret {::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(); diff --git a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr index 24b31f43a85..c5432190412 100644 --- a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr +++ b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr @@ -1,4 +1,4 @@ -error: reached the type-length limit while instantiating `<(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&()...` +error: reached the type-length limit while instantiating `<(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&(), &())), &...` --> $DIR/issue-37311.rs:13:5 | LL | / fn recurse(&self) { diff --git a/src/test/ui/issues/issue-39559-2.stderr b/src/test/ui/issues/issue-39559-2.stderr index ca2f2a5ba28..700dbe36474 100644 --- a/src/test/ui/issues/issue-39559-2.stderr +++ b/src/test/ui/issues/issue-39559-2.stderr @@ -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 `::dim` + | ^^^^^^^^^^^ calling non-const function `::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 `::dim` + | ^^^^^^^^^^^ calling non-const function `::dim` error: aborting due to 4 previous errors diff --git a/src/test/ui/privacy/associated-item-privacy-inherent.rs b/src/test/ui/privacy/associated-item-privacy-inherent.rs index b6fd22fa669..c3ae920238f 100644 --- a/src/test/ui/privacy/associated-item-privacy-inherent.rs +++ b/src/test/ui/privacy/associated-item-privacy-inherent.rs @@ -11,11 +11,11 @@ fn method(&self) {} pub macro mac() { let value = Pub::method; - //~^ ERROR type `for<'r> fn(&'r 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) {::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) {::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; diff --git a/src/test/ui/privacy/associated-item-privacy-inherent.stderr b/src/test/ui/privacy/associated-item-privacy-inherent.stderr index 69be9d2cea6..6471a7914e1 100644 --- a/src/test/ui/privacy/associated-item-privacy-inherent.stderr +++ b/src/test/ui/privacy/associated-item-privacy-inherent.stderr @@ -1,4 +1,4 @@ -error: type `for<'r> fn(&'r 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) {::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) {::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(); diff --git a/src/test/ui/privacy/private-inferred-type-3.rs b/src/test/ui/privacy/private-inferred-type-3.rs index d885407a1cd..39f2e5d4af2 100644 --- a/src/test/ui/privacy/private-inferred-type-3.rs +++ b/src/test/ui/privacy/private-inferred-type-3.rs @@ -6,7 +6,7 @@ // error-pattern:type `fn() {::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) {>::priv_method}` is private +// error-pattern:type `for<'r> fn(&'r ext::Pub) {ext::Pub::::priv_method}` is private #![feature(decl_macro)] diff --git a/src/test/ui/privacy/private-inferred-type-3.stderr b/src/test/ui/privacy/private-inferred-type-3.stderr index f8b757ea098..61cd8476297 100644 --- a/src/test/ui/privacy/private-inferred-type-3.stderr +++ b/src/test/ui/privacy/private-inferred-type-3.stderr @@ -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) {>::priv_method}` is private +error: type `for<'r> fn(&'r ext::Pub) {ext::Pub::::priv_method}` is private --> $DIR/private-inferred-type-3.rs:16:5 | LL | ext::m!(); diff --git a/src/test/ui/privacy/private-inferred-type.rs b/src/test/ui/privacy/private-inferred-type.rs index d98cf5991ef..d9bb421b53f 100644 --- a/src/test/ui/privacy/private-inferred-type.rs +++ b/src/test/ui/privacy/private-inferred-type.rs @@ -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) {>::priv_method}` is private + //~^ ERROR type `for<'r> fn(&'r m::Pub) {m::Pub::::priv_method}` is private } trait Trait {} diff --git a/src/test/ui/privacy/private-inferred-type.stderr b/src/test/ui/privacy/private-inferred-type.stderr index baa98292b67..4d40b6b7cab 100644 --- a/src/test/ui/privacy/private-inferred-type.stderr +++ b/src/test/ui/privacy/private-inferred-type.stderr @@ -151,7 +151,7 @@ LL | PubTupleStruct; LL | m::m!(); | -------- in this macro invocation -error: type `for<'r> fn(&'r m::Pub) {>::priv_method}` is private +error: type `for<'r> fn(&'r m::Pub) {m::Pub::::priv_method}` is private --> $DIR/private-inferred-type.rs:49:18 | LL | Pub(0u8).priv_method(); diff --git a/src/test/ui/qualified/qualified-path-params.stderr b/src/test/ui/qualified/qualified-path-params.stderr index 6315ec2e512..926b098040f 100644 --- a/src/test/ui/qualified/qualified-path-params.stderr +++ b/src/test/ui/qualified/qualified-path-params.stderr @@ -11,7 +11,7 @@ LL | 0 ..= ::A::f:: => {} | ^^^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types | = note: start type: {integer} - = note: end type: fn() {::f::} + = note: end type: fn() {S::f::} error: aborting due to 2 previous errors diff --git a/src/test/ui/symbol-names/impl1.rs b/src/test/ui/symbol-names/impl1.rs index 97169c33b8c..69cd49e3951 100644 --- a/src/test/ui/symbol-names/impl1.rs +++ b/src/test/ui/symbol-names/impl1.rs @@ -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() { } } diff --git a/src/test/ui/symbol-names/impl1.stderr b/src/test/ui/symbol-names/impl1.stderr index e4fefeb601f..4041eb6b0ba 100644 --- a/src/test/ui/symbol-names/impl1.stderr +++ b/src/test/ui/symbol-names/impl1.stderr @@ -1,4 +1,4 @@ -error: symbol-name(_ZN5impl13foo3Foo3bar17hc487d6ec13fe9124E) +error: symbol-name(_ZN15impl1..foo..Foo3bar17hc487d6ec13fe9124E) --> $DIR/impl1.rs:8:9 | LL | #[rustc_symbol_name]