mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-27 06:14:55 +00:00
Add test for issue-54062
This commit is contained in:
parent
eedf6ce4ef
commit
328447279d
13
src/test/ui/issues/issue-54062.rs
Normal file
13
src/test/ui/issues/issue-54062.rs
Normal file
@ -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
src/test/ui/issues/issue-54062.stderr
Normal file
16
src/test/ui/issues/issue-54062.stderr
Normal file
@ -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`.
|
Loading…
Reference in New Issue
Block a user