Skip to content

Commit

Permalink
Add test for issue-54062
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jul 26, 2019
1 parent eedf6ce commit 3284472
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/ui/issues/issue-54062.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use std::sync::Mutex;

struct Test {
comps: Mutex<String>,
}

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
}
16 changes: 16 additions & 0 deletions src/test/ui/issues/issue-54062.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit 3284472

Please sign in to comment.