]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #63807 - Centril:rollup-b8lo8ct, r=Centril
authorbors <bors@rust-lang.org>
Thu, 22 Aug 2019 18:06:31 +0000 (18:06 +0000)
committerbors <bors@rust-lang.org>
Thu, 22 Aug 2019 18:06:31 +0000 (18:06 +0000)
Rollup of 7 pull requests

Successful merges:

 - #63624 (When declaring a declarative macro in an item it's only accessible inside it)
 - #63737 (Fix naming misspelling)
 - #63767 (Use more optimal Ord implementation for integers)
 - #63782 (Fix confusion in theme picker functions)
 - #63788 (Add amanjeev to rustc-guide toolstate)
 - #63796 (Tweak E0308 on opaque types)
 - #63805 (Apply few Clippy suggestions)

Failed merges:

r? @ghost

19 files changed:
src/build_helper/lib.rs
src/libcore/cmp.rs
src/libcore/iter/adapters/mod.rs
src/libcore/slice/mod.rs
src/librustc/hir/map/mod.rs
src/librustc/infer/error_reporting/mod.rs
src/librustc/ty/error.rs
src/librustc_privacy/lib.rs
src/librustdoc/html/render.rs
src/librustdoc/html/static/main.js
src/test/codegen/integer-cmp.rs [new file with mode: 0644]
src/test/ui/macros/macro-in-fn.rs [new file with mode: 0644]
src/test/ui/non-integer-atomic.rs [new file with mode: 0644]
src/test/ui/non-integer-atomic.stderr [new file with mode: 0644]
src/test/ui/non-interger-atomic.rs [deleted file]
src/test/ui/non-interger-atomic.stderr [deleted file]
src/test/ui/suggestions/opaque-type-error.rs [new file with mode: 0644]
src/test/ui/suggestions/opaque-type-error.stderr [new file with mode: 0644]
src/tools/publish_toolstate.py

index a1aa18922b5c5b9ccac1712c0033ce7e13e959d6..131d2034675e3db0f0897258dd90493c9c87ba38 100644 (file)
@@ -262,7 +262,7 @@ pub fn native_lib_boilerplate(
     if !up_to_date(Path::new("build.rs"), &timestamp) || !up_to_date(src_dir, &timestamp) {
         Ok(NativeLibBoilerplate {
             src_dir: src_dir.to_path_buf(),
-            out_dir: out_dir,
+            out_dir,
         })
     } else {
         Err(())
index cb9feb074dd70d58d51c1b95da226ce662ea16eb..167a9dd1c3620cba039ea33ac1c1b3b996b2d596 100644 (file)
@@ -1012,9 +1012,11 @@ fn gt(&self, other: &$t) -> bool { (*self) > (*other) }
             impl Ord for $t {
                 #[inline]
                 fn cmp(&self, other: &$t) -> Ordering {
-                    if *self == *other { Equal }
-                    else if *self < *other { Less }
-                    else { Greater }
+                    // The order here is important to generate more optimal assembly.
+                    // See <https://github.com/rust-lang/rust/issues/63758> for more info.
+                    if *self < *other { Less }
+                    else if *self > *other { Greater }
+                    else { Equal }
                 }
             }
         )*)
