Show the name of the trait in the error message
This commit is contained in:
parent
90754ae9c9
commit
51bdec18b0
@ -863,11 +863,13 @@ pub fn compare_impl_method(tcx: ty::ctxt,
|
||||
if impl_m.fty.sig.inputs.len() != trait_m.fty.sig.inputs.len() {
|
||||
tcx.sess.span_err(
|
||||
impl_m_span,
|
||||
format!("method `{}` has {} parameter(s) \
|
||||
but the trait has {} parameter(s)",
|
||||
tcx.sess.str_of(trait_m.ident),
|
||||
impl_m.fty.sig.inputs.len(),
|
||||
trait_m.fty.sig.inputs.len()));
|
||||
format!("method `{}` has {} parameter{} \
|
||||
but the trait method `{}` has {}",
|
||||
tcx.sess.str_of(trait_m.ident),
|
||||
impl_m.fty.sig.inputs.len(),
|
||||
if impl_m.fty.sig.inputs.len() == 1 { "" } else { "s" },
|
||||
ty::item_path_str(tcx, trait_m.def_id),
|
||||
trait_m.fty.sig.inputs.len()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ trait foo {
|
||||
}
|
||||
impl foo for int {
|
||||
fn bar(&self) -> int {
|
||||
//~^ ERROR method `bar` has 0 parameter(s) but the trait has 1
|
||||
//~^ ERROR method `bar` has 0 parameters but the trait method `foo::bar` has 1
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user