write!(f, "::{}", key.disambiguated_data.data.as_interned_str())?;
} else {
+ // Try to print `impl`s more like how you'd refer to their associated items.
+ 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!(f, self, write("{}", self.tcx.item_path_str(def_id)))?;
+
+ let trait_ref = trait_ref.subst(self.tcx, substs);
+ print!(f, 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!(f, self, write("<"), print(self_ty), write(">"))?;
+ }
+ return Ok(());
+ }
+
print!(f, self, write("{}", self.tcx.item_path_str(def_id)))?;
}
}
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
}
}
-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();
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)
}
-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) {
| ^^^^^^^^ 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
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
}
-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();
--> $DIR/issue-39559-2.rs:14:24
|
LL | let array: [usize; Dim3::dim()]
- | ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>::dim`
+ | ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim><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
--> $DIR/issue-39559-2.rs:17:15
|
LL | = [0; Dim3::dim()];
- | ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>::dim`
+ | ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim><Dim3 as Dim>::dim`
error: aborting due to 4 previous errors
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;
-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;
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;
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();
| ^^^^^^^^^^^^^^^^^^^^^ 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