auto merge of #10509 : cmr/rust/trait_name, r=alexcrichton
Rebase + fix of #10118
This commit is contained in:
commit
dff4f52a72
@ -863,10 +863,12 @@ 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)",
|
||||
format!("method `{}` has {} parameter{} \
|
||||
but the declaration in trait `{}` 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 declaration in trait `foo::bar` has 1
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user