about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-08-15 12:35:03 +0000
committerbors <bors@rust-lang.org>2019-08-15 12:35:03 +0000
commitf7af19c279b8b7ea3d2c21fcbd67164af8d5d968 (patch)
tree97262d6fe68846bffd0ebdb303403b4da9ed4ee1 /src/test
parent1cdcea920e56a5d0587307a4c9cf8fff5c77c4bc (diff)
parent6e8fabb4ac16b30c98968b768b860d2c2e1583d8 (diff)
Auto merge of #63592 - Centril:rollup-7c6dg3e, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #63155 (Add UWP MSVC targets)
 - #63165 (Add builtin targets for mips64(el)-unknown-linux-muslabi64)
 - #63306 (Adapt AddRetag for shallow retagging)
 - #63467 (Add Catalyst (iOS apps running on macOS) target)
 - #63546 (Remove uses of `mem::uninitialized()` from cloudabi)
 - #63572 (remove unused Level::PhaseFatal)
 - #63577 (Test HRTB issue accepted by compiler)
 - #63582 (Fix ICE #63226)
 - #63586 (cleanup: Remove `Spanned` where possible)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/mir-opt/retag.rs38
-rw-r--r--src/test/ui/consts/auxiliary/issue-63226.rs14
-rw-r--r--src/test/ui/consts/issue-63226.rs12
-rw-r--r--src/test/ui/issues/issue-50301.rs31
4 files changed, 84 insertions, 11 deletions
diff --git a/src/test/mir-opt/retag.rs b/src/test/mir-opt/retag.rs
index 33ee0fe61b2..db36a1fab5f 100644
--- a/src/test/mir-opt/retag.rs
+++ b/src/test/mir-opt/retag.rs
@@ -1,3 +1,4 @@
+// ignore-wasm32-bare compiled with panic=abort by default
 // ignore-tidy-linelength
 // compile-flags: -Z mir-emit-retag -Z mir-opt-level=0 -Z span_free_formats
 
@@ -11,6 +12,10 @@ impl Test {
     fn foo_shr<'x>(&self, x: &'x i32) -> &'x i32 { x }
 }
 
+impl Drop for Test {
+    fn drop(&mut self) {}
+}
+
 fn main() {
     let mut x = 0;
     {
@@ -60,10 +65,12 @@ fn main() {
 //     ...
 //     bb0: {
 //         ...
-//         _3 = const Test::foo(move _4, move _6) -> bb1;
+//         _3 = const Test::foo(move _4, move _6) -> [return: bb2, unwind: bb3];
 //     }
 //
-//     bb1: {
+//     ...
+//
+//     bb2: {
 //         Retag(_3);
 //         ...
 //         _9 = move _3;
@@ -80,25 +87,20 @@ fn main() {
 //         _12 = move _13 as *mut i32 (Misc);
 //         Retag([raw] _12);
 //         ...
-//         _16 = move _17(move _18) -> bb2;
+//         _16 = move _17(move _18) -> bb5;
 //     }
 //
-//     bb2: {
+//     bb5: {
 //         Retag(_16);
 //         ...
-//         _20 = const Test::foo_shr(move _21, move _23) -> bb3;
-//     }
-//
-//     bb3: {
-//         ...
-//         return;
+//         _20 = const Test::foo_shr(move _21, move _23) -> [return: bb6, unwind: bb7];
 //     }
 //
 //     ...
 // }
 // END rustc.main.EraseRegions.after.mir
 // START rustc.main-{{closure}}.EraseRegions.after.mir
-// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(20), local_id: 72 }], _2: &i32) -> &i32 {
+// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(22), local_id: 72 }], _2: &i32) -> &i32 {
 //     ...
 //     bb0: {
 //         Retag([fn entry] _1);
@@ -113,3 +115,17 @@ fn main() {
 //     }
 // }
 // END rustc.main-{{closure}}.EraseRegions.after.mir
+// START rustc.ptr-real_drop_in_place.Test.SimplifyCfg-make_shim.after.mir
+// fn  std::ptr::real_drop_in_place(_1: &mut Test) -> () {
+//     ...
+//     bb0: {
+//         Retag([raw] _1);
+//         _2 = &mut (*_1);
+//         _3 = const <Test as std::ops::Drop>::drop(move _2) -> bb1;
+//     }
+//
+//     bb1: {
+//         return;
+//     }
+// }
+// END rustc.ptr-real_drop_in_place.Test.SimplifyCfg-make_shim.after.mir
diff --git a/src/test/ui/consts/auxiliary/issue-63226.rs b/src/test/ui/consts/auxiliary/issue-63226.rs
new file mode 100644
index 00000000000..39cc01a415e
--- /dev/null
+++ b/src/test/ui/consts/auxiliary/issue-63226.rs
@@ -0,0 +1,14 @@
+pub struct VTable{
+    state:extern fn(),
+}
+
+impl VTable{
+    pub const fn vtable()->&'static VTable{
+        Self::VTABLE
+    }
+
+    const VTABLE: &'static VTable =
+        &VTable{state};
+}
+
+extern fn state() {}
diff --git a/src/test/ui/consts/issue-63226.rs b/src/test/ui/consts/issue-63226.rs
new file mode 100644
index 00000000000..deec4499008
--- /dev/null
+++ b/src/test/ui/consts/issue-63226.rs
@@ -0,0 +1,12 @@
+// aux-build:issue-63226.rs
+// compile-flags:--extern issue_63226
+// edition:2018
+// build-pass
+// A regression test for issue #63226.
+// Checks if `const fn` is marked as reachable.
+
+use issue_63226::VTable;
+
+static ICE_ICE:&'static VTable=VTable::vtable();
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-50301.rs b/src/test/ui/issues/issue-50301.rs
new file mode 100644
index 00000000000..47ee3e7ad70
--- /dev/null
+++ b/src/test/ui/issues/issue-50301.rs
@@ -0,0 +1,31 @@
+// Tests that HRTBs are correctly accepted -- https://github.com/rust-lang/rust/issues/50301
+// check-pass
+trait Trait
+where
+    for<'a> &'a Self::IntoIter: IntoIterator<Item = u32>,
+{
+    type IntoIter;
+    fn get(&self) -> Self::IntoIter;
+}
+
+struct Impl(Vec<u32>);
+
+impl Trait for Impl {
+    type IntoIter = ImplIntoIter;
+    fn get(&self) -> Self::IntoIter {
+        ImplIntoIter(self.0.clone())
+    }
+}
+
+struct ImplIntoIter(Vec<u32>);
+
+impl<'a> IntoIterator for &'a ImplIntoIter {
+    type Item = <Self::IntoIter as Iterator>::Item;
+    type IntoIter = std::iter::Cloned<std::slice::Iter<'a, u32>>;
+    fn into_iter(self) -> Self::IntoIter {
+        (&self.0).into_iter().cloned()
+    }
+}
+
+fn main() {
+}