about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-05-05 02:51:41 +0000
committerbors <bors@rust-lang.org>2020-05-05 02:51:41 +0000
commit04689e22e946879f2f5e2c73849d2f4e1f2b4b32 (patch)
treeff298794d1db2312cfc0fe0f29fbb9d2cb8c01f6 /src/test
parent2454a68cfbb63aa7b8e09fe05114d5f98b2f9740 (diff)
parent8b781b0ffdc751924520f5a705c4e60e7dd4ab36 (diff)
downloadrust-04689e22e946879f2f5e2c73849d2f4e1f2b4b32.tar.gz
rust-04689e22e946879f2f5e2c73849d2f4e1f2b4b32.zip
Auto merge of #71907 - Dylan-DPC:rollup-z8iaqlv, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #71587 (Report cannot move errors in promoted MIR)
 - #71711 (Updates to some ignored tests)
 - #71845 (Add const examples)
 - #71878 (Add remove_current_as_list to LinkedList's CursorMut)
 - #71881 (Correctly handle UEFI targets as Windows-like when emitting sections for LLVM bitcode)
 - #71883 (add a missing "at" in a comment)
 - #71891 (¬∃x. ¬y => ∀x. y)
 - #71892 (Update btree_map::VacantEntry::insert docs to actually call insert)
 - #71902 (Suggest to add missing feature when using gated const features)
 - #71904 (fix typo in function name)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc/auxiliary/issue-27362-aux.rs (renamed from src/test/rustdoc/auxiliary/issue-27362.rs)0
-rw-r--r--src/test/rustdoc/issue-27362.rs14
-rw-r--r--src/test/ui/borrowck/move-error-in-promoted-2.rs10
-rw-r--r--src/test/ui/borrowck/move-error-in-promoted-2.stderr12
-rw-r--r--src/test/ui/borrowck/move-error-in-promoted.rs17
-rw-r--r--src/test/ui/borrowck/move-error-in-promoted.stderr12
-rw-r--r--src/test/ui/check-static-values-constraints.stderr14
-rw-r--r--src/test/ui/const-suggest-feature.rs9
-rw-r--r--src/test/ui/const-suggest-feature.stderr21
-rw-r--r--src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr2
-rw-r--r--src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr2
-rw-r--r--src/test/ui/consts/const_let_assign3.stderr4
-rw-r--r--src/test/ui/consts/projection_qualif.stock.stderr2
-rw-r--r--src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr2
-rw-r--r--src/test/ui/error-codes/E0010-teach.stderr1
-rw-r--r--src/test/ui/error-codes/E0010.stderr2
-rw-r--r--src/test/ui/error-codes/E0017.stderr2
-rw-r--r--src/test/ui/error-codes/E0388.stderr2
-rw-r--r--src/test/ui/fully-qualified-type/fully-qualified-type-name3.rs14
-rw-r--r--src/test/ui/issues/issue-17025.rs13
-rw-r--r--src/test/ui/issues/issue-7364.stderr2
-rw-r--r--src/test/ui/static/static-mut-not-constant.stderr2
22 files changed, 125 insertions, 34 deletions
diff --git a/src/test/rustdoc/auxiliary/issue-27362.rs b/src/test/rustdoc/auxiliary/issue-27362-aux.rs
index 077bdc33e66..077bdc33e66 100644
--- a/src/test/rustdoc/auxiliary/issue-27362.rs
+++ b/src/test/rustdoc/auxiliary/issue-27362-aux.rs
diff --git a/src/test/rustdoc/issue-27362.rs b/src/test/rustdoc/issue-27362.rs
index 3f3878350d5..1cbba4b663d 100644
--- a/src/test/rustdoc/issue-27362.rs
+++ b/src/test/rustdoc/issue-27362.rs
@@ -1,10 +1,10 @@
-// aux-build:issue-27362.rs
+// aux-build:issue-27362-aux.rs
 // ignore-cross-compile
-// ignore-test This test fails on beta/stable #32019
 
