about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-10-02 00:48:41 +0000
committerbors <bors@rust-lang.org>2020-10-02 00:48:41 +0000
commitf283d3f02cf3ed261a519afe05cde9e23d1d9278 (patch)
treea7e6921f19e98580b47e0751b7ef50992a49cf5f /src/test
parent66936de05962e7e90adb265fb102042c34c7cbfe (diff)
parent5a7218009ec093f03bc0d2eb3ea2444ed4276f23 (diff)
downloadrust-f283d3f02cf3ed261a519afe05cde9e23d1d9278.tar.gz
rust-f283d3f02cf3ed261a519afe05cde9e23d1d9278.zip
Auto merge of #77436 - JohnTitor:rollup-65dh7rp, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #76851 (Fix 'FIXME' about using NonZeroU32 instead of u32.)
 - #76979 (Improve std::sys::windows::compat)
 - #77111 (Stabilize slice_ptr_range.)
 - #77147 (Split sys_common::Mutex in StaticMutex and MovableMutex.)
 - #77312 (Remove outdated line from `publish_toolstate` hook)
 - #77362 (Fix is_absolute on WASI)
 - #77375 (rustc_metadata: Do not forget to encode inherent impls for foreign types)
 - #77385 (Improve the example for ptr::copy)
 - #77389 (Fix some clippy lints)
 - #77399 (BTreeMap: use Unique::from to avoid a cast where type information exists)
 - #77429 (Link `new` method in `DefautHasher`s doc)

Failed merges:

r? `@ghost`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/extern/auxiliary/extern-types-inherent-impl.rs9
-rw-r--r--src/test/ui/extern/extern-types-inherent-impl.rs23
-rw-r--r--src/test/ui/issues/issue-54062.rs3
-rw-r--r--src/test/ui/issues/issue-54062.stderr13
4 files changed, 28 insertions, 20 deletions
diff --git a/src/test/ui/extern/auxiliary/extern-types-inherent-impl.rs b/src/test/ui/extern/auxiliary/extern-types-inherent-impl.rs
new file mode 100644
index 00000000000..a1efe181843
--- /dev/null
+++ b/src/test/ui/extern/auxiliary/extern-types-inherent-impl.rs
@@ -0,0 +1,9 @@
+#![feature(extern_types)]
+
+extern "C" {
+    pub type CrossCrate;
+}
+
+impl CrossCrate {
+    pub fn foo(&self) {}
+}
diff --git a/src/test/ui/extern/extern-types-inherent-impl.rs b/src/test/ui/extern/extern-types-inherent-impl.rs
index fc98f55dc07..3f09ac7b8c3 100644
--- a/src/test/ui/extern/extern-types-inherent-impl.rs
+++ b/src/test/ui/extern/extern-types-inherent-impl.rs
@@ -1,19 +1,26 @@
-// run-pass
-#![allow(dead_code)]
 // Test that inherent impls can be defined for extern types.
 
+// check-pass
+// aux-build:extern-types-inherent-impl.rs
+
 #![feature(extern_types)]
 
-extern {
-    type A;
+extern crate extern_types_inherent_impl;
+use extern_types_inherent_impl::CrossCrate;
+
+extern "C" {
+    type Local;
 }
 
-impl A {
-    fn foo(&self) { }
+impl Local {
+    fn foo(&self) {}
 }
 
-fn use_foo(x: &A) {
+fn use_foo(x: &Local, y: &CrossCrate) {
+    Local::foo(x);
     x.foo();
+    CrossCrate::foo(y);
+    y.foo();
 }
 
-fn main() { }
+fn main() {}
diff --git a/src/test/ui/issues/issue-54062.rs b/src/test/ui/issues/issue-54062.rs
index 60a9b00d5d4..093d6601d4e 100644
--- a/src/test/ui/issues/issue-54062.rs
+++ b/src/test/ui/issues/issue-54062.rs
@@ -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
 }
diff --git a/src/test/ui/issues/issue-54062.stderr b/src/test/ui/issues/issue-54062.stderr
index e9e8080d467..5361ee1d345 100644
--- a/src/test/ui/issues/issue-54062.stderr
+++ b/src/test/ui/issues/issue-54062.stderr
@@ -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`.