From 328447279d8247dcf3341fb1ed58fc39ba871ae3 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Fri, 26 Jul 2019 17:39:58 +0900 Subject: [PATCH] Add test for issue-54062 --- src/test/ui/issues/issue-54062.rs | 13 +++++++++++++ src/test/ui/issues/issue-54062.stderr | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/test/ui/issues/issue-54062.rs create mode 100644 src/test/ui/issues/issue-54062.stderr diff --git a/src/test/ui/issues/issue-54062.rs b/src/test/ui/issues/issue-54062.rs new file mode 100644 index 0000000000000..495b7343f2034 --- /dev/null +++ b/src/test/ui/issues/issue-54062.rs @@ -0,0 +1,13 @@ +use std::sync::Mutex; + +struct Test { + comps: Mutex, +} + +fn main() {} + +fn testing(test: Test) { + let _ = test.comps.inner.lock().unwrap(); + //~^ ERROR: field `inner` of struct `std::sync::Mutex` is private + //~| ERROR: no method named `unwrap` found +} diff --git a/src/test/ui/issues/issue-54062.stderr b/src/test/ui/issues/issue-54062.stderr new file mode 100644 index 0000000000000..082ac91edb1c4 --- /dev/null +++ b/src/test/ui/issues/issue-54062.stderr @@ -0,0 +1,16 @@ +error[E0616]: field `inner` of struct `std::sync::Mutex` is private + --> $DIR/issue-54062.rs:10:13 + | +LL | let _ = test.comps.inner.lock().unwrap(); + | ^^^^^^^^^^^^^^^^ + +error[E0599]: no method named `unwrap` found for type `std::sys_common::mutex::MutexGuard<'_>` in the current scope + --> $DIR/issue-54062.rs:10:37 + | +LL | let _ = test.comps.inner.lock().unwrap(); + | ^^^^^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0599, E0616. +For more information about an error, try `rustc --explain E0599`.