index a63434abd6c9fc172532d5a27f92c3f0cba96c30..f50781890ab225eabc5ea646bbc68e440792fb64 100644 (file)
@@ -1309,7 +1309,7 @@ fn try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R where
         Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Ok=B>
     {
         match self.peeked.take() {
-            Some(None) => return Try::from_ok(init),
+            Some(None) => Try::from_ok(init),
             Some(Some(v)) => match self.iter.try_rfold(init, &mut f).into_result() {
                 Ok(acc) => f(acc, v),
                 Err(e) => {
@@ -1326,7 +1326,7 @@ fn rfold<Acc, Fold>(self, init: Acc, mut fold: Fold) -> Acc
         where Fold: FnMut(Acc, Self::Item) -> Acc,
     {
         match self.peeked {
-            Some(None) => return init,
+            Some(None) => init,
             Some(Some(v)) => {
                 let acc = self.iter.rfold(init, &mut fold);
                 fold(acc, v)
index bfbbb15c8d488a232bb7be0ea2cb2eebb5cbbba8..931768564ca3cf8c5a34fca6a14e376567c4f1eb 100644 (file)
@@ -3026,8 +3026,7 @@ macro_rules! len {
         if size == 0 {
             // This _cannot_ use `unchecked_sub` because we depend on wrapping
             // to represent the length of long ZST slice iterators.
-            let diff = ($self.end as usize).wrapping_sub(start as usize);
-            diff
+            ($self.end as usize).wrapping_sub(start as usize)
         } else {
             // We know that `start <= end`, so can do better than `offset_from`,
             // which needs to deal in signed.  By setting appropriate flags here
index 7292428ec378c62be57090a7e2d7e2532d80e265..f80e527dfd9b70b131778f9f889d690984f690b6 100644 (file)
@@ -514,8 +514,7 @@ pub fn krate_attrs(&self) -> &'hir [ast::Attribute] {
         &self.forest.krate.attrs
     }
 
-    pub fn get_module(&self, module: DefId) -> (&'hir Mod, Span, HirId)
-    {
+    pub fn get_module(&self, module: DefId) -> (&'hir Mod, Span, HirId) {
         let hir_id = self.as_local_hir_id(module).unwrap();
         self.read(hir_id);
         match self.find_entry(hir_id).unwrap().node {
@@ -525,7 +524,7 @@ pub fn get_module(&self, module: DefId) -> (&'hir Mod, Span, HirId)
                 ..
             }) => (m, span, hir_id),
             Node::Crate => (&self.forest.krate.module, self.forest.krate.span, hir_id),
-            _ => panic!("not a module")
+            node => panic!("not a module: {:?}", node),
         }
     }
 
@@ -679,6 +678,16 @@ pub fn is_const_context(&self, hir_id: HirId) -> bool {
         }
     }
 
+    /// Wether `hir_id` corresponds to a `mod` or a crate.
+    pub fn is_hir_id_module(&self, hir_id: HirId) -> bool {
+        match self.lookup(hir_id) {
+            Some(Entry { node: Node::Item(Item { node: ItemKind::Mod(_), .. }), .. }) |
+            Some(Entry { node: Node::Crate, .. }) => true,
+            _ => false,
+        }
+    }
+
+
     /// If there is some error when walking the parents (e.g., a node does not
     /// have a parent in the map or a node can't be found), then we return the
     /// last good `HirId` we found. Note that reaching the crate root (`id == 0`),
index 84687b8cab5c0b9160103167a97ab4a149c7efe6..9be73cf3c6d1645439e9e3af528318a097acdf5f 100644 (file)
@@ -1650,7 +1650,7 @@ fn as_requirement_str(&self) -> &'static str {
                 hir::MatchSource::IfLetDesugar { .. } => "`if let` arms have compatible types",
                 _ => "match arms have compatible types",
             },
-            IfExpression { .. } => "if and else have compatible types",
+            IfExpression { .. } => "if and else have incompatible types",
             IfExpressionWithNoElse => "if missing an else returns ()",
             MainFunctionType => "`main` function has the correct type",
             StartFunctionType => "`start` function has the correct type",
index d6d17a67e01e95ef54529bfdd4eddd790321a612..c70006b68d69aff5f3230a50abde2935206e7c3d 100644 (file)
@@ -247,13 +247,15 @@ pub fn sort_string(&self, tcx: TyCtxt<'_>) -> Cow<'static, str> {
 }
 
 impl<'tcx> TyCtxt<'tcx> {
-    pub fn note_and_explain_type_err(self,
-                                     db: &mut DiagnosticBuilder<'_>,
-                                     err: &TypeError<'tcx>,
-                                     sp: Span) {
+    pub fn note_and_explain_type_err(
+        self,
+        db: &mut DiagnosticBuilder<'_>,
+        err: &TypeError<'tcx>,
+        sp: Span,
+    ) {
         use self::TypeError::*;
 
-        match err.clone() {
+        match err {
             Sorts(values) => {
                 let expected_str = values.expected.sort_string(self);
                 let found_str = values.found.sort_string(self);
@@ -261,6 +263,16 @@ pub fn note_and_explain_type_err(self,
                     db.note("no two closures, even if identical, have the same type");
                     db.help("consider boxing your closure and/or using it as a trait object");
                 }
+                if expected_str == found_str && expected_str == "opaque type" { // Issue #63167
+                    db.note("distinct uses of `impl Trait` result in different opaque types");
+                    let e_str = values.expected.to_string();
+                    let f_str = values.found.to_string();
+                    if &e_str == &f_str && &e_str == "impl std::future::Future" {
+                        // FIXME: use non-string based check.
+                        db.help("if both `Future`s have the same `Output` type, consider \
+                                 `.await`ing on both of them");
+                    }
+                }
                 if let (ty::Infer(ty::IntVar(_)), ty::Float(_)) =
                        (&values.found.sty, &values.expected.sty) // Issue #53280
                 {
index bca77621e553ed304bce307b2e90ed9e5045bb73..146058963b69dd67e549c6f01ae81dd587194ef6 100644 (file)
@@ -508,11 +508,7 @@ fn update_macro_reachable(&mut self, reachable_mod: hir::HirId, defining_mod: De
         }
     }
 
-    fn update_macro_reachable_mod(
-        &mut self,
-        reachable_mod: hir::HirId,
-        defining_mod: DefId,
-    ) {
+    fn update_macro_reachable_mod(&mut self, reachable_mod: hir::HirId, defining_mod: DefId) {
         let module_def_id = self.tcx.hir().local_def_id(reachable_mod);
         let module = self.tcx.hir().get_module(module_def_id).0;
         for item_id in &module.item_ids {
@@ -524,19 +520,13 @@ fn update_macro_reachable_mod(
                 self.update_macro_reachable_def(hir_id, def_kind, vis, defining_mod);
             }
         }
-
         if let Some(exports) = self.tcx.module_exports(module_def_id) {
             for export in exports {
                 if export.vis.is_accessible_from(defining_mod, self.tcx) {
                     if let Res::Def(def_kind, def_id) = export.res {
                         let vis = def_id_visibility(self.tcx, def_id).0;
                         if let Some(hir_id) = self.tcx.hir().as_local_hir_id(def_id) {
-                            self.update_macro_reachable_def(
-                                hir_id,
-                                def_kind,
-                                vis,
-                                defining_mod,
-                            );
+                            self.update_macro_reachable_def(hir_id, def_kind, vis, defining_mod);
                         }
                     }
                 }
@@ -892,10 +882,14 @@ fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef) {
             self.tcx.hir().local_def_id(md.hir_id)
         ).unwrap();
         let mut module_id = self.tcx.hir().as_local_hir_id(macro_module_def_id).unwrap();
+        if !self.tcx.hir().is_hir_id_module(module_id) {
+            // `module_id` doesn't correspond to a `mod`, return early (#63164).
+            return;
+        }
         let level = if md.vis.node.is_pub() { self.get(module_id) } else { None };
         let new_level = self.update(md.hir_id, level);
         if new_level.is_none() {
-            return
+            return;
         }
 
         loop {
index 211c4157da828311a6a4ea70539967c7c9a362ba..b64e74468e6e9e1bac9d0917cec62aa9472d0421 100644 (file)
@@ -876,22 +876,22 @@ fn write_shared(
 var themePicker = document.getElementById("theme-picker");
 
 function showThemeButtonState() {{
-    themes.style.display = "none";
-    themePicker.style.borderBottomRightRadius = "3px";
-    themePicker.style.borderBottomLeftRadius = "3px";
-}}
-
-function hideThemeButtonState() {{
     themes.style.display = "block";
     themePicker.style.borderBottomRightRadius = "0";
     themePicker.style.borderBottomLeftRadius = "0";
 }}
 
+function hideThemeButtonState() {{
+    themes.style.display = "none";
+    themePicker.style.borderBottomRightRadius = "3px";
+    themePicker.style.borderBottomLeftRadius = "3px";
+}}
+
 function switchThemeButtonState() {{
     if (themes.style.display === "block") {{
-        showThemeButtonState();
-    }} else {{
         hideThemeButtonState();
+    }} else {{
+        showThemeButtonState();
     }}
 }};
 
index 82d2c11b2497befb13364d48c7f1c2d5971d37e5..3d0f00095aca3f05a70248c22694954745d16255 100644 (file)
@@ -105,9 +105,9 @@ if (!DOMTokenList.prototype.remove) {
                 sidebar.appendChild(div);
             }
         }
-        var themePicker = document.getElementsByClassName("theme-picker");
-        if (themePicker && themePicker.length > 0) {
-            themePicker[0].style.display = "none";
+        var themePickers = document.getElementsByClassName("theme-picker");
+        if (themePickers && themePickers.length > 0) {
+            themePickers[0].style.display = "none";
         }
     }
 
@@ -123,9 +123,9 @@ if (!DOMTokenList.prototype.remove) {
             filler.remove();
         }
         document.getElementsByTagName("body")[0].style.marginTop = "";
-        var themePicker = document.getElementsByClassName("theme-picker");
-        if (themePicker && themePicker.length > 0) {
-            themePicker[0].style.display = null;
+        var themePickers = document.getElementsByClassName("theme-picker");
+        if (themePickers && themePickers.length > 0) {
+            themePickers[0].style.display = null;
         }
     }
 
diff --git a/src/test/codegen/integer-cmp.rs b/src/test/codegen/integer-cmp.rs
new file mode 100644 (file)
index 0000000..1373b12
--- /dev/null
@@ -0,0 +1,28 @@
+// This is test for more optimal Ord implementation for integers.
+// See <https://github.com/rust-lang/rust/issues/63758> for more info.
+
+// compile-flags: -C opt-level=3
+
+#![crate_type = "lib"]
+
+use std::cmp::Ordering;
+
+// CHECK-LABEL: @cmp_signed
+#[no_mangle]
+pub fn cmp_signed(a: i64, b: i64) -> Ordering {
+// CHECK: icmp slt
+// CHECK: icmp sgt
+// CHECK: zext i1
+// CHECK: select i1
+    a.cmp(&b)
+}
+
+// CHECK-LABEL: @cmp_unsigned
+#[no_mangle]
+pub fn cmp_unsigned(a: u32, b: u32) -> Ordering {
+// CHECK: icmp ult
+// CHECK: icmp ugt
+// CHECK: zext i1
+// CHECK: select i1
+    a.cmp(&b)
+}
diff --git a/src/test/ui/macros/macro-in-fn.rs b/src/test/ui/macros/macro-in-fn.rs
new file mode 100644 (file)
index 0000000..d354fe4
--- /dev/null
@@ -0,0 +1,8 @@
+// run-pass
+#![feature(decl_macro)]
+
+pub fn moo() {
+    pub macro ABC() {{}}
+}
+
+fn main() {}
diff --git a/src/test/ui/non-integer-atomic.rs b/src/test/ui/non-integer-atomic.rs
new file mode 100644 (file)
index 0000000..00d07b7
--- /dev/null
@@ -0,0 +1,90 @@
+#![feature(core_intrinsics)]
+#![allow(warnings)]
+#![crate_type = "rlib"]
+
+use std::intrinsics;
+
+#[derive(Copy, Clone)]
+pub struct Foo(i64);
+pub type Bar = &'static Fn();
+pub type Quux = [u8; 100];
+
+pub unsafe fn test_bool_load(p: &mut bool, v: bool) {
+    intrinsics::atomic_load(p);
+    //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `bool`
+}
+
+pub unsafe fn test_bool_store(p: &mut bool, v: bool) {
+    intrinsics::atomic_store(p, v);
+    //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `bool`
+}
+
+pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) {
+    intrinsics::atomic_xchg(p, v);
+    //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `bool`
+}
+
+pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) {
+    intrinsics::atomic_cxchg(p, v, v);
+    //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
+}
+
+pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) {
+    intrinsics::atomic_load(p);
+    //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `Foo`
+}
+
+pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) {
+    intrinsics::atomic_store(p, v);
+    //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `Foo`
+}
+
+pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) {
+    intrinsics::atomic_xchg(p, v);
+    //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
+}
+
+pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
+    intrinsics::atomic_cxchg(p, v, v);
+    //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
+}
+
+pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
+    intrinsics::atomic_load(p);
+    //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
+}
+
+pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
+    intrinsics::atomic_store(p, v);
+    //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
+}
+
+pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
+    intrinsics::atomic_xchg(p, v);
+    //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
+}
+
+pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
+    intrinsics::atomic_cxchg(p, v, v);
+    //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
+}
+
+pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
+    intrinsics::atomic_load(p);
+    //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
+}
+
+pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) {
+    intrinsics::atomic_store(p, v);
+    //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
+}
+
+pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) {
+    intrinsics::atomic_xchg(p, v);
+    //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
+}
+
+pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
+    intrinsics::atomic_cxchg(p, v, v);
+    //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`
+}
diff --git a/src/test/ui/non-integer-atomic.stderr b/src/test/ui/non-integer-atomic.stderr
new file mode 100644 (file)
index 0000000..b3cf788
--- /dev/null
@@ -0,0 +1,98 @@
+error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `bool`
+  --> $DIR/non-integer-atomic.rs:13:5
+   |
+LL |     intrinsics::atomic_load(p);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `bool`
+  --> $DIR/non-integer-atomic.rs:18:5
+   |
+LL |     intrinsics::atomic_store(p, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `bool`
+  --> $DIR/non-integer-atomic.rs:23:5
+   |
+LL |     intrinsics::atomic_xchg(p, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
+  --> $DIR/non-integer-atomic.rs:28:5
+   |
+LL |     intrinsics::atomic_cxchg(p, v, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `Foo`
+  --> $DIR/non-integer-atomic.rs:33:5
+   |
+LL |     intrinsics::atomic_load(p);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `Foo`
+  --> $DIR/non-integer-atomic.rs:38:5
+   |
+LL |     intrinsics::atomic_store(p, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
+  --> $DIR/non-integer-atomic.rs:43:5
+   |
+LL |     intrinsics::atomic_xchg(p, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
+  --> $DIR/non-integer-atomic.rs:48:5
+   |
+LL |     intrinsics::atomic_cxchg(p, v, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
+  --> $DIR/non-integer-atomic.rs:53:5
+   |
+LL |     intrinsics::atomic_load(p);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
+  --> $DIR/non-integer-atomic.rs:58:5
+   |
+LL |     intrinsics::atomic_store(p, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
+  --> $DIR/non-integer-atomic.rs:63:5
+   |
+LL |     intrinsics::atomic_xchg(p, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
+  --> $DIR/non-integer-atomic.rs:68:5
+   |
+LL |     intrinsics::atomic_cxchg(p, v, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
+  --> $DIR/non-integer-atomic.rs:73:5
+   |
+LL |     intrinsics::atomic_load(p);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
+  --> $DIR/non-integer-atomic.rs:78:5
+   |
+LL |     intrinsics::atomic_store(p, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
+  --> $DIR/non-integer-atomic.rs:83:5
+   |
+LL |     intrinsics::atomic_xchg(p, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`
+  --> $DIR/non-integer-atomic.rs:88:5
+   |
+LL |     intrinsics::atomic_cxchg(p, v, v);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 16 previous errors
+
diff --git a/src/test/ui/non-interger-atomic.rs b/src/test/ui/non-interger-atomic.rs
deleted file mode 100644 (file)
index 00d07b7..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-#![feature(core_intrinsics)]
-#![allow(warnings)]
-#![crate_type = "rlib"]
-
-use std::intrinsics;
-
-#[derive(Copy, Clone)]
-pub struct Foo(i64);
-pub type Bar = &'static Fn();
-pub type Quux = [u8; 100];
-
-pub unsafe fn test_bool_load(p: &mut bool, v: bool) {
-    intrinsics::atomic_load(p);
-    //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `bool`
-}
-
-pub unsafe fn test_bool_store(p: &mut bool, v: bool) {
-    intrinsics::atomic_store(p, v);
-    //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `bool`
-}
-
-pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) {
-    intrinsics::atomic_xchg(p, v);
-    //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `bool`
-}
-
-pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) {
-    intrinsics::atomic_cxchg(p, v, v);
-    //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
-}
-
-pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) {
-    intrinsics::atomic_load(p);
-    //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `Foo`
-}
-
-pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) {
-    intrinsics::atomic_store(p, v);
-    //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `Foo`
-}
-
-pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) {
-    intrinsics::atomic_xchg(p, v);
-    //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
-}
-
-pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
-    intrinsics::atomic_cxchg(p, v, v);
-    //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
-}
-
-pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
-    intrinsics::atomic_load(p);
-    //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
-}
-
-pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
-    intrinsics::atomic_store(p, v);
-    //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
-}
-
-pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
-    intrinsics::atomic_xchg(p, v);
-    //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
-}
-
-pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
-    intrinsics::atomic_cxchg(p, v, v);
-    //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
-}
-
-pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
-    intrinsics::atomic_load(p);
-    //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
-}
-
-pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) {
-    intrinsics::atomic_store(p, v);
-    //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
-}
-
-pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) {
-    intrinsics::atomic_xchg(p, v);
-    //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
-}
-
-pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
-    intrinsics::atomic_cxchg(p, v, v);
-    //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`
-}
diff --git a/src/test/ui/non-interger-atomic.stderr b/src/test/ui/non-interger-atomic.stderr
deleted file mode 100644 (file)
index 7d1130d..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `bool`
-  --> $DIR/non-interger-atomic.rs:13:5
-   |
-LL |     intrinsics::atomic_load(p);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `bool`
-  --> $DIR/non-interger-atomic.rs:18:5
-   |
-LL |     intrinsics::atomic_store(p, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `bool`
-  --> $DIR/non-interger-atomic.rs:23:5
-   |
-LL |     intrinsics::atomic_xchg(p, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
-  --> $DIR/non-interger-atomic.rs:28:5
-   |
-LL |     intrinsics::atomic_cxchg(p, v, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `Foo`
-  --> $DIR/non-interger-atomic.rs:33:5
-   |
-LL |     intrinsics::atomic_load(p);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `Foo`
-  --> $DIR/non-interger-atomic.rs:38:5
-   |
-LL |     intrinsics::atomic_store(p, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
-  --> $DIR/non-interger-atomic.rs:43:5
-   |
-LL |     intrinsics::atomic_xchg(p, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
-  --> $DIR/non-interger-atomic.rs:48:5
-   |
-LL |     intrinsics::atomic_cxchg(p, v, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
-  --> $DIR/non-interger-atomic.rs:53:5
-   |
-LL |     intrinsics::atomic_load(p);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
-  --> $DIR/non-interger-atomic.rs:58:5
-   |
-LL |     intrinsics::atomic_store(p, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
-  --> $DIR/non-interger-atomic.rs:63:5
-   |
-LL |     intrinsics::atomic_xchg(p, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
-  --> $DIR/non-interger-atomic.rs:68:5
-   |
-LL |     intrinsics::atomic_cxchg(p, v, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
-  --> $DIR/non-interger-atomic.rs:73:5
-   |
-LL |     intrinsics::atomic_load(p);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
-  --> $DIR/non-interger-atomic.rs:78:5
-   |
-LL |     intrinsics::atomic_store(p, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
-  --> $DIR/non-interger-atomic.rs:83:5
-   |
-LL |     intrinsics::atomic_xchg(p, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`
-  --> $DIR/non-interger-atomic.rs:88:5
-   |
-LL |     intrinsics::atomic_cxchg(p, v, v);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 16 previous errors
-
diff --git a/src/test/ui/suggestions/opaque-type-error.rs b/src/test/ui/suggestions/opaque-type-error.rs
new file mode 100644 (file)
index 0000000..979bb60
--- /dev/null
@@ -0,0 +1,24 @@
+// edition:2018
+use core::future::Future;
+
+async fn base_thing() -> Result<(), ()> {
+    Ok(())
+}
+
+fn thing_one() -> impl Future<Output = Result<(), ()>> {
+    base_thing()
+}
+
+fn thing_two() -> impl Future<Output = Result<(), ()>> {
+    base_thing()
+}
+
+async fn thing() -> Result<(), ()> {
+    if true {
+        thing_one()
+    } else {
+        thing_two() //~ ERROR if and else have incompatible types
+    }.await
+}
+
+fn main() {}
diff --git a/src/test/ui/suggestions/opaque-type-error.stderr b/src/test/ui/suggestions/opaque-type-error.stderr
new file mode 100644 (file)
index 0000000..3c9ea05
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0308]: if and else have incompatible types
+  --> $DIR/opaque-type-error.rs:20:9
+   |
+LL | /     if true {
+LL | |         thing_one()
+   | |         ----------- expected because of this
+LL | |     } else {
+LL | |         thing_two()
+   | |         ^^^^^^^^^^^ expected opaque type, found a different opaque type
+LL | |     }.await
+   | |_____- if and else have incompatible types
+   |
+   = note: expected type `impl std::future::Future` (opaque type)
+              found type `impl std::future::Future` (opaque type)
+   = note: distinct uses of `impl Trait` result in different opaque types
+   = help: if both `Future`s have the same `Output` type, consider `.await`ing on both of them
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
index b8dcba3afc3a1624c897c8a27028ebc6dec8d8aa..648838d26efe9a9926ab5a88d897f316b6ad8a5d 100755 (executable)
@@ -34,7 +34,7 @@ MAINTAINERS = {
         '@ryankurte @thejpster @therealprof'
     ),
     'edition-guide': '@ehuss @Centril @steveklabnik',
-    'rustc-guide': '@mark-i-m @spastorino'
+    'rustc-guide': '@mark-i-m @spastorino @amanjeev'
 }
 
 REPOS = {