aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorMuhammad Mahad <mahadtxt@gmail.com>2023-09-03 11:13:53 +0500
committerPhilip Herron <philip.herron@embecosm.com>2023-09-03 18:04:55 +0000
commit45d892b542d1a4d5052842d9cc512d23a2770ac5 (patch)
treec1b2ae4b612672f5d05e80ae3a6987417258e991 /gcc/rust
parentb1956a4f70ee26dd6f02e7dc77787c456907943e (diff)
downloadgcc-45d892b542d1a4d5052842d9cc512d23a2770ac5.zip
gcc-45d892b542d1a4d5052842d9cc512d23a2770ac5.tar.gz
gcc-45d892b542d1a4d5052842d9cc512d23a2770ac5.tar.bz2
gccrs: [E0603] Use of private item outside scope
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>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
index 8f0d04c..fb24159 100644
--- a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
+++ b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
@@ -166,7 +166,12 @@ PrivacyReporter::check_for_privacy_violation (const NodeId &use_id,
}
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