diff options
author | Muhammad Mahad <mahadtxt@gmail.com> | 2023-09-03 11:13:53 +0500 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:04:31 +0100 |
commit | 1e4553be001fab0836d82ca4322af6d6c655c0fd (patch) | |
tree | 1f541058b24b463d3dcf22b14522213d3d41f3e2 /gcc/rust | |
parent | fe97255c29024535e8c49663a4abb8d419073ab1 (diff) | |
download | gcc-1e4553be001fab0836d82ca4322af6d6c655c0fd.zip gcc-1e4553be001fab0836d82ca4322af6d6c655c0fd.tar.gz gcc-1e4553be001fab0836d82ca4322af6d6c655c0fd.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.cc | 7 |
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 2c9f4b7..7c3b414 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 |