Skip to content

Commit 37c3561

Browse files
committed
describe index with accurate _
1 parent 9ca2902 commit 37c3561

8 files changed

+18
-18
lines changed

src/librustc_mir/borrow_check/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
15661566
)?;
15671567
buf.push_str("[");
15681568
if self.append_local_to_string(index, buf).is_err() {
1569-
buf.push_str("..");
1569+
buf.push_str("_");
15701570
}
15711571
buf.push_str("]");
15721572
}

src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ LL | v[0].y;
316316
LL | drop(x);
317317
| - borrow later used here
318318

319-
error[E0503]: cannot use `v[..].y` because it was mutably borrowed
319+
error[E0503]: cannot use `v[_].y` because it was mutably borrowed
320320
--> $DIR/borrowck-describe-lvalue.rs:271:9
321321
|
322322
LL | let x = &mut v;

src/test/ui/borrowck/borrowck-describe-lvalue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ fn main() {
270270
let x = &mut v;
271271
v[0].y;
272272
//[ast]~^ ERROR cannot use `v[..].y` because it was mutably borrowed
273-
//[mir]~^^ ERROR cannot use `v[..].y` because it was mutably borrowed
273+
//[mir]~^^ ERROR cannot use `v[_].y` because it was mutably borrowed
274274
//[mir]~| ERROR cannot use `*v` because it was mutably borrowed
275275
drop(x);
276276
}

src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ LL | [1, 2, ref tail..] => tail,
77
LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
88
| ^^^^^^^^ assignment to borrowed `a[..]` occurs here
99

10-
error[E0506]: cannot assign to `a[..]` because it is borrowed (Mir)
10+
error[E0506]: cannot assign to `a[_]` because it is borrowed (Mir)
1111
--> $DIR/borrowck-vec-pattern-move-tail.rs:24:5
1212
|
1313
LL | [1, 2, ref tail..] => tail,
14-
| -------- borrow of `a[..]` occurs here
14+
| -------- borrow of `a[_]` occurs here
1515
...
1616
LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
17-
| ^^^^^^^^ assignment to borrowed `a[..]` occurs here
17+
| ^^^^^^^^ assignment to borrowed `a[_]` occurs here
1818
...
1919
LL | println!("t[0]: {}", t[0]);
2020
| ---- borrow later used here

src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() {
2323
println!("t[0]: {}", t[0]);
2424
a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
2525
//[cmp]~^ ERROR cannot assign to `a[..]` because it is borrowed (Ast)
26-
//[cmp]~| ERROR cannot assign to `a[..]` because it is borrowed (Mir)
26+
//[cmp]~| ERROR cannot assign to `a[_]` because it is borrowed (Mir)
2727
println!("t[0]: {}", t[0]);
2828
t[0];
2929
}

src/test/ui/issues/issue-46604.mir.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0017]: references in statics may only refer to immutable values
44
LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017
55
| ^^^^^^^^^^^^^^^^^^^^ statics require immutable values
66

7-
error[E0594]: cannot assign to `buf[..]`, as `buf` is an immutable static item
7+
error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item
88
--> $DIR/issue-46604.rs:20:5
99
|
1010
LL | buf[0]=2; //[ast]~ ERROR E0389

src/test/ui/nll/drop-no-may-dangle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ fn main() {
2727
use_x(*p.value);
2828
} else {
2929
use_x(22);
30-
v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed
30+
v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed
3131
}
3232

33-
v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed
33+
v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed
3434
}
3535

3636
struct WrapMayNotDangle<T> {

src/test/ui/nll/drop-no-may-dangle.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
error[E0506]: cannot assign to `v[..]` because it is borrowed
1+
error[E0506]: cannot assign to `v[_]` because it is borrowed
22
--> $DIR/drop-no-may-dangle.rs:30:9
33
|
44
LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
5-
| ----- borrow of `v[..]` occurs here
5+
| ----- borrow of `v[_]` occurs here
66
...
7-
LL | v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed
8-
| ^^^^^^^^^ assignment to borrowed `v[..]` occurs here
7+
LL | v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed
8+
| ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
99
...
1010
LL | }
1111
| - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
1212

13-
error[E0506]: cannot assign to `v[..]` because it is borrowed
13+
error[E0506]: cannot assign to `v[_]` because it is borrowed
1414
--> $DIR/drop-no-may-dangle.rs:33:5
1515
|
1616
LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
17-
| ----- borrow of `v[..]` occurs here
17+
| ----- borrow of `v[_]` occurs here
1818
...
19-
LL | v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed
20-
| ^^^^^^^^^ assignment to borrowed `v[..]` occurs here
19+
LL | v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed
20+
| ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
2121
LL | }
2222
| - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
2323

0 commit comments

Comments
 (0)