From 22b2bd8657d5af7375e18620978d3026cfbf9975 Mon Sep 17 00:00:00 2001 From: David Wood Date: Fri, 21 Dec 2018 14:33:15 +0100 Subject: [PATCH] Update migrate warning wording. This commit modifies the wording of the warning for backwards-incompatible changes in migrate mode. The warning messages are changed to be lowercase and not include line-breaks in order to be consistent with other compiler diagnostics. --- src/librustc_mir/borrow_check/mod.rs | 12 +++++++---- .../borrowck-anon-fields-variant.nll.stderr | 5 ++--- .../borrowck-describe-lvalue.ast.nll.stderr | 10 ++++----- .../borrowck-migrate-to-nll.edition.stderr | 5 ++--- .../borrowck-migrate-to-nll.zflag.stderr | 5 ++--- .../min_const_fn/min_const_fn.nll.stderr | 5 ++--- .../min_const_fn/min_const_fn_dyn.nll.stderr | 5 ++--- src/test/ui/issues/issue-40510-1.nll.stderr | 5 ++--- src/test/ui/issues/issue-40510-3.nll.stderr | 5 ++--- ...-45696-scribble-on-boxed-borrow.ast.stderr | 2 +- ...96-scribble-on-boxed-borrow.migrate.stderr | 21 ++++++++----------- ...-45696-scribble-on-boxed-borrow.nll.stderr | 4 ++-- .../issue-45696-scribble-on-boxed-borrow.rs | 9 +++++--- src/test/ui/issues/issue-49824.nll.stderr | 5 ++--- .../match-guards-always-borrow.ast.nll.stderr | 5 ++--- src/test/ui/thread-local-in-ctfe.nll.stderr | 10 ++++----- 16 files changed, 52 insertions(+), 61 deletions(-) diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 99cc4acb5197b..f49e8d89c5ac1 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -373,10 +373,14 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( for err in &mut mbcx.errors_buffer { if err.is_error() { err.level = Level::Warning; - err.warn("This error has been downgraded to a warning \ - for backwards compatibility with previous releases.\n\ - It represents potential unsoundness in your code.\n\ - This warning will become a hard error in the future."); + err.warn( + "this error has been downgraded to a warning for backwards \ + compatibility with previous releases", + ); + err.warn( + "this represents potential undefined behavior in your code and \ + this warning will become a hard error in the future", + ); } } } diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr index 6f72de0edee32..5ea0ce5ba41ed 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr @@ -10,9 +10,8 @@ LL | Foo::Y(_, ref mut b) => b, LL | *a += 1; | ------- borrow later used here | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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[E0503]: cannot use `y` because it was mutably borrowed --> $DIR/borrowck-anon-fields-variant.rs:44:7 diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr index c3aba793f190e..3c457bff7cf7e 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr @@ -350,9 +350,8 @@ LL | let p: &'a u8 = &*block.current; LL | drop(x); | - mutable borrow later used here | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable --> $DIR/borrowck-describe-lvalue.rs:260:33 @@ -365,9 +364,8 @@ LL | let p : *const u8 = &*(*block).current; LL | drop(x); | - mutable borrow later used here | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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[E0382]: use of moved value: `x` --> $DIR/borrowck-describe-lvalue.rs:318:22 diff --git a/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr b/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr index e7dbc6f6e3ba0..032b8ddcbca68 100644 --- a/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr +++ b/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr @@ -4,7 +4,6 @@ warning[E0507]: cannot move out of borrowed content LL | (|| { let bar = foo; bar.take() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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 diff --git a/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr b/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr index e7dbc6f6e3ba0..032b8ddcbca68 100644 --- a/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr +++ b/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr @@ -4,7 +4,6 @@ warning[E0507]: cannot move out of borrowed content LL | (|| { let bar = foo; bar.take() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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 diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr index 6c4e9e0a067d7..916fc3e0d880d 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr @@ -199,9 +199,8 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | |temporary value created here | returns a reference to data owned by the current function | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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: trait bounds other than `Sized` on const fn parameters are unstable --> $DIR/min_const_fn.rs:147:41 diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr index 4ec00a164566a..96abc10420869 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr @@ -19,9 +19,8 @@ LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } | |creates a temporary which is freed while still in use | cast requires that borrow lasts for `'static` | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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 diff --git a/src/test/ui/issues/issue-40510-1.nll.stderr b/src/test/ui/issues/issue-40510-1.nll.stderr index 723b6f3111c62..1601f6d44679a 100644 --- a/src/test/ui/issues/issue-40510-1.nll.stderr +++ b/src/test/ui/issues/issue-40510-1.nll.stderr @@ -8,7 +8,6 @@ LL | &mut x | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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 diff --git a/src/test/ui/issues/issue-40510-3.nll.stderr b/src/test/ui/issues/issue-40510-3.nll.stderr index e8e82ee8fdae2..3c7e60520cc3b 100644 --- a/src/test/ui/issues/issue-40510-3.nll.stderr +++ b/src/test/ui/issues/issue-40510-3.nll.stderr @@ -10,7 +10,6 @@ LL | | } | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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 diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr index 6172a5e35a8d9..8f8105508b3e7 100644 --- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr +++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:89:1 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:92:1 | LL | / fn main() { //[ast]~ ERROR compilation successful LL | | //[migrate]~^ ERROR compilation successful diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr index 00df5c859bf07..7efc9ce744e38 100644 --- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr +++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr @@ -9,12 +9,11 @@ LL | &mut *s.0 //[nll]~ ERROR borrow may still be in use when destructor run LL | } | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:74:5 | LL | fn boxed_scribbled<'a>(s: Box>) -> &'a mut u32 { | -- lifetime `'a` defined here @@ -24,12 +23,11 @@ LL | &mut *(*s).0 //[nll]~ ERROR borrow may still be in use when destructor LL | } | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:83:5 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:85:5 | LL | fn boxed_boxed_scribbled<'a>(s: Box>>) -> &'a mut u32 { | -- lifetime `'a` defined here @@ -39,12 +37,11 @@ LL | &mut *(**s).0 //[nll]~ ERROR borrow may still be in use when destructor LL | } | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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: compilation successful - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:89:1 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:92:1 | LL | / fn main() { //[ast]~ ERROR compilation successful LL | | //[migrate]~^ ERROR compilation successful diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr index 5640dbd4e8c2c..45815fb589c26 100644 --- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr +++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr @@ -10,7 +10,7 @@ LL | } | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait error[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:74:5 | LL | fn boxed_scribbled<'a>(s: Box>) -> &'a mut u32 { | -- lifetime `'a` defined here @@ -21,7 +21,7 @@ LL | } | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait error[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:83:5 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:85:5 | LL | fn boxed_boxed_scribbled<'a>(s: Box>>) -> &'a mut u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs index 2af05172d24db..0d0d22f993fd3 100644 --- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs +++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs @@ -62,7 +62,8 @@ fn boxed_boxed_borrowed_scribble<'a>(s: Box>) -> &'a mut u fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 { &mut *s.0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713] //[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713] - //[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this represents potential undefined behavior in your code } // This, by analogy to previous case, is *also* not okay. @@ -72,7 +73,8 @@ fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 { fn boxed_scribbled<'a>(s: Box>) -> &'a mut u32 { &mut *(*s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713] //[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713] - //[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this represents potential undefined behavior in your code } // This, by analogy to previous case, is *also* not okay. @@ -82,7 +84,8 @@ fn boxed_scribbled<'a>(s: Box>) -> &'a mut u32 { fn boxed_boxed_scribbled<'a>(s: Box>>) -> &'a mut u32 { &mut *(**s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713] //[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713] - //[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this represents potential undefined behavior in your code } #[rustc_error] diff --git a/src/test/ui/issues/issue-49824.nll.stderr b/src/test/ui/issues/issue-49824.nll.stderr index 555558c99d933..2300d84a3ff2b 100644 --- a/src/test/ui/issues/issue-49824.nll.stderr +++ b/src/test/ui/issues/issue-49824.nll.stderr @@ -10,9 +10,8 @@ LL | | } | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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: compilation successful --> $DIR/issue-49824.rs:18:1 diff --git a/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr b/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr index afb85c69990f9..46c26d2fd2dc0 100644 --- a/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr +++ b/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr @@ -4,9 +4,8 @@ warning[E0507]: cannot move out of borrowed content LL | (|| { let bar = foo; bar.take() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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: compilation successful --> $DIR/match-guards-always-borrow.rs:57:1 diff --git a/src/test/ui/thread-local-in-ctfe.nll.stderr b/src/test/ui/thread-local-in-ctfe.nll.stderr index 05f8f34338003..83502bac4469f 100644 --- a/src/test/ui/thread-local-in-ctfe.nll.stderr +++ b/src/test/ui/thread-local-in-ctfe.nll.stderr @@ -18,9 +18,8 @@ LL | static C: &u32 = &A; | | | thread-local variables cannot be borrowed beyond the end of the function | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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[E0625]: thread-local statics cannot be accessed at compile-time --> $DIR/thread-local-in-ctfe.rs:22:16 @@ -42,9 +41,8 @@ LL | const E: &u32 = &A; | | | thread-local variables cannot be borrowed beyond the end of the function | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = 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[E0625]: thread-local statics cannot be accessed at compile-time --> $DIR/thread-local-in-ctfe.rs:29:5