Rollup merge of #35314 - yossi-k:issue/35277, r=jonathandturner
Update E0185 and E0186 to new format Part of #35233. Fixes #35277. Fixes #35276. r? @jonathandturner
This commit is contained in:
commit
f9f6fd4fbb
@ -59,19 +59,33 @@ pub fn compare_impl_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||
(&ty::ExplicitSelfCategory::Static,
|
||||
&ty::ExplicitSelfCategory::Static) => {}
|
||||
(&ty::ExplicitSelfCategory::Static, _) => {
|
||||
span_err!(tcx.sess, impl_m_span, E0185,
|
||||
let mut err = struct_span_err!(tcx.sess, impl_m_span, E0185,
|
||||
"method `{}` has a `{}` declaration in the impl, \
|
||||
but not in the trait",
|
||||
trait_m.name,
|
||||
impl_m.explicit_self);
|
||||
err.span_label(impl_m_span, &format!("`{}` used in impl",
|
||||
impl_m.explicit_self));
|
||||
if let Some(span) = tcx.map.span_if_local(trait_m.def_id) {
|
||||
err.span_label(span, &format!("trait declared without `{}`",
|
||||
impl_m.explicit_self));
|
||||
}
|
||||
err.emit();
|
||||
return;
|
||||
}
|
||||
(_, &ty::ExplicitSelfCategory::Static) => {
|
||||
span_err!(tcx.sess, impl_m_span, E0186,
|
||||
let mut err = struct_span_err!(tcx.sess, impl_m_span, E0186,
|
||||
"method `{}` has a `{}` declaration in the trait, \
|
||||
but not in the impl",
|
||||
trait_m.name,
|
||||
trait_m.explicit_self);
|
||||
err.span_label(impl_m_span, &format!("expected `{}` in impl",
|
||||
trait_m.explicit_self));
|
||||
if let Some(span) = tcx.map.span_if_local(trait_m.def_id) {
|
||||
err.span_label(span, & format!("`{}` used in trait",
|
||||
trait_m.explicit_self));
|
||||
}
|
||||
err.emit();
|
||||
return;
|
||||
}
|
||||
_ => {
|
||||
|
@ -9,13 +9,14 @@
|
||||
// except according to those terms.
|
||||
|
||||
trait Foo {
|
||||
fn foo();
|
||||
fn foo(); //~ trait declared without `&self`
|
||||
}
|
||||
|
||||
struct Bar;
|
||||
|
||||
impl Foo for Bar {
|
||||
fn foo(&self) {} //~ ERROR E0185
|
||||
//~^ `&self` used in impl
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -9,13 +9,14 @@
|
||||
// except according to those terms.
|
||||
|
||||
trait Foo {
|
||||
fn foo(&self);
|
||||
fn foo(&self); //~ `&self` used in trait
|
||||
}
|
||||
|
||||
struct Bar;
|
||||
|
||||
impl Foo for Bar {
|
||||
fn foo() {} //~ ERROR E0186
|
||||
//~^ expected `&self` in impl
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user