gcc/rust/ChangeLog:
* typecheck/rust-hir-inherent-impl-overlap.h:
Added rich location and errorcode.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
likewise.
gcc/testsuite/ChangeLog:
* rust/compile/generics7.rs: Added Errorcode hint.
* rust/compile/generics8.rs: Updated dejagnu comment.
* rust/compile/issue-925.rs: Added Errorcode hint.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
const std::string &name)
{
rich_location r (line_table, dup->get_locus ());
+ std::string msg = "duplicate definitions for " + name;
+ r.add_fixit_replace (query->get_locus (), msg.c_str ());
r.add_range (query->get_locus ());
- rust_error_at (r, "duplicate definitions with name %s", name.c_str ());
+ rust_error_at (r, ErrorCode::E0592, "duplicate definitions with name %qs",
+ name.c_str ());
}
private:
r.add_fixit_replace (rich_msg.c_str ());
rust_error_at (
- r, ErrorCode::E0034,
- "multiple applicable items in scope for method %qs",
+ r, ErrorCode::E0592, "duplicate definitions with name %qs",
expr.get_method_name ().get_segment ().as_string ().c_str ());
return;
}
self.a
}
}
-
+// E0592
fn main() {
let a = Foo { a: 123 };
a.bar();
- // { dg-error "multiple applicable items in scope for method .bar." "" { target *-*-* } .-1 }
+ // { dg-error "duplicate definitions with name .bar." "" { target *-*-* } .-1 }
}
}
impl Foo<i32, f32> {
- fn test() -> f32 { // { dg-error "duplicate definitions with name test" }
+ fn test() -> f32 { // { dg-error "duplicate definitions with name .test." }
123f32
}
}
impl B for S {
fn foo(&self) {}
}
-
+// E0592
fn test() {
let a = S;
a.foo();
- // { dg-error "multiple applicable items in scope for method .foo." "" { target *-*-* } .-1 }
+ // { dg-error "duplicate definitions with name .foo." "" { target *-*-* } .-1 }
}