diff options
| author | Oneirical <manchot@videotron.ca> | 2025-07-13 15:56:27 -0400 |
|---|---|---|
| committer | Oneirical <manchot@videotron.ca> | 2025-07-24 17:01:44 -0400 |
| commit | a924d44115b632775ef0d2e12382e285953b0c2c (patch) | |
| tree | 4cb6005288fc4a7407006094892fcf577f3f30cf /tests/ui/privacy | |
| parent | 246733a3d978de41c5b77b8120ba8f41592df9f1 (diff) | |
| download | rust-a924d44115b632775ef0d2e12382e285953b0c2c.tar.gz rust-a924d44115b632775ef0d2e12382e285953b0c2c.zip | |
Rehome tests/ui/issues/ tests [1/?]
Diffstat (limited to 'tests/ui/privacy')
| -rw-r--r-- | tests/ui/privacy/private-field-access-in-mutex-54062.rs | 14 | ||||
| -rw-r--r-- | tests/ui/privacy/private-field-access-in-mutex-54062.stderr | 9 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/privacy/private-field-access-in-mutex-54062.rs b/tests/ui/privacy/private-field-access-in-mutex-54062.rs new file mode 100644 index 00000000000..f145f9c3e52 --- /dev/null +++ b/tests/ui/privacy/private-field-access-in-mutex-54062.rs @@ -0,0 +1,14 @@ +use std::sync::Mutex; + +struct Test { + comps: Mutex<String>, +} + +fn main() {} + +fn testing(test: Test) { + let _ = test.comps.inner.try_lock(); + //~^ ERROR: field `inner` of struct `Mutex` is private +} + +// https://github.com/rust-lang/rust/issues/54062 diff --git a/tests/ui/privacy/private-field-access-in-mutex-54062.stderr b/tests/ui/privacy/private-field-access-in-mutex-54062.stderr new file mode 100644 index 00000000000..14244107597 --- /dev/null +++ b/tests/ui/privacy/private-field-access-in-mutex-54062.stderr @@ -0,0 +1,9 @@ +error[E0616]: field `inner` of struct `Mutex` is private + --> $DIR/private-field-access-in-mutex-54062.rs:10:24 + | +LL | let _ = test.comps.inner.try_lock(); + | ^^^^^ private field + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0616`. |
