]> git.lizzy.rs Git - rust.git/commitdiff
Never stop due to errors before borrow checking
authorEsteban Küber <esteban@kuber.com.ar>
Mon, 15 Apr 2019 19:54:18 +0000 (12:54 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Mon, 22 Apr 2019 20:11:53 +0000 (13:11 -0700)
49 files changed:
src/librustc_interface/passes.rs
src/librustc_mir/hair/pattern/check_match.rs
src/librustc_mir/transform/qualify_consts.rs
src/test/ui/borrowck/borrowck-mutate-in-guard.rs
src/test/ui/borrowck/borrowck-mutate-in-guard.stderr
src/test/ui/consts/const_let_refutable.rs
src/test/ui/consts/const_let_refutable.stderr
src/test/ui/consts/match_ice.stderr
src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr
src/test/ui/consts/min_const_fn/cast_errors.stderr
src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr
src/test/ui/consts/min_const_fn/loop_ice.stderr
src/test/ui/consts/min_const_fn/min_const_fn.stderr
src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr
src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr
src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr
src/test/ui/consts/min_const_fn/mutable_borrow.stderr
src/test/ui/consts/single_variant_match_ice.stderr
src/test/ui/empty/empty-never-array.rs
src/test/ui/empty/empty-never-array.stderr
src/test/ui/error-codes/E0007.rs
src/test/ui/error-codes/E0007.stderr
src/test/ui/error-codes/E0030-teach.rs
src/test/ui/error-codes/E0030-teach.stderr
src/test/ui/error-codes/E0301.rs
src/test/ui/error-codes/E0301.stderr
src/test/ui/error-codes/E0302.rs
src/test/ui/error-codes/E0302.stderr
src/test/ui/issues/issue-15381.rs
src/test/ui/issues/issue-15381.stderr
src/test/ui/issues/issue-23302-3.rs
src/test/ui/issues/issue-23302-3.stderr
src/test/ui/issues/issue-37550.stderr
src/test/ui/issues/issue-41255.rs
src/test/ui/issues/issue-41255.stderr
src/test/ui/issues/issue-6804.rs
src/test/ui/issues/issue-6804.stderr
src/test/ui/match/match-range-fail-dominate.stderr
src/test/ui/pattern/pattern-bindings-after-at.rs
src/test/ui/pattern/pattern-bindings-after-at.stderr
src/test/ui/recursion/recursive-types-are-not-uninhabited.rs
src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr
src/test/ui/rfc-2005-default-binding-mode/for.rs
src/test/ui/rfc-2005-default-binding-mode/for.stderr
src/test/ui/rfc1445/match-forbidden-without-eq.rs
src/test/ui/rfc1445/match-forbidden-without-eq.stderr
src/test/ui/unsafe/ranged_ints2_const.stderr

index 2f01254ed5f9b675004bdff9ec0cd9c2c37a5639..9a0497e861ce228dd7dd94c84e3694a97d592f7c 100644 (file)
@@ -936,13 +936,6 @@ fn analysis<'tcx>(
         });
     });
 
