Skip to content

Commit 6402797

Browse files
authored
Rollup merge of rust-lang#45398 - integer32llc:reassignment, r=arielb1
Correct misspelling in error text: re-assignment => reassignment [reassignment is the correct spelling](https://www.thefreedictionary.com/reassignment) rather than re-assignment; this error message looks silly in the book next to text trying to be grammatically correct :-/ Will this cause any stability/backcompat type issues?
2 parents fc48893 + 0e46cf4 commit 6402797

10 files changed

+21
-21
lines changed

src/librustc_borrowck/borrowck/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
744744
let mut err = self.cannot_reassign_immutable(span,
745745
&self.loan_path_to_string(lp),
746746
Origin::Ast);
747-
err.span_label(span, "re-assignment of immutable variable");
747+
err.span_label(span, "cannot assign twice to immutable variable");
748748
if span != assign.span {
749749
err.span_label(assign.span, format!("first assignment to `{}`",
750750
self.loan_path_to_string(lp)));

src/librustc_mir/borrow_check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
11611161
self.tcx.cannot_reassign_immutable(span,
11621162
&self.describe_lvalue(lvalue),
11631163
Origin::Mir)
1164-
.span_label(span, "re-assignment of immutable variable")
1164+
.span_label(span, "cannot assign twice to immutable variable")
11651165
.span_label(assigned_span, format!("first assignment to `{}`",
11661166
self.describe_lvalue(lvalue)))
11671167
.emit();

src/librustc_mir/util/borrowck_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ pub trait BorrowckErrors {
232232
-> DiagnosticBuilder
233233
{
234234
struct_span_err!(self, span, E0384,
235-
"re-assignment of immutable variable `{}`{OGN}",
235+
"cannot assign twice to immutable variable `{}`{OGN}",
236236
desc, OGN=o)
237237
}
238238

src/test/compile-fail/asm-out-assign-imm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ pub fn main() {
2727
foo(x);
2828
unsafe {
2929
asm!("mov $1, $0" : "=r"(x) : "r"(5));
30-
//~^ ERROR re-assignment of immutable variable `x`
31-
//~| NOTE re-assignment of immutable
30+
//~^ ERROR cannot assign twice to immutable variable `x`
31+
//~| NOTE cannot assign twice to immutable
3232
}
3333
foo(x);
3434
}

src/test/compile-fail/assign-imm-local-twice.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ fn test() {
1212
let v: isize;
1313
v = 1; //~ NOTE first assignment
1414
println!("v={}", v);
15-
v = 2; //~ ERROR re-assignment of immutable variable
16-
//~| NOTE re-assignment of immutable
15+
v = 2; //~ ERROR cannot assign twice to immutable variable
16+
//~| NOTE cannot assign twice to immutable
1717
println!("v={}", v);
1818
}
1919

src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,39 @@ struct S {
2626
pub fn main() {
2727
match 1 {
2828
x => {
29-
x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
29+
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
3030
//[mir]~^ ERROR (Mir) [E0384]
3131
//[mir]~| ERROR (Ast) [E0384]
3232
}
3333
}
3434

3535
match E::Foo(1) {
3636
E::Foo(x) => {
37-
x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
37+
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
3838
//[mir]~^ ERROR (Mir) [E0384]
3939
//[mir]~| ERROR (Ast) [E0384]
4040
}
4141
}
4242

4343
match (S { bar: 1 }) {
4444
S { bar: x } => {
45-
x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
45+
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
4646
//[mir]~^ ERROR (Mir) [E0384]
4747
//[mir]~| ERROR (Ast) [E0384]
4848
}
4949
}
5050

5151
match (1,) {
5252
(x,) => {
53-
x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
53+
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
5454
//[mir]~^ ERROR (Mir) [E0384]
5555
//[mir]~| ERROR (Ast) [E0384]
5656
}
5757
}
5858

5959
match [1,2,3] {
6060
[x,_,_] => {
61-
x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
61+
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
6262
//[mir]~^ ERROR (Mir) [E0384]
6363
//[mir]~| ERROR (Ast) [E0384]
6464
}

src/test/compile-fail/liveness-assign-imm-local-in-loop.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
fn test() {
1212
let v: isize;
1313
loop {
14-
v = 1; //~ ERROR re-assignment of immutable variable
15-
//~^ NOTE re-assignment of immutable variable
14+
v = 1; //~ ERROR cannot assign twice to immutable variable
15+
//~^ NOTE cannot assign twice to immutable variable
1616
v.clone(); // just to prevent liveness warnings
1717
}
1818
}

src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
fn test() {
1212
let v: isize;
1313
v = 2; //~ NOTE first assignment
14-
v += 1; //~ ERROR re-assignment of immutable variable
15-
//~| NOTE re-assignment of immutable
14+
v += 1; //~ ERROR cannot assign twice to immutable variable
15+
//~| NOTE cannot assign twice to immutable
1616
v.clone();
1717
}
1818

src/test/compile-fail/liveness-assign-imm-local-with-init.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
fn test() {
1212
let v: isize = 1; //~ NOTE first assignment
1313
v.clone();
14-
v = 2; //~ ERROR re-assignment of immutable variable
15-
//~| NOTE re-assignment of immutable
14+
v = 2; //~ ERROR cannot assign twice to immutable variable
15+
//~| NOTE cannot assign twice to immutable
1616
v.clone();
1717
}
1818

src/test/compile-fail/mut-pattern-internal-mutability.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ fn main() {
1515
let foo = &mut 1;
1616

1717
let &mut x = foo;
18-
x += 1; //[ast]~ ERROR re-assignment of immutable variable
19-
//[mir]~^ ERROR re-assignment of immutable variable `x` (Ast)
20-
//[mir]~| ERROR re-assignment of immutable variable `x` (Mir)
18+
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable
19+
//[mir]~^ ERROR cannot assign twice to immutable variable `x` (Ast)
20+
//[mir]~| ERROR cannot assign twice to immutable variable `x` (Mir)
2121

2222
// explicitly mut-ify internals
2323
let &mut mut x = foo;

0 commit comments

Comments
 (0)