gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Added new error message, rich location and error code.
gcc/testsuite/ChangeLog:
* rust/compile/cfg2.rs: Updated according to new message.
* rust/compile/issue-2139.rs: likewise.
* rust/compile/issue-2190-1.rs: likewise.
* rust/compile/method1.rs: likewise.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
expr.get_method_name ().get_segment ());
if (candidates.empty ())
{
+ rich_location richloc (line_table, expr.get_method_name ().get_locus ());
+ richloc.add_fixit_replace ("method not found");
rust_error_at (
- expr.get_method_name ().get_locus (),
- "failed to resolve method for %<%s%>",
+ richloc, ErrorCode::E0599,
+ "no method named %qs found in the current scope",
expr.get_method_name ().get_segment ().as_string ().c_str ());
return;
}
fn main() {
let a = Foo;
a.test();
- // { dg-error "failed to resolve method for .test." "" { target *-*-* } .-1 }
+ // { dg-error "no method named .test. found in the current scope" "" { target *-*-* } .-1 }
}
fn main() {
let a: u16 = 123;
a.foo();
- // { dg-error "failed to resolve method for .foo." "" { target *-*-* } .-1 }
+ // { dg-error "no method named .foo. found in the current scope" "" { target *-*-* } .-1 }
}
fn foo<T: Deref<Target = i32>>(t: &T) -> i32 {
t.max(2)
- // { dg-error "failed to resolve method for .max." "" { target *-*-* } .-1 }
+ // { dg-error "no method named .max. found in the current scope" "" { target *-*-* } .-1 }
}
a = Foo(123);
a.test();
- // { dg-error "failed to resolve method for .test." "" { target *-*-* } .-1 }
+ // { dg-error "no method named .test. found in the current scope" "" { target *-*-* } .-1 }
}