Skip to content

Commit

Permalink
Fix ui test.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
m-ou-se committed Sep 27, 2020
1 parent 6f6336b commit 825dda8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/test/ui/issues/issue-54062.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ struct Test {
fn main() {}

fn testing(test: Test) {
let _ = test.comps.inner.lock().unwrap();
let _ = test.comps.inner.try_lock();
//~^ ERROR: field `inner` of struct `Mutex` is private
//~| ERROR: no method named `unwrap` found
}
13 changes: 3 additions & 10 deletions src/test/ui/issues/issue-54062.stderr
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
error[E0616]: field `inner` of struct `Mutex` is private
--> $DIR/issue-54062.rs:10:24
|
LL | let _ = test.comps.inner.lock().unwrap();
LL | let _ = test.comps.inner.try_lock();
| ^^^^^ private field

error[E0599]: no method named `unwrap` found for struct `std::sys_common::mutex::MutexGuard<'_>` in the current scope
--> $DIR/issue-54062.rs:10:37
|
LL | let _ = test.comps.inner.lock().unwrap();
| ^^^^^^ method not found in `std::sys_common::mutex::MutexGuard<'_>`

error: aborting due to 2 previous errors
error: aborting due to previous error

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

0 comments on commit 825dda8

Please sign in to comment.