public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7964] gccrs: [E0603] Use of private item outside scope
@ 2024-01-16 18:09 Arthur Cohen
0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 18:09 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1e4553be001fab0836d82ca4322af6d6c655c0fd
commit r14-7964-g1e4553be001fab0836d82ca4322af6d6c655c0fd
Author: Muhammad Mahad <mahadtxt@gmail.com>
Date: Sun Sep 3 11:13:53 2023 +0500
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>
Diff:
---
gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc | 7 ++++++-
gcc/testsuite/rust/compile/privacy1.rs | 2 +-
gcc/testsuite/rust/compile/privacy3.rs | 2 +-
gcc/testsuite/rust/compile/privacy4.rs | 2 +-
gcc/testsuite/rust/compile/privacy5.rs | 2 +-
5 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
index 2c9f4b75a06..7c3b4149d61 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
diff --git a/gcc/testsuite/rust/compile/privacy1.rs b/gcc/testsuite/rust/compile/privacy1.rs
index 1cc83c04abe..61a2ae93635 100644
--- a/gcc/testsuite/rust/compile/privacy1.rs
+++ b/gcc/testsuite/rust/compile/privacy1.rs
@@ -4,7 +4,7 @@ mod orange {
pub fn doux() {}
}
- fn brown() {
+ fn brown() {// E0603
green::sain(); // { dg-error "definition is private in this context" }
green::doux();
}
diff --git a/gcc/testsuite/rust/compile/privacy3.rs b/gcc/testsuite/rust/compile/privacy3.rs
index d48acea4786..8c8c199258f 100644
--- a/gcc/testsuite/rust/compile/privacy3.rs
+++ b/gcc/testsuite/rust/compile/privacy3.rs
@@ -8,7 +8,7 @@ mod orange {
}
fn brown() {
- if green::sain() {
+ if green::sain() {// E0603
// { dg-error "definition is private in this context" "" { target *-*-* } .-1 }
green::doux();
}
diff --git a/gcc/testsuite/rust/compile/privacy4.rs b/gcc/testsuite/rust/compile/privacy4.rs
index 648b7b9adb7..7865f6a3d47 100644
--- a/gcc/testsuite/rust/compile/privacy4.rs
+++ b/gcc/testsuite/rust/compile/privacy4.rs
@@ -8,7 +8,7 @@ mod orange {
}
}
- 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);
diff --git a/gcc/testsuite/rust/compile/privacy5.rs b/gcc/testsuite/rust/compile/privacy5.rs
index 0e0e496dde2..16445ddc3e3 100644
--- a/gcc/testsuite/rust/compile/privacy5.rs
+++ b/gcc/testsuite/rust/compile/privacy5.rs
@@ -5,7 +5,7 @@ mod orange {
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-16 18:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 18:09 [gcc r14-7964] gccrs: [E0603] Use of private item outside scope Arthur Cohen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).