Skip to content

Commit 22b2bd8

Browse files
committed
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.
1 parent 6d34ec1 commit 22b2bd8

16 files changed

+52
-61
lines changed

src/librustc_mir/borrow_check/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,14 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
373373
for err in &mut mbcx.errors_buffer {
374374
if err.is_error() {
375375
err.level = Level::Warning;
376-
err.warn("This error has been downgraded to a warning \
377-
for backwards compatibility with previous releases.\n\
378-
It represents potential unsoundness in your code.\n\
379-
This warning will become a hard error in the future.");
376+
err.warn(
377+
"this error has been downgraded to a warning for backwards \
378+
compatibility with previous releases",
379+
);
380+
err.warn(
381+
"this represents potential undefined behavior in your code and \
382+
this warning will become a hard error in the future",
383+
);
380384
}
381385
}
382386
}

src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ LL | Foo::Y(_, ref mut b) => b,
1010
LL | *a += 1;
1111
| ------- borrow later used here
1212
|
13-
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
14-
It represents potential unsoundness in your code.
15-
This warning will become a hard error in the future.
13+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
14+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
1615

1716
error[E0503]: cannot use `y` because it was mutably borrowed
1817
--> $DIR/borrowck-anon-fields-variant.rs:44:7

src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,8 @@ LL | let p: &'a u8 = &*block.current;
350350
LL | drop(x);
351351
| - mutable borrow later used here
352352
|
353-
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
354-
It represents potential unsoundness in your code.
355-
This warning will become a hard error in the future.
353+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
354+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
356355

357356
warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
358357
--> $DIR/borrowck-describe-lvalue.rs:260:33
@@ -365,9 +364,8 @@ LL | let p : *const u8 = &*(*block).current;
365364
LL | drop(x);
366365
| - mutable borrow later used here
367366
|
368-
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
369-
It represents potential unsoundness in your code.
370-
This warning will become a hard error in the future.
367+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
368+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
371369

372370
error[E0382]: use of moved value: `x`
373371
--> $DIR/borrowck-describe-lvalue.rs:318:22

src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ warning[E0507]: cannot move out of borrowed content
44
LL | (|| { let bar = foo; bar.take() })();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
66
|
7-
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
8-
It represents potential unsoundness in your code.
9-
This warning will become a hard error in the future.
7+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
8+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
109

src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ warning[E0507]: cannot move out of borrowed content
44
LL | (|| { let bar = foo; bar.take() })();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
66
|
7-
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
8-
It represents potential unsoundness in your code.
9-
This warning will become a hard error in the future.
7+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
8+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
109

src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,8 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
199199
| |temporary value created here
200200
| returns a reference to data owned by the current function
201201
|
202-
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
203-
It represents potential unsoundness in your code.
204-
This warning will become a hard error in the future.
202+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
203+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
205204

206205
error: trait bounds other than `Sized` on const fn parameters are unstable
207206
--> $DIR/min_const_fn.rs:147:41

src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
1919
| |creates a temporary which is freed while still in use
2020
| cast requires that borrow lasts for `'static`
2121
|
22-
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
23-
It represents potential unsoundness in your code.
24-
This warning will become a hard error in the future.
22+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
23+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
2524

2625
error: aborting due to 2 previous errors
2726

src/test/ui/issues/issue-40510-1.nll.stderr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ LL | &mut x
88
|
99
= note: `FnMut` closures only have access to their captured variables while they are executing...
1010
= note: ...therefore, they cannot allow references to captured variables to escape
11-
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
12-
It represents potential unsoundness in your code.
13-
This warning will become a hard error in the future.
11+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
12+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
1413

src/test/ui/issues/issue-40510-3.nll.stderr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ LL | | }
1010
|
1111
= note: `FnMut` closures only have access to their captured variables while they are executing...
1212
= note: ...therefore, they cannot allow references to captured variables to escape
13-
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
14-
It represents potential unsoundness in your code.
15-
This warning will become a hard error in the future.
13+
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
14+
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
1615

src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: compilation successful
2-
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:89:1
2+
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:92:1
33
|
44
LL | / fn main() { //[ast]~ ERROR compilation successful
55
LL | | //[migrate]~^ ERROR compilation successful

0 commit comments

Comments
 (0)