remove generic argument insead of displaying "_"
This commit is contained in:
parent
c64a2ed191
commit
6efa14b3ad
11 changed files with 36 additions and 50 deletions
|
|
@ -13,7 +13,6 @@ use rustc_hir::{ExprKind, Node, QPath};
|
|||
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc_middle::ty::fast_reject::simplify_type;
|
||||
use rustc_middle::ty::print::with_crate_prefix;
|
||||
use rustc_middle::ty::subst::GenericArgKind;
|
||||
use rustc_middle::ty::{
|
||||
self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness,
|
||||
};
|
||||
|
|
@ -411,20 +410,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
.sum();
|
||||
if candidate_numbers == 0 && unsatisfied_predicates.is_empty() {
|
||||
if let Some((path_string, _)) = ty_str.split_once('<') {
|
||||
ty_str_reported = format!("{}<", path_string);
|
||||
for (index, arg) in generics.iter().enumerate() {
|
||||
let arg_replace = match arg.unpack() {
|
||||
GenericArgKind::Lifetime(_) => "'_",
|
||||
GenericArgKind::Type(_)
|
||||
| GenericArgKind::Const(_) => "_",
|
||||
};
|
||||
ty_str_reported =
|
||||
format!("{}{}", ty_str_reported, arg_replace);
|
||||
if index < generics.len() - 1 {
|
||||
ty_str_reported = format!("{}, ", ty_str_reported);
|
||||
}
|
||||
}
|
||||
ty_str_reported = format!("{}>", ty_str_reported);
|
||||
ty_str_reported = path_string.to_string();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0599]: no method named `test_mut` found for struct `Vec<_, _>` in the current scope
|
||||
error[E0599]: no method named `test_mut` found for struct `Vec` in the current scope
|
||||
--> $DIR/auto-ref-slice-plus-ref.rs:7:7
|
||||
|
|
||||
LL | a.test_mut();
|
||||
|
|
@ -11,7 +11,7 @@ note: `MyIter` defines an item `test_mut`, perhaps you need to implement it
|
|||
LL | trait MyIter {
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error[E0599]: no method named `test` found for struct `Vec<_, _>` in the current scope
|
||||
error[E0599]: no method named `test` found for struct `Vec` in the current scope
|
||||
--> $DIR/auto-ref-slice-plus-ref.rs:8:7
|
||||
|
|
||||
LL | a.test();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0599]: no method named `eat` found for struct `Box<_, _>` in the current scope
|
||||
error[E0599]: no method named `eat` found for struct `Box` in the current scope
|
||||
--> $DIR/class-cast-to-trait.rs:53:8
|
||||
|
|
||||
LL | nyan.eat();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0599]: no method named `closure` found for struct `Obj<_>` in the current scope
|
||||
error[E0599]: no method named `closure` found for struct `Obj` in the current scope
|
||||
--> $DIR/issue-18343.rs:7:7
|
||||
|
|
||||
LL | struct Obj<F> where F: FnMut() -> u32 {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0599]: no method named `closure` found for struct `Obj<_>` in the current scope
|
||||
error[E0599]: no method named `closure` found for struct `Obj` in the current scope
|
||||
--> $DIR/issue-2392.rs:36:15
|
||||
|
|
||||
LL | struct Obj<F> where F: FnOnce() -> u32 {
|
||||
|
|
@ -12,7 +12,7 @@ help: to call the function stored in `closure`, surround the field access with p
|
|||
LL | (o_closure.closure)();
|
||||
| ^ ^
|
||||
|
||||
error[E0599]: no method named `not_closure` found for struct `Obj<_>` in the current scope
|
||||
error[E0599]: no method named `not_closure` found for struct `Obj` in the current scope
|
||||
--> $DIR/issue-2392.rs:38:15
|
||||
|
|
||||
LL | struct Obj<F> where F: FnOnce() -> u32 {
|
||||
|
|
@ -23,7 +23,7 @@ LL | o_closure.not_closure();
|
|||
| |
|
||||
| field, not a method
|
||||
|
||||
error[E0599]: no method named `closure` found for struct `Obj<_>` in the current scope
|
||||
error[E0599]: no method named `closure` found for struct `Obj` in the current scope
|
||||
--> $DIR/issue-2392.rs:42:12
|
||||
|
|
||||
LL | struct Obj<F> where F: FnOnce() -> u32 {
|
||||
|
|
@ -65,7 +65,7 @@ help: to call the function stored in `boxed_closure`, surround the field access
|
|||
LL | (boxed_closure.boxed_closure)();
|
||||
| ^ ^
|
||||
|
||||
error[E0599]: no method named `closure` found for struct `Obj<_>` in the current scope
|
||||
error[E0599]: no method named `closure` found for struct `Obj` in the current scope
|
||||
--> $DIR/issue-2392.rs:53:12
|
||||
|
|
||||
LL | struct Obj<F> where F: FnOnce() -> u32 {
|
||||
|
|
@ -79,7 +79,7 @@ help: to call the function stored in `closure`, surround the field access with p
|
|||
LL | (w.wrap.closure)();
|
||||
| ^ ^
|
||||
|
||||
error[E0599]: no method named `not_closure` found for struct `Obj<_>` in the current scope
|
||||
error[E0599]: no method named `not_closure` found for struct `Obj` in the current scope
|
||||
--> $DIR/issue-2392.rs:55:12
|
||||
|
|
||||
LL | struct Obj<F> where F: FnOnce() -> u32 {
|
||||
|
|
@ -90,7 +90,7 @@ LL | w.wrap.not_closure();
|
|||
| |
|
||||
| field, not a method
|
||||
|
||||
error[E0599]: no method named `closure` found for struct `Obj<_>` in the current scope
|
||||
error[E0599]: no method named `closure` found for struct `Obj` in the current scope
|
||||
--> $DIR/issue-2392.rs:58:24
|
||||
|
|
||||
LL | struct Obj<F> where F: FnOnce() -> u32 {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ LL | use no_method_suggested_traits::qux::PrivPub;
|
|||
LL | use no_method_suggested_traits::Reexported;
|
||||
|
|
||||
|
||||
error[E0599]: no method named `method` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:26:44
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&1u32)).method();
|
||||
|
|
@ -46,7 +46,7 @@ help: the following trait is implemented but not in scope; perhaps add a `use` f
|
|||
LL | use foo::Bar;
|
||||
|
|
||||
|
||||
error[E0599]: no method named `method` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:32:43
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&'a')).method();
|
||||
|
|
@ -70,7 +70,7 @@ help: the following trait is implemented but not in scope; perhaps add a `use` f
|
|||
LL | use no_method_suggested_traits::foo::PubPub;
|
||||
|
|
||||
|
||||
error[E0599]: no method named `method` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:37:44
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&1i32)).method();
|
||||
|
|
@ -98,7 +98,7 @@ LL | Foo.method();
|
|||
candidate #3: `no_method_suggested_traits::qux::PrivPub`
|
||||
candidate #4: `Reexported`
|
||||
|
||||
error[E0599]: no method named `method` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:42:43
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&Foo)).method();
|
||||
|
|
@ -124,7 +124,7 @@ note: `foo::Bar` defines an item `method2`, perhaps you need to implement it
|
|||
LL | pub trait Bar {
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error[E0599]: no method named `method2` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method2` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:47:44
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&1u64)).method2();
|
||||
|
|
@ -150,7 +150,7 @@ note: `foo::Bar` defines an item `method2`, perhaps you need to implement it
|
|||
LL | pub trait Bar {
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error[E0599]: no method named `method2` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method2` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:52:71
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2();
|
||||
|
|
@ -176,7 +176,7 @@ note: `foo::Bar` defines an item `method2`, perhaps you need to implement it
|
|||
LL | pub trait Bar {
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error[E0599]: no method named `method2` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method2` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:56:74
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2();
|
||||
|
|
@ -202,7 +202,7 @@ LL | Foo.method3();
|
|||
= note: the following trait defines an item `method3`, perhaps you need to implement it:
|
||||
candidate #1: `PubPub`
|
||||
|
||||
error[E0599]: no method named `method3` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method3` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:61:43
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&Foo)).method3();
|
||||
|
|
@ -225,7 +225,7 @@ LL | Bar::X.method3();
|
|||
= note: the following trait defines an item `method3`, perhaps you need to implement it:
|
||||
candidate #1: `PubPub`
|
||||
|
||||
error[E0599]: no method named `method3` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method3` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:65:46
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3();
|
||||
|
|
@ -241,7 +241,7 @@ error[E0599]: no method named `method3` found for type `usize` in the current sc
|
|||
LL | 1_usize.method3();
|
||||
| ^^^^^^^ method not found in `usize`
|
||||
|
||||
error[E0599]: no method named `method3` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method3` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:70:47
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&1_usize)).method3();
|
||||
|
|
@ -253,7 +253,7 @@ error[E0599]: no method named `method3` found for struct `no_method_suggested_tr
|
|||
LL | no_method_suggested_traits::Foo.method3();
|
||||
| ^^^^^^^ method not found in `no_method_suggested_traits::Foo`
|
||||
|
||||
error[E0599]: no method named `method3` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method3` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:72:71
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3();
|
||||
|
|
@ -265,7 +265,7 @@ error[E0599]: no method named `method3` found for enum `no_method_suggested_trai
|
|||
LL | no_method_suggested_traits::Bar::X.method3();
|
||||
| ^^^^^^^ method not found in `no_method_suggested_traits::Bar`
|
||||
|
||||
error[E0599]: no method named `method3` found for struct `Rc<_>` in the current scope
|
||||
error[E0599]: no method named `method3` found for struct `Rc` in the current scope
|
||||
--> $DIR/no-method-suggested-traits.rs:75:74
|
||||
|
|
||||
LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0599]: no method named `iter` found for struct `Iterate<_, _>` in the current scope
|
||||
error[E0599]: no method named `iter` found for struct `Iterate` in the current scope
|
||||
--> $DIR/issue-41880.rs:27:24
|
||||
|
|
||||
LL | pub struct Iterate<T, F> {
|
||||
|
|
|
|||
|
|
@ -69,22 +69,22 @@ fn main() {
|
|||
let d = point_i32.distance();
|
||||
//~^ ERROR no method named `distance` found for struct `Point<i32>
|
||||
let d = point_i32.other();
|
||||
//~^ ERROR no method named `other` found for struct `Point<_>
|
||||
//~^ ERROR no method named `other` found for struct `Point
|
||||
let v = vec![1_i32, 2, 3];
|
||||
v.iter().map(|x| x * x).extend(std::iter::once(100));
|
||||
//~^ ERROR no method named `extend` found for struct `Map<_, _>
|
||||
//~^ ERROR no method named `extend` found for struct `Map
|
||||
let wrapper = Wrapper(true);
|
||||
wrapper.method();
|
||||
//~^ ERROR no method named `method` found for struct `Wrapper<bool>
|
||||
wrapper.other();
|
||||
//~^ ERROR no method named `other` found for struct `Wrapper<_>
|
||||
//~^ ERROR no method named `other` found for struct `Wrapper
|
||||
let boolean = true;
|
||||
let wrapper = Wrapper2::<'_, _, 3> {x: &boolean};
|
||||
wrapper.method();
|
||||
//~^ ERROR no method named `method` found for struct `Wrapper2<'_, bool, 3_usize>
|
||||
wrapper.other();
|
||||
//~^ ERROR no method named `other` found for struct `Wrapper2<'_, _, _>
|
||||
//~^ ERROR no method named `other` found for struct `Wrapper2
|
||||
let a = vec![1, 2, 3];
|
||||
a.not_found();
|
||||
//~^ ERROR no method named `not_found` found for struct `Vec<_, _>
|
||||
//~^ ERROR no method named `not_found` found for struct `Vec
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ LL | let d = point_i32.distance();
|
|||
|
|
||||
= note: The method was found for Point<f64>.
|
||||
|
||||
error[E0599]: no method named `other` found for struct `Point<_>` in the current scope
|
||||
error[E0599]: no method named `other` found for struct `Point` in the current scope
|
||||
--> $DIR/method-not-found-generic-arg-elision.rs:71:23
|
||||
|
|
||||
LL | struct Point<T> {
|
||||
|
|
@ -18,7 +18,7 @@ LL | struct Point<T> {
|
|||
LL | let d = point_i32.other();
|
||||
| ^^^^^ method not found in `Point<i32>`
|
||||
|
||||
error[E0599]: no method named `extend` found for struct `Map<_, _>` in the current scope
|
||||
error[E0599]: no method named `extend` found for struct `Map` in the current scope
|
||||
--> $DIR/method-not-found-generic-arg-elision.rs:74:29
|
||||
|
|
||||
LL | v.iter().map(|x| x * x).extend(std::iter::once(100));
|
||||
|
|
@ -35,7 +35,7 @@ LL | wrapper.method();
|
|||
|
|
||||
= note: The method was found for Wrapper<i8>, Wrapper<u16>, Wrapper<u16> and 3 more.
|
||||
|
||||
error[E0599]: no method named `other` found for struct `Wrapper<_>` in the current scope
|
||||
error[E0599]: no method named `other` found for struct `Wrapper` in the current scope
|
||||
--> $DIR/method-not-found-generic-arg-elision.rs:79:13
|
||||
|
|
||||
LL | struct Wrapper<T>(T);
|
||||
|
|
@ -55,7 +55,7 @@ LL | wrapper.method();
|
|||
|
|
||||
= note: The method was found for Wrapper2<'a, i8, C>, Wrapper2<'a, i32, C> and Wrapper2<'a, i32, C>.
|
||||
|
||||
error[E0599]: no method named `other` found for struct `Wrapper2<'_, _, _>` in the current scope
|
||||
error[E0599]: no method named `other` found for struct `Wrapper2` in the current scope
|
||||
--> $DIR/method-not-found-generic-arg-elision.rs:85:13
|
||||
|
|
||||
LL | struct Wrapper2<'a, T, const C: usize> {
|
||||
|
|
@ -64,7 +64,7 @@ LL | struct Wrapper2<'a, T, const C: usize> {
|
|||
LL | wrapper.other();
|
||||
| ^^^^^ method not found in `Wrapper2<'_, bool, 3_usize>`
|
||||
|
||||
error[E0599]: no method named `not_found` found for struct `Vec<_, _>` in the current scope
|
||||
error[E0599]: no method named `not_found` found for struct `Vec` in the current scope
|
||||
--> $DIR/method-not-found-generic-arg-elision.rs:88:7
|
||||
|
|
||||
LL | a.not_found();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ LL | fn owned(self: Box<Self>);
|
|||
LL | x.owned();
|
||||
| ^^^^^ method not found in `&mut dyn Foo`
|
||||
|
||||
error[E0599]: no method named `managed` found for struct `Box<_, _>` in the current scope
|
||||
error[E0599]: no method named `managed` found for struct `Box` in the current scope
|
||||
--> $DIR/object-pointer-types.rs:23:7
|
||||
|
|
||||
LL | x.managed();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error[E0433]: failed to resolve: maybe a missing crate `x`?
|
|||
LL | use x::y::z;
|
||||
| ^ maybe a missing crate `x`?
|
||||
|
||||
error[E0599]: no function or associated item named `z` found for struct `Box<_, _>` in the current scope
|
||||
error[E0599]: no function or associated item named `z` found for struct `Box` in the current scope
|
||||
--> $DIR/issue-82865.rs:8:10
|
||||
|
|
||||
LL | Box::z
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue