Skip to content

Commit a719d90

Browse files
authored
Rollup merge of #63004 - JohnTitor:add-tests-for-54062, r=Centril
Add test for issue-54062 The ICE is no longer reproduced. Closes #54062
2 parents bc897a5 + 3284472 commit a719d90

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/test/ui/issues/issue-54062.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use std::sync::Mutex;
2+
3+
struct Test {
4+
comps: Mutex<String>,
5+
}
6+
7+
fn main() {}
8+
9+
fn testing(test: Test) {
10+
let _ = test.comps.inner.lock().unwrap();
11+
//~^ ERROR: field `inner` of struct `std::sync::Mutex` is private
12+
//~| ERROR: no method named `unwrap` found
13+
}

src/test/ui/issues/issue-54062.stderr

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0616]: field `inner` of struct `std::sync::Mutex` is private
2+
--> $DIR/issue-54062.rs:10:13
3+
|
4+
LL | let _ = test.comps.inner.lock().unwrap();
5+
| ^^^^^^^^^^^^^^^^
6+
7+
error[E0599]: no method named `unwrap` found for type `std::sys_common::mutex::MutexGuard<'_>` in the current scope
8+
--> $DIR/issue-54062.rs:10:37
9+
|
10+
LL | let _ = test.comps.inner.lock().unwrap();
11+
| ^^^^^^
12+
13+
error: aborting due to 2 previous errors
14+
15+
Some errors have detailed explanations: E0599, E0616.
16+
For more information about an error, try `rustc --explain E0599`.

0 commit comments

Comments
 (0)