gcc/rust/ChangeLog:
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::check_for_privacy_violation):
Added errorcode & richlocation.
gcc/testsuite/ChangeLog:
* rust/compile/privacy1.rs: Added errorcode.
* rust/compile/privacy3.rs: likewise.
* rust/compile/privacy4.rs: likewise.
* rust/compile/privacy5.rs: likewise.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
}
if (!valid)
- rust_error_at (locus, "definition is private in this context");
+ {
+ rich_location richloc (line_table, locus);
+ richloc.add_fixit_replace ("item is private");
+ rust_error_at (richloc, ErrorCode::E0603,
+ "definition is private in this context");
+ }
}
void
pub fn doux() {}
}
- fn brown() {
+ fn brown() {// E0603
green::sain(); // { dg-error "definition is private in this context" }
green::doux();
}
}
fn brown() {
- if green::sain() {
+ if green::sain() {// E0603
// { dg-error "definition is private in this context" "" { target *-*-* } .-1 }
green::doux();
}
}
}
- fn brown() {
+ fn brown() {// E0603
green::bean::<bool>(false);
// { dg-error "definition is private in this context" "" { target *-*-* } .-1 }
let a = green::bean::<i32>(15);
pub struct Baz;
}
- fn brown() {
+ fn brown() {// E0603
let _ = green::Foo; // { dg-error "definition is private in this context" }
let _ = green::Bar;
let _ = green::Baz;