-extern crate issue_27362;
-pub use issue_27362 as quux;
+extern crate issue_27362_aux;
 
-// @matches issue_27362/quux/fn.foo.html '//pre' "pub const fn foo()"
-// @matches issue_27362/quux/fn.bar.html '//pre' "pub const unsafe fn bar()"
-// @matches issue_27362/quux/struct.Foo.html '//code' "const unsafe fn baz()"
+pub use issue_27362_aux::*;
+
+// @matches issue_27362/fn.foo.html '//pre' "pub const fn foo()"
+// @matches issue_27362/fn.bar.html '//pre' "pub const unsafe fn bar()"
+// @matches issue_27362/struct.Foo.html '//code' "const unsafe fn baz()"
diff --git a/src/test/ui/borrowck/move-error-in-promoted-2.rs b/src/test/ui/borrowck/move-error-in-promoted-2.rs
new file mode 100644
index 00000000000..13da34f3922
--- /dev/null
+++ b/src/test/ui/borrowck/move-error-in-promoted-2.rs
@@ -0,0 +1,10 @@
+// Regression test for #70934
+
+struct S;
+
+fn foo() {
+    &([S][0],);
+    //~^ ERROR cannot move out of type `[S; 1]`
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/move-error-in-promoted-2.stderr b/src/test/ui/borrowck/move-error-in-promoted-2.stderr
new file mode 100644
index 00000000000..38dba94bdd4
--- /dev/null
+++ b/src/test/ui/borrowck/move-error-in-promoted-2.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[S; 1]`, a non-copy array
+  --> $DIR/move-error-in-promoted-2.rs:6:7
+   |
+LL |     &([S][0],);
+   |       ^^^^^^
+   |       |
+   |       cannot move out of here
+   |       move occurs because value has type `S`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/borrowck/move-error-in-promoted.rs b/src/test/ui/borrowck/move-error-in-promoted.rs
new file mode 100644
index 00000000000..b94db645131
--- /dev/null
+++ b/src/test/ui/borrowck/move-error-in-promoted.rs
@@ -0,0 +1,17 @@
+// Regression test for #70934
+
+fn f() {
+    const C: [S2; 1] = [S2];
+    let _ = S1(C[0]).clone();
+    //~^ ERROR cannot move out of type `[S2; 1]`
+}
+
+#[derive(Clone)]
+struct S1(S2);
+
+#[derive(Clone)]
+struct S2;
+
+fn main() {
+    f();
+}
diff --git a/src/test/ui/borrowck/move-error-in-promoted.stderr b/src/test/ui/borrowck/move-error-in-promoted.stderr
new file mode 100644
index 00000000000..a4432e38da0
--- /dev/null
+++ b/src/test/ui/borrowck/move-error-in-promoted.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[S2; 1]`, a non-copy array
+  --> $DIR/move-error-in-promoted.rs:5:16
+   |
+LL |     let _ = S1(C[0]).clone();
+   |                ^^^^
+   |                |
+   |                cannot move out of here
+   |                move occurs because value has type `S2`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/check-static-values-constraints.stderr b/src/test/ui/check-static-values-constraints.stderr
index 7d7ecbd1a26..6b5a739899c 100644
--- a/src/test/ui/check-static-values-constraints.stderr
+++ b/src/test/ui/check-static-values-constraints.stderr
@@ -18,6 +18,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL | static STATIC11: Box<MyOwned> = box MyOwned;
    |                                     ^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
   --> $DIR/check-static-values-constraints.rs:90:32
@@ -36,6 +38,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL |     box MyOwned,
    |         ^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error[E0010]: allocations are not allowed in statics
   --> $DIR/check-static-values-constraints.rs:97:5
@@ -48,6 +52,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL |     box MyOwned,
    |         ^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error[E0010]: allocations are not allowed in statics
   --> $DIR/check-static-values-constraints.rs:102:6
@@ -60,6 +66,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL |     &box MyOwned,
    |          ^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error[E0010]: allocations are not allowed in statics
   --> $DIR/check-static-values-constraints.rs:104:6
@@ -72,6 +80,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL |     &box MyOwned,
    |          ^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error[E0010]: allocations are not allowed in statics
   --> $DIR/check-static-values-constraints.rs:111:5
@@ -84,6 +94,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL |     box 3;
    |         ^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error[E0507]: cannot move out of static item `x`
   --> $DIR/check-static-values-constraints.rs:116:45
@@ -105,6 +117,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL |     let y = { static x: Box<isize> = box 3; x };
    |                                          ^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error: aborting due to 17 previous errors
 
diff --git a/src/test/ui/const-suggest-feature.rs b/src/test/ui/const-suggest-feature.rs
new file mode 100644
index 00000000000..89fafbbe6f0
--- /dev/null
+++ b/src/test/ui/const-suggest-feature.rs
@@ -0,0 +1,9 @@
+const WRITE: () = unsafe {
+    *std::ptr::null_mut() = 0;
+    //~^ ERROR dereferencing raw pointers in constants is unstable
+    //~| HELP add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable
+    //~| ERROR constant contains unimplemented expression type
+    //~| HELP add `#![feature(const_mut_refs)]` to the crate attributes to enable
+};
+
+fn main() {}
diff --git a/src/test/ui/const-suggest-feature.stderr b/src/test/ui/const-suggest-feature.stderr
new file mode 100644
index 00000000000..6b91df6b42d
--- /dev/null
+++ b/src/test/ui/const-suggest-feature.stderr
@@ -0,0 +1,21 @@
+error[E0658]: dereferencing raw pointers in constants is unstable
+  --> $DIR/const-suggest-feature.rs:2:5
+   |
+LL |     *std::ptr::null_mut() = 0;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #51911 <https://github.com/rust-lang/rust/issues/51911> for more information
+   = help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable
+
+error[E0019]: constant contains unimplemented expression type
+  --> $DIR/const-suggest-feature.rs:2:5
+   |
+LL |     *std::ptr::null_mut() = 0;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0019, E0658.
+For more information about an error, try `rustc --explain E0019`.
diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr
index 148b1210d39..14dcc074639 100644
--- a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr
+++ b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr
@@ -3,6 +3,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL |     *FOO.0.get() = 5;
    |     ^^^^^^^^^^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr b/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr
index 50cd3214507..44ae1ecf047 100644
--- a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr
+++ b/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr
@@ -3,6 +3,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL |     *FOO.0.get() = 5;
    |     ^^^^^^^^^^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
   --> $DIR/mod-static-with-const-fn.rs:21:5
diff --git a/src/test/ui/consts/const_let_assign3.stderr b/src/test/ui/consts/const_let_assign3.stderr
index 5e2a85cc03d..62fd04ea522 100644
--- a/src/test/ui/consts/const_let_assign3.stderr
+++ b/src/test/ui/consts/const_let_assign3.stderr
@@ -3,6 +3,8 @@ error[E0019]: constant function contains unimplemented expression type
    |
 LL |         self.state = x;
    |         ^^^^^^^^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error[E0658]: references in constants may only refer to immutable values
   --> $DIR/const_let_assign3.rs:16:5
@@ -27,6 +29,8 @@ error[E0019]: constant contains unimplemented expression type
    |
 LL |     *y = 42;
    |     ^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/consts/projection_qualif.stock.stderr b/src/test/ui/consts/projection_qualif.stock.stderr
index 75625a4bd1b..cfa48d947c9 100644
--- a/src/test/ui/consts/projection_qualif.stock.stderr
+++ b/src/test/ui/consts/projection_qualif.stock.stderr
@@ -21,6 +21,8 @@ error[E0019]: constant contains unimplemented expression type
    |
 LL |         unsafe { *b = 5; }
    |                  ^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr b/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr
index c70431886e8..cc169351bf2 100644
--- a/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr
+++ b/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr
@@ -12,6 +12,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; };
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/error-codes/E0010-teach.stderr b/src/test/ui/error-codes/E0010-teach.stderr
index 4c9d140692a..c15ab5c655a 100644
--- a/src/test/ui/error-codes/E0010-teach.stderr
+++ b/src/test/ui/error-codes/E0010-teach.stderr
@@ -12,6 +12,7 @@ error[E0019]: constant contains unimplemented expression type
 LL | const CON : Box<i32> = box 0;
    |                            ^
    |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
    = note: A function call isn't allowed in the const's initialization expression because the expression's value must be known at compile-time.
    = note: Remember: you can't use a function call inside a const's initialization expression! However, you can use it anywhere else.
 
