Skip to content

Commit 825dda8

Browse files
committedSep 27, 2020
Fix ui test.
This test checks if the compiler complains about accesing a private field before complaining (or crashing) about the private function on it not marked as stable/unstable. The interface of the internal type (sys_common's Mutex) used for this was changed. With this change, it uses another function to test for the same issue.
1 parent 6f6336b commit 825dda8

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed
 

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ struct Test {
77
fn main() {}
88

99
fn testing(test: Test) {
10-
let _ = test.comps.inner.lock().unwrap();
10+
let _ = test.comps.inner.try_lock();
1111
//~^ ERROR: field `inner` of struct `Mutex` is private
12-
//~| ERROR: no method named `unwrap` found
1312
}

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

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
error[E0616]: field `inner` of struct `Mutex` is private
22
--> $DIR/issue-54062.rs:10:24
33
|
4-
LL | let _ = test.comps.inner.lock().unwrap();
4+
LL | let _ = test.comps.inner.try_lock();
55
| ^^^^^ private field
66

7-
error[E0599]: no method named `unwrap` found for struct `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-
| ^^^^^^ method not found in `std::sys_common::mutex::MutexGuard<'_>`
12-
13-
error: aborting due to 2 previous errors
7+
error: aborting due to previous error
148

15-
Some errors have detailed explanations: E0599, E0616.
16-
For more information about an error, try `rustc --explain E0599`.
9+
For more information about this error, try `rustc --explain E0616`.

0 commit comments

Comments
 (0)
Please sign in to comment.