-    // Abort so we don't try to construct MIR with liveness errors.
-    // We also won't want to continue with errors from rvalue promotion
-    // We only do so if the only error found so far *isn't* a missing `fn main()`
-    if !(entry_point.is_none() && sess.err_count() == 1) {
-        tcx.sess.abort_if_errors();
-    }
-
     time(sess, "borrow checking", || {
         if tcx.use_ast_borrowck() {
             borrowck::check_crate(tcx);
index 7bfb0a4475ec13bbecb91090672ea7f0fc2bf7d7..e0b9921ca8d6ece421f7ca9daf995b4947a569f2 100644 (file)
@@ -603,7 +603,9 @@ fn check_legality_of_move_bindings(
             E0009,
             "cannot bind by-move and by-ref in the same pattern",
         );
-        err.span_label(by_ref_span.unwrap(), "both by-ref and by-move used");
+        if let Some(by_ref_span) = by_ref_span {
+            err.span_label(by_ref_span, "both by-ref and by-move used");
+        }
         for span in span_vec.iter(){
             err.span_label(*span, "by-move pattern here");
         }
index 88a9566cfd3b9c5303db10a00634bb9f18eef5fd..bbcdd2c1812ae34e91aea2e854b1e9419583b11e 100644 (file)
@@ -1502,9 +1502,11 @@ fn run_pass<'a, 'tcx>(&self,
                                 tcx.sess,
                                 span,
                                 E0723,
-                                "{} (see issue #57563)",
+                                "{}",
                                 err,
                             );
+                            diag.note("for more information, see issue \
+                                       https://github.com/rust-lang/rust/issues/57563");
                             diag.help(
                                 "add #![feature(const_fn)] to the crate attributes to enable",
                             );
index 2bda3deee159658903d97786d335c446619e9028..9ea5e5cd145a0e73340ec37082f4692e1f224a5d 100644 (file)
@@ -9,9 +9,15 @@ fn foo() -> isize {
     match x {
         Enum::A(_) if { x = Enum::B(false); false } => 1,
         //~^ ERROR cannot assign in a pattern guard
+        //~| WARN cannot assign `x` in match guard
+        //~| WARN this error has been downgraded to a warning for backwards compatibility
+        //~| WARN this represents potential undefined behavior in your code and this warning will
         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
         //~^ ERROR cannot mutably borrow in a pattern guard
-        //~^^ ERROR cannot assign in a pattern guard
+        //~| ERROR cannot assign in a pattern guard
+        //~| WARN cannot mutably borrow `x` in match guard
+        //~| WARN this error has been downgraded to a warning for backwards compatibility
+        //~| WARN this represents potential undefined behavior in your code and this warning will
         Enum::A(p) => *p,
         Enum::B(_) => 2,
     }
index f44c76534a2ed11a5a3c7905b86852e3d7f00f3c..d12d751d89b766983824be81dbac8c8421095419 100644 (file)
@@ -5,7 +5,7 @@ LL |         Enum::A(_) if { x = Enum::B(false); false } => 1,
    |                         ^^^^^^^^^^^^^^^^^^ assignment in pattern guard
 
 error[E0301]: cannot mutably borrow in a pattern guard
-  --> $DIR/borrowck-mutate-in-guard.rs:12:38
+  --> $DIR/borrowck-mutate-in-guard.rs:15:38
    |
 LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
    |                                      ^ borrowed mutably in pattern guard
@@ -13,12 +13,35 @@ LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
    = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
 
 error[E0302]: cannot assign in a pattern guard
-  --> $DIR/borrowck-mutate-in-guard.rs:12:41
+  --> $DIR/borrowck-mutate-in-guard.rs:15:41
    |
 LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
    |                                         ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard
 
+warning[E0510]: cannot assign `x` in match guard
+  --> $DIR/borrowck-mutate-in-guard.rs:10:25
+   |
+LL |     match x {
+   |           - value is immutable in match guard
+LL |         Enum::A(_) if { x = Enum::B(false); false } => 1,
+   |                         ^^^^^^^^^^^^^^^^^^ cannot assign
+   |
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
+warning[E0510]: cannot mutably borrow `x` in match guard
+  --> $DIR/borrowck-mutate-in-guard.rs:15:33
+   |
+LL |     match x {
+   |           - value is immutable in match guard
+...
+LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
+   |                                 ^^^^^^ cannot mutably borrow
+   |
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
 error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0301, E0302.
+Some errors have detailed explanations: E0301, E0302, E0510.
 For more information about an error, try `rustc --explain E0301`.
index 345f682868fbc52f6890a70cd28359f7b63046c6..322048c7fbf3f124aa1b77ad583e7d09992cfa07 100644 (file)
@@ -1,5 +1,11 @@
 fn main() {}
 
 const fn slice([a, b]: &[i32]) -> i32 { //~ ERROR refutable pattern in function argument
-    a + b
+    a + b //~ ERROR can only call other `const fn` within a `const fn`
+    //~^ WARN use of possibly uninitialized variable: `a`
+    //~| WARN this error has been downgraded to a warning for backwards compatibility
+    //~| WARN this represents potential undefined behavior in your code and this warning will
+    //~| WARN use of possibly uninitialized variable: `b`
+    //~| WARN this error has been downgraded to a warning for backwards compatibility
+    //~| WARN this represents potential undefined behavior in your code and this warning will
 }
index 155c858af37e691a5584c9a2c61a6e41e99cfe2b..20433bbf8b5c764afecdaab642654234d7d29dd1 100644 (file)
@@ -4,6 +4,34 @@ error[E0005]: refutable pattern in function argument: `&[]` not covered
 LL | const fn slice([a, b]: &[i32]) -> i32 {
    |                ^^^^^^ pattern `&[]` not covered
 
-error: aborting due to previous error
+error[E0723]: can only call other `const fn` within a `const fn`, but `const std::ops::Add::add` is not stable as `const fn`
+  --> $DIR/const_let_refutable.rs:4:5
+   |
+LL |     a + b
+   |     ^^^^^
+   |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
+   = help: add #![feature(const_fn)] to the crate attributes to enable
+
+warning[E0381]: use of possibly uninitialized variable: `a`
+  --> $DIR/const_let_refutable.rs:4:5
+   |
+LL |     a + b
+   |     ^ use of possibly uninitialized `a`
+   |
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
+warning[E0381]: use of possibly uninitialized variable: `b`
+  --> $DIR/const_let_refutable.rs:4:9
+   |
+LL |     a + b
+   |         ^ use of possibly uninitialized `b`
+   |
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0005`.
+Some errors have detailed explanations: E0005, E0381, E0723.
+For more information about an error, try `rustc --explain E0005`.
index e238fad431831c1175babfadbaa545af12b456ca..64f0503242459ef9acb043b8e1603f34c6eaa757 100644 (file)
@@ -1,11 +1,17 @@
 error[E0004]: non-exhaustive patterns: `&S` not covered
-  --> $DIR/match_ice.rs:7:11
+  --> $DIR/match_ice.rs:8:11
    |
 LL |     match C {
    |           ^ pattern `&S` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
 
-error: aborting due to previous error
+error[E0277]: can't compare `S` with `S`
+   |
+   = help: the trait `std::cmp::PartialEq` is not implemented for `S`
+   = note: required because of the requirements on the impl of `std::cmp::PartialEq` for `&S`
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0004`.
+Some errors occurred: E0004, E0277.
+For more information about an error, try `rustc --explain E0004`.
index b0cd57ba2eb4d06043636a8922c32b78889a74df..ac8d082fc19049471de832c7a30bae5fa6588de9 100644 (file)
@@ -1,9 +1,10 @@
-error[E0723]: heap allocations are not allowed in const fn (see issue #57563)
+error[E0723]: heap allocations are not allowed in const fn
   --> $DIR/bad_const_fn_body_ice.rs:2:5
    |
 LL |     vec![1, 2, 3]
    |     ^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
index b5af3e7ee46655ca8d5c44f3aa342a1584102305..b1a50be99835d4c6dc1428f32d6fa3555fea4169 100644 (file)
@@ -1,41 +1,46 @@
-error[E0723]: unsizing casts are not allowed in const fn (see issue #57563)
+error[E0723]: unsizing casts are not allowed in const fn
   --> $DIR/cast_errors.rs:3:41
    |
 LL | const fn unsize(x: &[u8; 3]) -> &[u8] { x }
    |                                         ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
+error[E0723]: function pointers in const fn are unstable
   --> $DIR/cast_errors.rs:5:23
    |
 LL | const fn closure() -> fn() { || {} }
    |                       ^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
+error[E0723]: function pointers in const fn are unstable
   --> $DIR/cast_errors.rs:8:5
    |
 LL |     (|| {}) as fn();
    |     ^^^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
+error[E0723]: function pointers in const fn are unstable
   --> $DIR/cast_errors.rs:11:28
    |
 LL | const fn reify(f: fn()) -> unsafe fn() { f }
    |                            ^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
+error[E0723]: function pointers in const fn are unstable
   --> $DIR/cast_errors.rs:13:21
    |
 LL | const fn reify2() { main as unsafe fn(); }
    |                     ^^^^^^^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error: aborting due to 5 previous errors
index 0de41c65bec08980ee4bd50f4001f6b1ba845783..7f6132ce9cd5e74fef1cc68dc2a831106a8552f2 100644 (file)
@@ -1,9 +1,10 @@
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
+error[E0723]: function pointers in const fn are unstable
   --> $DIR/cmp_fn_pointers.rs:1:14
    |
 LL | const fn cmp(x: fn(), y: fn()) -> bool {
    |              ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error: aborting due to previous error
index 0d35e3635410138819970f2484533aab381bd39c..cb85956266b0e1275b912605b2886686b7d615f3 100644 (file)
@@ -1,9 +1,10 @@
-error[E0723]: loops are not allowed in const fn (see issue #57563)
+error[E0723]: loops are not allowed in const fn
   --> $DIR/loop_ice.rs:2:5
    |
 LL |     loop {}
    |     ^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error: aborting due to previous error
index e4b0d4ee9da505080bac3443a2bc5b30d332994c..7af379924608ff4d15f603b248deb08179cae9c4 100644 (file)
@@ -4,12 +4,13 @@ error[E0493]: destructors cannot be evaluated at compile-time
 LL |     const fn into_inner(self) -> T { self.0 }
    |                         ^^^^ constant functions cannot evaluate destructors
 
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
+error[E0723]: mutable references in const fn are unstable
   --> $DIR/min_const_fn.rs:39:36
    |
 LL |     const fn get_mut(&mut self) -> &mut T { &mut self.0 }
    |                                    ^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error[E0493]: destructors cannot be evaluated at compile-time
@@ -18,12 +19,13 @@ error[E0493]: destructors cannot be evaluated at compile-time
 LL |     const fn into_inner_lt(self) -> T { self.0 }
    |                            ^^^^ constant functions cannot evaluate destructors
 
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
+error[E0723]: mutable references in const fn are unstable
   --> $DIR/min_const_fn.rs:46:42
    |
 LL |     const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
    |                                          ^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error[E0493]: destructors cannot be evaluated at compile-time
@@ -32,228 +34,256 @@ error[E0493]: destructors cannot be evaluated at compile-time
 LL |     const fn into_inner_s(self) -> T { self.0 }
    |                           ^^^^ constant functions cannot evaluate destructors
 
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
+error[E0723]: mutable references in const fn are unstable
   --> $DIR/min_const_fn.rs:53:38
    |
 LL |     const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
    |                                      ^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
+error[E0723]: mutable references in const fn are unstable
   --> $DIR/min_const_fn.rs:58:39
    |
 LL |     const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
    |                                       ^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn.rs:76:16
    |
 LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
    |                ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn.rs:78:18
    |
 LL | const fn foo11_2<T: Send>(t: T) -> T { t }
    |                  ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563)
+error[E0723]: only int, `bool` and `char` operations are stable in const fn
   --> $DIR/min_const_fn.rs:80:33
    |
 LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
    |                                 ^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563)
+error[E0723]: only int, `bool` and `char` operations are stable in const fn
   --> $DIR/min_const_fn.rs:82:35
    |
 LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
    |                                   ^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: only int and `bool` operations are stable in const fn (see issue #57563)
+error[E0723]: only int and `bool` operations are stable in const fn
   --> $DIR/min_const_fn.rs:84:35
    |
 LL | const fn foo19_3(f: f32) -> f32 { -f }
    |                                   ^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563)
+error[E0723]: only int, `bool` and `char` operations are stable in const fn
   --> $DIR/min_const_fn.rs:86:43
    |
 LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
    |                                           ^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: cannot access `static` items in const fn (see issue #57563)
+error[E0723]: cannot access `static` items in const fn
   --> $DIR/min_const_fn.rs:90:27
    |
 LL | const fn foo25() -> u32 { BAR }
    |                           ^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: cannot access `static` items in const fn (see issue #57563)
+error[E0723]: cannot access `static` items in const fn
   --> $DIR/min_const_fn.rs:91:36
    |
 LL | const fn foo26() -> &'static u32 { &BAR }
    |                                    ^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
+error[E0723]: casting pointers to ints is unstable in const fn
   --> $DIR/min_const_fn.rs:92:42
    |
 LL | const fn foo30(x: *const u32) -> usize { x as usize }
    |                                          ^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
+error[E0723]: casting pointers to ints is unstable in const fn
   --> $DIR/min_const_fn.rs:94:63
    |
 LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } }
    |                                                               ^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
+error[E0723]: casting pointers to ints is unstable in const fn
   --> $DIR/min_const_fn.rs:96:42
    |
 LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
    |                                          ^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
+error[E0723]: casting pointers to ints is unstable in const fn
   --> $DIR/min_const_fn.rs:98:63
    |
 LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }
    |                                                               ^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
   --> $DIR/min_const_fn.rs:100:38
    |
 LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
    |                                      ^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
   --> $DIR/min_const_fn.rs:102:29
    |
 LL | const fn foo30_5(b: bool) { while b { } }
    |                             ^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
   --> $DIR/min_const_fn.rs:104:44
    |
 LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
    |                                            ^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
   --> $DIR/min_const_fn.rs:106:44
    |
 LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
    |                                            ^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
+error[E0723]: mutable references in const fn are unstable
   --> $DIR/min_const_fn.rs:108:14
    |
 LL | const fn inc(x: &mut i32) { *x += 1 }
    |              ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn.rs:113:6
    |
 LL | impl<T: std::fmt::Debug> Foo<T> {
    |      ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn.rs:118:6
    |
 LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
    |      ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn.rs:123:6
    |
 LL | impl<T: Sync + Sized> Foo<T> {
    |      ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: `impl Trait` in const fn is unstable (see issue #57563)
+error[E0723]: `impl Trait` in const fn is unstable
   --> $DIR/min_const_fn.rs:129:24
    |
 LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn.rs:131:34
    |
 LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
    |                                  ^^^^^^^^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn.rs:133:22
    |
 LL | const fn no_apit(_x: impl std::fmt::Debug) {}
    |                      ^^^^^^^^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: `impl Trait` in const fn is unstable (see issue #57563)
+error[E0723]: `impl Trait` in const fn is unstable
   --> $DIR/min_const_fn.rs:134:23
    |
 LL | const fn no_rpit() -> impl std::fmt::Debug {}
    |                       ^^^^^^^^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn.rs:135:23
    |
 LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
    |                       ^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn.rs:136:32
    |
 LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 warning[E0515]: cannot return reference to temporary value
@@ -268,28 +298,31 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
    = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
    = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
 
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn.rs:144:41
    |
 LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
    |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
+error[E0723]: function pointers in const fn are unstable
   --> $DIR/min_const_fn.rs:147:21
    |
 LL | const fn no_fn_ptrs(_x: fn()) {}
    |                     ^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
+error[E0723]: function pointers in const fn are unstable
   --> $DIR/min_const_fn.rs:149:27
    |
 LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
    |                           ^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error: aborting due to 36 previous errors
index dc7e92ad40497ce906789e60a952e3d17be2809a..b6445329db383e7dcfd28088b43b9a575a1a2f56 100644 (file)
@@ -1,17 +1,19 @@
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn_dyn.rs:9:5
    |
 LL |     x.0.field;
    |     ^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
+error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> $DIR/min_const_fn_dyn.rs:12:66
    |
 LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
    |                                                                  ^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 warning[E0716]: temporary value dropped while borrowed
index 8838ababe2c0e99adb0eb85a66da361ded04ca42..5316d07afa428c7644d52a02fd19d3ff9fe1f47e 100644 (file)
@@ -1,17 +1,19 @@
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
+error[E0723]: function pointers in const fn are unstable
   --> $DIR/min_const_fn_fn_ptr.rs:11:5
    |
 LL |     x.0.field;
    |     ^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
+error[E0723]: function pointers in const fn are unstable
   --> $DIR/min_const_fn_fn_ptr.rs:14:59
    |
 LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasPtr { field }) }
    |                                                           ^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error: aborting due to 2 previous errors
index c73eda9ab9fc19e54342d20865d741f34683e670..c52d7c85115613ead1b8b33c11ec707adb471a09 100644 (file)
@@ -1,33 +1,37 @@
-error[E0723]: can only call other `const fn` within a `const fn`, but `const foo` is not stable as `const fn` (see issue #57563)
+error[E0723]: can only call other `const fn` within a `const fn`, but `const foo` is not stable as `const fn`
   --> $DIR/min_const_fn_libstd_stability.rs:15:25
    |
 LL | const fn bar() -> u32 { foo() }
    |                         ^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2` is not stable as `const fn` (see issue #57563)
+error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2` is not stable as `const fn`
   --> $DIR/min_const_fn_libstd_stability.rs:22:26
    |
 LL | const fn bar2() -> u32 { foo2() }
    |                          ^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563)
+error[E0723]: only int, `bool` and `char` operations are stable in const fn
   --> $DIR/min_const_fn_libstd_stability.rs:26:26
    |
 LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
    |                          ^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2_gated` is not stable as `const fn` (see issue #57563)
+error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2_gated` is not stable as `const fn`
   --> $DIR/min_const_fn_libstd_stability.rs:34:32
    |
 LL | const fn bar2_gated() -> u32 { foo2_gated() }
    |                                ^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error: aborting due to 4 previous errors
index 87b572dcc46f3cc4bbc41957d4c4639e597bad3f..af39b99e90cc97f7905e2231d98e8e6784961b4a 100644 (file)
@@ -1,33 +1,37 @@
-error[E0723]: can only call other `const fn` within a `const fn`, but `const foo` is not stable as `const fn` (see issue #57563)
+error[E0723]: can only call other `const fn` within a `const fn`, but `const foo` is not stable as `const fn`
   --> $DIR/min_const_unsafe_fn_libstd_stability.rs:15:41
    |
 LL | const unsafe fn bar() -> u32 { unsafe { foo() } }
    |                                         ^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2` is not stable as `const fn` (see issue #57563)
+error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2` is not stable as `const fn`
   --> $DIR/min_const_unsafe_fn_libstd_stability.rs:22:42
    |
 LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } }
    |                                          ^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563)
+error[E0723]: only int, `bool` and `char` operations are stable in const fn
   --> $DIR/min_const_unsafe_fn_libstd_stability.rs:26:33
    |
 LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
    |                                 ^^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2_gated` is not stable as `const fn` (see issue #57563)
+error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2_gated` is not stable as `const fn`
   --> $DIR/min_const_unsafe_fn_libstd_stability.rs:34:48
    |
 LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } }
    |                                                ^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error: aborting due to 4 previous errors
index 5fddc119758844fd3c46308cde24b621a7715847..e4534d9ab98f6e2c93df51847f0b2813e0f6c2f9 100644 (file)
@@ -1,25 +1,28 @@
-error[E0723]: can only call other `const fn` within a `const fn`, but `const foo` is not stable as `const fn` (see issue #57563)
+error[E0723]: can only call other `const fn` within a `const fn`, but `const foo` is not stable as `const fn`
   --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:15:32
    |
 LL | const unsafe fn bar() -> u32 { foo() }
    |                                ^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2` is not stable as `const fn` (see issue #57563)
+error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2` is not stable as `const fn`
   --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:22:33
    |
 LL | const unsafe fn bar2() -> u32 { foo2() }
    |                                 ^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2_gated` is not stable as `const fn` (see issue #57563)
+error[E0723]: can only call other `const fn` within a `const fn`, but `const foo2_gated` is not stable as `const fn`
   --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:30:39
    |
 LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() }
    |                                       ^^^^^^^^^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error: aborting due to 3 previous errors
index a2d67a04170786ab073886bb9f166cf17643e737..ed55849124f274a8e95e60bfb99a17af8707d841 100644 (file)
@@ -1,17 +1,19 @@
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
+error[E0723]: mutable references in const fn are unstable
   --> $DIR/mutable_borrow.rs:3:9
    |
 LL |     let b = &mut a;
    |         ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
+error[E0723]: mutable references in const fn are unstable
   --> $DIR/mutable_borrow.rs:12:13
    |
 LL |         let b = &mut a;
    |             ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error: aborting due to 2 previous errors
index 2c21958f22d7edb62909d54c85eb635ab4085571..b8ad775f1c34fb2c6025e82fd351439d1b045637 100644 (file)
@@ -10,12 +10,13 @@ error[E0019]: constant contains unimplemented expression type
 LL |     x => 42,
    |     ^
 
-error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
+error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
   --> $DIR/single_variant_match_ice.rs:18:13
    |
 LL |             Prob => 0x1,
    |             ^^^^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error: aborting due to 3 previous errors
index 01b99134a445f37ad72ceb92f3b0a3d0eab28814..ce781da7d47e17a099e8d36349352f0af0f78979 100644 (file)
@@ -10,6 +10,9 @@ fn transmute<T, U>(t: T) -> U {
     let Helper::U(u) = Helper::T(t, []);
     //~^ ERROR refutable pattern in local binding: `T(_, _)` not covered
     u
+    //~^ WARN use of possibly uninitialized variable: `u`
+    //~| WARN this error has been downgraded to a warning for backwards compatibility
+    //~| WARN this represents potential undefined behavior in your code and this warning will
 }
 
 fn main() {
index f1be4a6edec5f51a714e9756586625d59c920769..6608ad763b2e94c5f7bfcd90f3ebac419768c0ea 100644 (file)
@@ -11,6 +11,16 @@ LL | | }
 LL |       let Helper::U(u) = Helper::T(t, []);
    |           ^^^^^^^^^^^^ pattern `T(_, _)` not covered
 
+warning[E0381]: use of possibly uninitialized variable: `u`
+  --> $DIR/empty-never-array.rs:12:5
+   |
+LL |     u
+   |     ^ use of possibly uninitialized `u`
+   |
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0005`.
+Some errors have detailed explanations: E0005, E0381.
+For more information about an error, try `rustc --explain E0005`.
index 8fc6342002bb21fd36212ca394ac8f8e3fe683f5..cdda735ba443554f05cde8285a295a8d99b59f1b 100644 (file)
@@ -4,6 +4,7 @@ fn main() {
         op_string @ Some(s) => {},
         //~^ ERROR E0007
         //~| ERROR E0303
+        //~| ERROR E0382
         None => {},
     }
 }
index e290e9c008df24660ca53fa428c03c4e26308c4f..89a6298c8752fbea999b5165e42f071f94610227 100644 (file)
@@ -10,7 +10,19 @@ error[E0303]: pattern bindings are not allowed after an `@`
 LL |         op_string @ Some(s) => {},
    |                          ^ not allowed after `@`
 
-error: aborting due to 2 previous errors
+error[E0382]: use of moved value
+  --> $DIR/E0007.rs:4:26
+   |
+LL |     let x = Some("s".to_string());
+   |         - move occurs because `x` has type `std::option::Option<std::string::String>`, which does not implement the `Copy` trait
+LL |     match x {
+LL |         op_string @ Some(s) => {},
+   |         -----------------^-
+   |         |                |
+   |         |                value used here after move
+   |         value moved here
+
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0007, E0303.
+Some errors have detailed explanations: E0007, E0303, E0382.
 For more information about an error, try `rustc --explain E0007`.
index 388064fb0fae5fb297af896970a75603db1b7abb..8caa4f0931d57d1ae1607f212a8a6d1c394fb21b 100644 (file)
@@ -4,5 +4,6 @@ fn main() {
     match 5u32 {
         1000 ..= 5 => {}
         //~^ ERROR lower range bound must be less than or equal to upper
+        //~| ERROR lower range bound must be less than or equal to upper
     }
 }
index 3f1ad4af3a94e07a2d45b6fb6baf9bec81ff1afb..800f66416a81397f1f770b0e4f6a1bbf3f77b262 100644 (file)
@@ -6,6 +6,12 @@ LL |         1000 ..= 5 => {}
    |
    = note: When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range.
 
-error: aborting due to previous error
+error[E0030]: lower range bound must be less than or equal to upper
+  --> $DIR/E0030-teach.rs:5:9
+   |
+LL |         1000 ..= 5 => {}
+   |         ^^^^ lower bound larger than upper bound
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0030`.
index 54372f8b6b4c5ec28954443a36ea8e30bc0d6825..3b451801c99df5983106f8a6d1cb1212dcfbc354 100644 (file)
@@ -2,6 +2,6 @@ fn main() {
     match Some(()) {
         None => { },
         option if option.take().is_none() => {}, //~ ERROR E0301
-        Some(_) => { }
+        Some(_) => { } //~^ ERROR E0596
     }
 }
index 24234c9929e42cf073be4c2962dc4398c61e61ee..44e823631b592738f05a25f4640bd0dab6596c83 100644 (file)
@@ -6,6 +6,15 @@ LL |         option if option.take().is_none() => {},
    |
    = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
 
-error: aborting due to previous error
+error[E0596]: cannot borrow `option` as mutable, as it is immutable for the pattern guard
+  --> $DIR/E0301.rs:4:19
+   |
+LL |         option if option.take().is_none() => {},
+   |                   ^^^^^^ cannot borrow as mutable
+   |
+   = note: variables bound in patterns are immutable until the end of the pattern guard
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0301`.
+Some errors have detailed explanations: E0301, E0596.
+For more information about an error, try `rustc --explain E0301`.
index 7c76eb30c1d29d7713a8d786753d345963bb1a8c..69f5953deb22335851091b70a59aa1e35b07d4ee 100644 (file)
@@ -2,6 +2,7 @@ fn main() {
     match Some(()) {
         None => { },
         option if { option = None; false } => { }, //~ ERROR E0302
+        //~^ ERROR cannot assign to `option`, as it is immutable for the pattern guard
         Some(_) => { }
     }
 }
index 69ebb6bb9c9fa4e8590114304314dd4b595de3d5..a077fcaea4101c8a3cf36f512157928fbc5b5e83 100644 (file)
@@ -4,6 +4,14 @@ error[E0302]: cannot assign in a pattern guard
 LL |         option if { option = None; false } => { },
    |                     ^^^^^^^^^^^^^ assignment in pattern guard
 
-error: aborting due to previous error
+error[E0594]: cannot assign to `option`, as it is immutable for the pattern guard
+  --> $DIR/E0302.rs:4:21
+   |
+LL |         option if { option = None; false } => { },
+   |                     ^^^^^^^^^^^^^ cannot assign
+   |
+   = note: variables bound in patterns are immutable until the end of the pattern guard
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0302`.
index e58c866119fbb9f43e243665c7666e003000b870..3dbd4e717a0dbd2755cb07f4bcdeb9ad16496a94 100644 (file)
@@ -4,5 +4,8 @@ fn main() {
     for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
         //~^ ERROR refutable pattern in `for` loop binding: `&[]` not covered
         println!("y={}", y);
+        //~^ WARN borrow of possibly uninitialized variable: `y`
+        //~| WARN this error has been downgraded to a warning for backwards compatibility
+        //~| WARN this represents potential undefined behavior in your code and this warning will
     }
 }
index 8152737256c7f1c0c19c0b45c7c7a66817940ddd..0f44a0f170f84939675a23af97d34b5f68839509 100644 (file)
@@ -4,6 +4,16 @@ error[E0005]: refutable pattern in `for` loop binding: `&[]` not covered
 LL |     for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
    |         ^^^^^^^^ pattern `&[]` not covered
 
+warning[E0381]: borrow of possibly uninitialized variable: `y`
+  --> $DIR/issue-15381.rs:6:26
+   |
+LL |         println!("y={}", y);
+   |                          ^ use of possibly uninitialized `y`
+   |
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0005`.
+Some errors have detailed explanations: E0005, E0381.
+For more information about an error, try `rustc --explain E0005`.
index da75f330798865ff2190f84c6009ff253716ee8e..e17c5eea2a4454e7df41607bbed1a4edc7027c9d 100644 (file)
@@ -1,4 +1,5 @@
 const A: i32 = B; //~ ERROR cycle detected
+//~^ ERROR cycle detected
 
 const B: i32 = A;
 
index a7d643987f710293fc124fff8c16d8949a41709a..94624640809b77c5b6e0baed5c84bec7bd2f18b7 100644 (file)
@@ -10,18 +10,36 @@ note: ...which requires checking which parts of `A` are promotable to static...
 LL | const A: i32 = B;
    |                ^
 note: ...which requires const checking if rvalue is promotable to static `B`...
-  --> $DIR/issue-23302-3.rs:3:1
+  --> $DIR/issue-23302-3.rs:4:1
    |
 LL | const B: i32 = A;
    | ^^^^^^^^^^^^^^^^^
 note: ...which requires checking which parts of `B` are promotable to static...
-  --> $DIR/issue-23302-3.rs:3:16
+  --> $DIR/issue-23302-3.rs:4:16
    |
 LL | const B: i32 = A;
    |                ^
    = note: ...which again requires const checking if rvalue is promotable to static `A`, completing the cycle
    = note: cycle used when running analysis passes on this crate
 
-error: aborting due to previous error
+error[E0391]: cycle detected when processing `A`
+  --> $DIR/issue-23302-3.rs:1:16
+   |
+LL | const A: i32 = B;
+   |                ^
+   |
+note: ...which requires processing `B`...
+  --> $DIR/issue-23302-3.rs:4:16
+   |
+LL | const B: i32 = A;
+   |                ^
+   = note: ...which again requires processing `A`, completing the cycle
+note: cycle used when processing `A`
+  --> $DIR/issue-23302-3.rs:1:1
+   |
+LL | const A: i32 = B;
+   | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0391`.
index 41f33a38fbd07b15e6b48d578df176bc7fcc4993..609043942b7d93e2f62892cfef1f0cf8a88e3b93 100644 (file)
@@ -1,9 +1,10 @@
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
+error[E0723]: function pointers in const fn are unstable
   --> $DIR/issue-37550.rs:3:9
    |
 LL |     let x = || t;
    |         ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error: aborting due to previous error
index 395ab8601bcc5fb3cb50e4f81435ff941d0110c1..60fdf7c3e8a479b18b5e7355cb941a6f4fc6fd50 100644 (file)
@@ -9,6 +9,8 @@ fn main() {
     match x {
         5.0 => {}, //~ ERROR floating-point types cannot be used in patterns
                    //~| WARNING hard error
+                   //~| ERROR floating-point types cannot be used in patterns
+                   //~| WARNING this was previously accepted by the compiler but is being
         5.0f32 => {}, //~ ERROR floating-point types cannot be used in patterns
                       //~| WARNING hard error
         -5.0 => {}, //~ ERROR floating-point types cannot be used in patterns
index 9ccfc9a0016054d8e577200f21a7b47c926bab9c..c334742cfc4a46f4f2d7cc9f12f9b69ad769d0b1 100644 (file)
@@ -13,7 +13,7 @@ LL | #![forbid(illegal_floating_point_literal_pattern)]
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
 error: floating-point types cannot be used in patterns
-  --> $DIR/issue-41255.rs:12:9
+  --> $DIR/issue-41255.rs:14:9
    |
 LL |         5.0f32 => {},
    |         ^^^^^^
@@ -22,7 +22,7 @@ LL |         5.0f32 => {},
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
 error: floating-point types cannot be used in patterns
-  --> $DIR/issue-41255.rs:14:10
+  --> $DIR/issue-41255.rs:16:10
    |
 LL |         -5.0 => {},
    |          ^^^
@@ -31,7 +31,7 @@ LL |         -5.0 => {},
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
 error: floating-point types cannot be used in patterns
-  --> $DIR/issue-41255.rs:16:9
+  --> $DIR/issue-41255.rs:18:9
    |
 LL |         1.0 .. 33.0 => {},
    |         ^^^
@@ -40,7 +40,7 @@ LL |         1.0 .. 33.0 => {},
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
 error: floating-point types cannot be used in patterns
-  --> $DIR/issue-41255.rs:16:16
+  --> $DIR/issue-41255.rs:18:16
    |
 LL |         1.0 .. 33.0 => {},
    |                ^^^^
@@ -49,7 +49,7 @@ LL |         1.0 .. 33.0 => {},
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
 error: floating-point types cannot be used in patterns
-  --> $DIR/issue-41255.rs:20:9
+  --> $DIR/issue-41255.rs:22:9
    |
 LL |         39.0 ..= 70.0 => {},
    |         ^^^^
@@ -58,7 +58,7 @@ LL |         39.0 ..= 70.0 => {},
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
 error: floating-point types cannot be used in patterns
-  --> $DIR/issue-41255.rs:20:18
+  --> $DIR/issue-41255.rs:22:18
    |
 LL |         39.0 ..= 70.0 => {},
    |                  ^^^^
@@ -67,7 +67,7 @@ LL |         39.0 ..= 70.0 => {},
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
 error: floating-point types cannot be used in patterns
-  --> $DIR/issue-41255.rs:29:10
+  --> $DIR/issue-41255.rs:31:10
    |
 LL |         (3.14, 1) => {},
    |          ^^^^
@@ -76,7 +76,7 @@ LL |         (3.14, 1) => {},
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
 error: floating-point types cannot be used in patterns
-  --> $DIR/issue-41255.rs:36:18
+  --> $DIR/issue-41255.rs:38:18
    |
 LL |         Foo { x: 2.0 } => {},
    |                  ^^^
@@ -84,5 +84,14 @@ LL |         Foo { x: 2.0 } => {},
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
-error: aborting due to 9 previous errors
+error: floating-point types cannot be used in patterns
+  --> $DIR/issue-41255.rs:10:9
+   |
+LL |         5.0 => {},
+   |         ^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: aborting due to 10 previous errors
 
index da73e2bd397d6cc92cbb17de066174b08be1691f..b4af3581a0de07b44c64fcf1d653e33850a4a049 100644 (file)
@@ -10,6 +10,8 @@ fn main() {
     match x {
         NAN => {}, //~ ERROR floating-point types cannot be used
         //~^ WARN this was previously accepted by the compiler but is being phased out
+        //~| ERROR floating-point types cannot be used in patterns
+        //~| WARN this was previously accepted by the compiler but is being phased out
         _ => {},
     };
 
index 1c251ed8445ff5a27deb131495cdd087ff69ed21..ab4467e5135ed256cbcb20f75b21ca2342869fd9 100644 (file)
@@ -13,7 +13,7 @@ LL | #![deny(illegal_floating_point_literal_pattern)]
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
 error: floating-point types cannot be used in patterns
-  --> $DIR/issue-6804.rs:17:10
+  --> $DIR/issue-6804.rs:19:10
    |
 LL |         [NAN, _] => {},
    |          ^^^
@@ -21,5 +21,14 @@ LL |         [NAN, _] => {},
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
-error: aborting due to 2 previous errors
+error: floating-point types cannot be used in patterns
+  --> $DIR/issue-6804.rs:11:9
+   |
+LL |         NAN => {},
+   |         ^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: aborting due to 3 previous errors
 
index d35394aa38ba076fa267756b8bb3ea58790b5add..0f5ab7fff384050684ab068f5d14fe3c0e9d7119 100644 (file)
@@ -62,5 +62,14 @@ error: unreachable pattern
 LL |       0.02f64 => {}
    |       ^^^^^^^
 
+warning: floating-point types cannot be used in patterns
+  --> $DIR/match-range-fail-dominate.rs:35:7
+   |
+LL |       0.01f64 ... 6.5f64 => {}
+   |       ^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
 error: aborting due to 5 previous errors
 
index 4a24a496857bae691b36c35a878b2639f74c6ac8..20a1d017cdd1818f09b2aa48f47b0dd13993eff8 100644 (file)
@@ -7,6 +7,9 @@ fn main() {
     match &mut Some(1) {
         ref mut z @ &mut Some(ref a) => {
         //~^ ERROR pattern bindings are not allowed after an `@`
+        //~| WARN cannot borrow `_` as immutable because it is also borrowed as mutable
+        //~| WARN this error has been downgraded to a warning for backwards compatibility
+        //~| WARN this represents potential undefined behavior in your code and this warning will
             **z = None;
             println!("{}", *a);
         }
index 7a3883c5854507d919523e33b2df4895108dc250..3a2cffcbf45f08284b8778ccd5e4f8803c269d9b 100644 (file)
@@ -4,6 +4,22 @@ error[E0303]: pattern bindings are not allowed after an `@`
 LL |         ref mut z @ &mut Some(ref a) => {
    |                               ^^^^^ not allowed after `@`
 
+warning[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
+  --> $DIR/pattern-bindings-after-at.rs:8:31
+   |
+LL |         ref mut z @ &mut Some(ref a) => {
+   |         ----------------------^^^^^-
+   |         |                     |
+   |         |                     immutable borrow occurs here
+   |         mutable borrow occurs here
+...
+LL |             **z = None;
+   |             ---------- mutable borrow later used here
+   |
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0303`.
+Some errors have detailed explanations: E0303, E0502.
+For more information about an error, try `rustc --explain E0303`.
index b3e4efb99401f7d1850c8f46bace34ad5d78ac9c..e32f08e999ab74b8cfcd395bb315967f9b4dc8ac 100644 (file)
@@ -6,6 +6,9 @@ fn foo(res: Result<u32, &R>) -> u32 {
     let Ok(x) = res;
     //~^ ERROR refutable pattern
     x
+    //~^ WARN use of possibly uninitialized variable: `x`
+    //~| WARN this error has been downgraded to a warning for backwards compatibility
+    //~| WARN this represents potential undefined behavior in your code and this warning will
 }
 
 fn main() {
index dad98cff452ce208c5cdb8d1ecc8636aae90f982..940ab94a6133233a3ec252989a177d81143506b2 100644 (file)
@@ -4,6 +4,16 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered
 LL |     let Ok(x) = res;
    |         ^^^^^ pattern `Err(_)` not covered
 
+warning[E0381]: use of possibly uninitialized variable: `x`
+  --> $DIR/recursive-types-are-not-uninhabited.rs:8:5
+   |
+LL |     x
+   |     ^ use of possibly uninitialized `x`
+   |
+   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0005`.
+Some errors have detailed explanations: E0005, E0381.
+For more information about an error, try `rustc --explain E0005`.
index 2fa7852635c30287cc15689fc546dc788ad7bcd7..919ae62a182564bd8bea4f14c7aa2e2e531284d6 100644 (file)
@@ -5,5 +5,6 @@ pub fn main() {
     // The below desugars to &(ref n, mut m).
     for (n, mut m) in &tups {
         //~^ ERROR cannot bind by-move and by-ref in the same pattern
+        //~| ERROR cannot move out of borrowed content
     }
 }
index 37aaa9cfd70a0c3264ab9032472a9230e1c8681e..d9a59e63453c2104f7806b186617c6f1abe29730 100644 (file)
@@ -6,6 +6,21 @@ LL |     for (n, mut m) in &tups {
    |          |
    |          both by-ref and by-move used
 
-error: aborting due to previous error
+error[E0507]: cannot move out of borrowed content
+  --> $DIR/for.rs:6:23
+   |
+LL |     for (n, mut m) in &tups {
+   |             -----     ^^^^^ cannot move out of borrowed content
+   |             |
+   |             data moved here
+   |
+note: move occurs because `m` has type `Foo`, which does not implement the `Copy` trait
+  --> $DIR/for.rs:6:13
+   |
+LL |     for (n, mut m) in &tups {
+   |             ^^^^^
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0009`.
+Some errors have detailed explanations: E0009, E0507.
+For more information about an error, try `rustc --explain E0009`.
index 78d799e2b01dbb3aed5e9bb6057ceb378bd3a162..1cca27520618d531e7ce2f964320e1c3f9ad1162 100644 (file)
@@ -20,6 +20,8 @@ fn main() {
         f32::INFINITY => { }
         //~^ WARNING floating-point types cannot be used in patterns
         //~| WARNING will become a hard error in a future release
+        //~| WARNING floating-point types cannot be used in patterns
+        //~| WARNING this was previously accepted by the compiler but is being phased out
         _ => { }
     }
 }
index ebea2f364ec886618806f8e7938e66362aef593b..4ec1e8ddb9533ff62e29c5a33e69f4e0af736ea5 100644 (file)
@@ -14,5 +14,14 @@ LL |         f32::INFINITY => { }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
 
+warning: floating-point types cannot be used in patterns
+  --> $DIR/match-forbidden-without-eq.rs:20:9
+   |
+LL |         f32::INFINITY => { }
+   |         ^^^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
 error: aborting due to previous error
 
index a120e50cab90c640571062a11565f75b33f3205f..6a47c5b14146b0c37b9ea687f60660a95b317056 100644 (file)
@@ -1,17 +1,19 @@
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
+error[E0723]: mutable references in const fn are unstable
   --> $DIR/ranged_ints2_const.rs:11:9
    |
 LL |     let y = &mut x.0;
    |         ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
+error[E0723]: mutable references in const fn are unstable
   --> $DIR/ranged_ints2_const.rs:18:9
    |
 LL |     let y = unsafe { &mut x.0 };
    |         ^
    |
+   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add #![feature(const_fn)] to the crate attributes to enable
 
 error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block