diff --git a/src/test/ui/error-codes/E0010.stderr b/src/test/ui/error-codes/E0010.stderr
index 48472d8acda..f49fb9c4632 100644
--- a/src/test/ui/error-codes/E0010.stderr
+++ b/src/test/ui/error-codes/E0010.stderr
@@ -9,6 +9,8 @@ error[E0019]: constant contains unimplemented expression type
    |
 LL | const CON : Box<i32> = box 0;
    |                            ^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr
index 2e687c18ed3..f959ad0d008 100644
--- a/src/test/ui/error-codes/E0017.stderr
+++ b/src/test/ui/error-codes/E0017.stderr
@@ -12,6 +12,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL | static STATIC_REF: &'static mut i32 = &mut X;
    |                                       ^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error[E0658]: references in statics may only refer to immutable values
   --> $DIR/E0017.rs:6:39
diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr
index 52822ebdd9e..8bdfbac3681 100644
--- a/src/test/ui/error-codes/E0388.stderr
+++ b/src/test/ui/error-codes/E0388.stderr
@@ -12,6 +12,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL | static STATIC_REF: &'static mut i32 = &mut X;
    |                                       ^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error[E0658]: references in statics may only refer to immutable values
   --> $DIR/E0388.rs:5:39
diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name3.rs b/src/test/ui/fully-qualified-type/fully-qualified-type-name3.rs
deleted file mode 100644
index 22faa66d9fb..00000000000
--- a/src/test/ui/fully-qualified-type/fully-qualified-type-name3.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Test that we use fully-qualified type names in error messages.
-
-// ignore-test
-
-type T1 = usize;
-type T2 = isize;
-
-fn bar(x: T1) -> T2 {
-    return x;
-    //~^ ERROR mismatched types: expected `T2`, found `T1`
-}
-
-fn main() {
-}
diff --git a/src/test/ui/issues/issue-17025.rs b/src/test/ui/issues/issue-17025.rs
deleted file mode 100644
index 6b7b6d010aa..00000000000
--- a/src/test/ui/issues/issue-17025.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// ignore-test the unsized enum no longer compiles
-
-enum A {
-    B(char),
-    C([Box<A>]),
-}
-
-fn c(c:char) {
-    A::B(c);
-    //~^ ERROR cannot move a value of type A: the size of A cannot be statically determined
-}
-
-pub fn main() {}
diff --git a/src/test/ui/issues/issue-7364.stderr b/src/test/ui/issues/issue-7364.stderr
index 1f1079555a9..efff2c24525 100644
--- a/src/test/ui/issues/issue-7364.stderr
+++ b/src/test/ui/issues/issue-7364.stderr
@@ -9,6 +9,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL | static boxed: Box<RefCell<isize>> = box RefCell::new(0);
    |                                         ^^^^^^^^^^^^^^^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error[E0277]: `std::cell::RefCell<isize>` cannot be shared between threads safely
   --> $DIR/issue-7364.rs:6:1
diff --git a/src/test/ui/static/static-mut-not-constant.stderr b/src/test/ui/static/static-mut-not-constant.stderr
index 3560be0e29e..a618b49d108 100644
--- a/src/test/ui/static/static-mut-not-constant.stderr
+++ b/src/test/ui/static/static-mut-not-constant.stderr
@@ -9,6 +9,8 @@ error[E0019]: static contains unimplemented expression type
    |
 LL | static mut a: Box<isize> = box 3;
    |                                ^
+   |
+   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
 error: aborting due to 2 previous errors