stop mentioning number of applicate implementations
This commit is contained in:
parent
19d46b690a
commit
e449daad6c
4 changed files with 7 additions and 10 deletions
|
@ -2388,14 +2388,11 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||||
// If there is only one implementation of the trait, suggest using it.
|
// If there is only one implementation of the trait, suggest using it.
|
||||||
// Otherwise, use a placeholder comment for the implementation.
|
// Otherwise, use a placeholder comment for the implementation.
|
||||||
let (message, impl_suggestion) = if non_blanket_impl_count == 1 {(
|
let (message, impl_suggestion) = if non_blanket_impl_count == 1 {(
|
||||||
"use the fully-qualified path to the only available implementation".to_string(),
|
"use the fully-qualified path to the only available implementation",
|
||||||
format!("<{} as ", self.tcx.type_of(impl_def_id).instantiate_identity())
|
format!("<{} as ", self.tcx.type_of(impl_def_id).instantiate_identity())
|
||||||
)} else {(
|
)} else {
|
||||||
format!(
|
("use a fully-qualified path to a specific available implementation",
|
||||||
"use a fully-qualified path to a specific available implementation ({} found)",
|
"</* self type */ as ".to_string()
|
||||||
non_blanket_impl_count
|
|
||||||
),
|
|
||||||
"</* self type */ as ".to_string()
|
|
||||||
)};
|
)};
|
||||||
let mut suggestions = vec![(
|
let mut suggestions = vec![(
|
||||||
path.span.shrink_to_lo(),
|
path.span.shrink_to_lo(),
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | fn create() -> u32;
|
||||||
LL | let cont: u32 = Generator::create();
|
LL | let cont: u32 = Generator::create();
|
||||||
| ^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
| ^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||||
|
|
|
|
||||||
help: use a fully-qualified path to a specific available implementation (2 found)
|
help: use a fully-qualified path to a specific available implementation
|
||||||
|
|
|
|
||||||
LL | let cont: u32 = </* self type */ as Generator>::create();
|
LL | let cont: u32 = </* self type */ as Generator>::create();
|
||||||
| +++++++++++++++++++ +
|
| +++++++++++++++++++ +
|
||||||
|
|
|
@ -63,7 +63,7 @@ LL | fn my_fn();
|
||||||
LL | MyTrait2::my_fn();
|
LL | MyTrait2::my_fn();
|
||||||
| ^^^^^^^^^^^^^^^ cannot call associated function of trait
|
| ^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||||
|
|
|
|
||||||
help: use a fully-qualified path to a specific available implementation (2 found)
|
help: use a fully-qualified path to a specific available implementation
|
||||||
|
|
|
|
||||||
LL | </* self type */ as MyTrait2>::my_fn();
|
LL | </* self type */ as MyTrait2>::my_fn();
|
||||||
| +++++++++++++++++++ +
|
| +++++++++++++++++++ +
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0790]: cannot call associated function on trait without specifying the co
|
||||||
LL | let _ = (Default::default(),);
|
LL | let _ = (Default::default(),);
|
||||||
| ^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
| ^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
||||||
|
|
|
|
||||||
help: use a fully-qualified path to a specific available implementation (271 found)
|
help: use a fully-qualified path to a specific available implementation
|
||||||
|
|
|
|
||||||
LL | let _ = (</* self type */ as Default>::default(),);
|
LL | let _ = (</* self type */ as Default>::default(),);
|
||||||
| +++++++++++++++++++ +
|
| +++++++++++++++++++ +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue