Skip to content

Commit deeb025

Browse files
committed
Address review comments 2
1 parent 43423f6 commit deeb025

13 files changed

+28
-28
lines changed

compiler/rustc_typeck/src/check/upvar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ fn var_name(tcx: TyCtxt<'_>, var_hir_id: hir::HirId) -> Symbol {
938938
/// }
939939
/// ```
940940
/// `CaptureKind` associated with both `E1` and `E2` will be ByRef(MutBorrow),
941-
/// and both have an expression associated, however for diagnostics we prfer reporting
941+
/// and both have an expression associated, however for diagnostics we prefer reporting
942942
/// `E1` since it appears earlier in the closure body. When `E2` is being processed we
943943
/// would've already handled `E1`, and have an existing capture_information for it.
944944
/// Calling `determine_capture_info(existing_info_e1, current_info_e2)` will return

src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn main() {
1111
|| {
1212
m[0] += 10;
1313
//~^ ERROR: Capturing m[] -> MutBorrow
14-
//~^^ ERROR: Min Capture m[] -> MutBorrow
14+
//~| ERROR: Min Capture m[] -> MutBorrow
1515
m[1] += 40;
1616
};
1717

src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn main() {
1717
|| {
1818
println!("{}", p.x);
1919
//~^ ERROR: Capturing p[(0, 0)] -> ImmBorrow
20-
//~^^ ERROR: Min Capture p[(0, 0)] -> ImmBorrow
20+
//~| ERROR: Min Capture p[(0, 0)] -> ImmBorrow
2121
};
2222

2323
// `c` should only capture `p.x`, therefore mutating `p.y` is allowed.

src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn main() {
1212
|| {
1313
println!("{}", t.0);
1414
//~^ ERROR: Capturing t[(0, 0)] -> ImmBorrow
15-
//~^^ ERROR: Min Capture t[(0, 0)] -> ImmBorrow
15+
//~| ERROR: Min Capture t[(0, 0)] -> ImmBorrow
1616
};
1717

1818
// `c` only captures t.0, therefore mutating t.1 is allowed.

src/test/ui/closures/2229_closure_analysis/destructure_patterns.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn arrays() {
1212
|| {
1313
let [a, b, .., e] = arr;
1414
//~^ ERROR: Capturing arr[Index] -> ByValue
15-
//~^^ ERROR: Min Capture arr[] -> ByValue
15+
//~| ERROR: Min Capture arr[] -> ByValue
1616
assert_eq!(a, "A");
1717
assert_eq!(b, "B");
1818
assert_eq!(e, "E");
@@ -35,9 +35,9 @@ fn structs() {
3535
|| {
3636
let Point { x: ref mut x, y: _, id: moved_id } = p;
3737
//~^ ERROR: Capturing p[(0, 0)] -> MutBorrow
38-
//~^^ ERROR: Capturing p[(2, 0)] -> ByValue
39-
//~^^^ ERROR: Min Capture p[(0, 0)] -> MutBorrow
40-
//~^^^^ ERROR: Min Capture p[(2, 0)] -> ByValue
38+
//~| ERROR: Capturing p[(2, 0)] -> ByValue
39+
//~| ERROR: Min Capture p[(0, 0)] -> MutBorrow
40+
//~| ERROR: Min Capture p[(2, 0)] -> ByValue
4141

4242
println!("{}, {}", x, moved_id);
4343
};
@@ -52,11 +52,11 @@ fn tuples() {
5252
|| {
5353
let (ref mut x, ref ref_str, (moved_s, _)) = t;
5454
//~^ ERROR: Capturing t[(0, 0)] -> MutBorrow
55-
//~^^ ERROR: Capturing t[(1, 0)] -> ImmBorrow
56-
//~^^^ ERROR: Capturing t[(2, 0),(0, 0)] -> ByValue
57-
//~^^^^ ERROR: Min Capture t[(0, 0)] -> MutBorrow
58-
//~^^^^^ ERROR: Min Capture t[(1, 0)] -> ImmBorrow
59-
//~^^^^^^ ERROR: Min Capture t[(2, 0),(0, 0)] -> ByValue
55+
//~| ERROR: Capturing t[(1, 0)] -> ImmBorrow
56+
//~| ERROR: Capturing t[(2, 0),(0, 0)] -> ByValue
57+
//~| ERROR: Min Capture t[(0, 0)] -> MutBorrow
58+
//~| ERROR: Min Capture t[(1, 0)] -> ImmBorrow
59+
//~| ERROR: Min Capture t[(2, 0),(0, 0)] -> ByValue
6060

6161
println!("{}, {} {}", x, ref_str, moved_s);
6262
};

src/test/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ fn main() {
1010
|| {
1111
println!("This uses new capture analyysis to capture s={}", s);
1212
//~^ ERROR: Capturing s[] -> ImmBorrow
13-
//~^^ ERROR: Min Capture s[] -> ImmBorrow
13+
//~| ERROR: Min Capture s[] -> ImmBorrow
1414
};
1515
}

src/test/ui/closures/2229_closure_analysis/filter-on-struct-member.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl Data {
2525
#[rustc_capture_analysis]
2626
|v| self.filter.allowed(*v),
2727
//~^ ERROR: Capturing self[Deref,(0, 0)] -> ImmBorrow
28-
//~^^ ERROR: Min Capture self[Deref,(0, 0)] -> ImmBorrow
28+
//~| ERROR: Min Capture self[Deref,(0, 0)] -> ImmBorrow
2929
);
3030
}
3131
}

src/test/ui/closures/2229_closure_analysis/multilevel-path-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn main() {
2424
|| {
2525
let wp = &w.p;
2626
//~^ ERROR: Capturing w[(0, 0)] -> ImmBorrow
27-
//~^^ ERROR: Min Capture w[(0, 0)] -> ImmBorrow
27+
//~| ERROR: Min Capture w[(0, 0)] -> ImmBorrow
2828
println!("{}", wp.x);
2929
};
3030

src/test/ui/closures/2229_closure_analysis/multilevel-path-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn main() {
2121
|| {
2222
println!("{}", w.p.x);
2323
//~^ ERROR: Capturing w[(0, 0),(0, 0)] -> ImmBorrow
24-
//~^^ ERROR: Min Capture w[(0, 0),(0, 0)] -> ImmBorrow
24+
//~| ERROR: Min Capture w[(0, 0),(0, 0)] -> ImmBorrow
2525
};
2626

2727
// `c` only captures `w.p.x`, therefore it's safe to mutate `w.p.y`.

src/test/ui/closures/2229_closure_analysis/nested-closure.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ fn main() {
2323
|| {
2424
println!("{}", p.x);
2525
//~^ ERROR: Capturing p[(0, 0)] -> ImmBorrow
26-
//~^^ ERROR: Min Capture p[(0, 0)] -> ImmBorrow
26+
//~| ERROR: Min Capture p[(0, 0)] -> ImmBorrow
2727
let incr = 10;
2828
let mut c2 = #[rustc_capture_analysis]
2929
//~^ ERROR: attributes on expressions are experimental
3030
|| p.y += incr;
3131
//~^ ERROR: Capturing p[(1, 0)] -> MutBorrow
32-
//~^^ ERROR: Capturing incr[] -> ImmBorrow
33-
//~^^^ ERROR: Min Capture p[(1, 0)] -> MutBorrow
34-
//~^^^^ ERROR: Min Capture incr[] -> ImmBorrow
35-
//~^^^^^ ERROR: Capturing p[(1, 0)] -> MutBorrow
36-
//~^^^^^^ ERROR: Min Capture p[(1, 0)] -> MutBorrow
32+
//~| ERROR: Capturing incr[] -> ImmBorrow
33+
//~| ERROR: Min Capture p[(1, 0)] -> MutBorrow
34+
//~| ERROR: Min Capture incr[] -> ImmBorrow
35+
//~| ERROR: Capturing p[(1, 0)] -> MutBorrow
36+
//~| ERROR: Min Capture p[(1, 0)] -> MutBorrow
3737
c2();
3838
println!("{}", p.y);
3939
};

src/test/ui/closures/2229_closure_analysis/path-with-array-access.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ fn main() {
2525
|| {
2626
println!("{}", pent.points[5].x);
2727
//~^ ERROR: Capturing pent[(0, 0)] -> ImmBorrow
28-
//~^^ ERROR: Min Capture pent[(0, 0)] -> ImmBorrow
28+
//~| ERROR: Min Capture pent[(0, 0)] -> ImmBorrow
2929
};
3030
}

src/test/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn main() {
2727
|| {
2828
p.x += 10;
2929
//~^ ERROR: Capturing p[(0, 0)] -> MutBorrow
30-
//~^^ ERROR: Min Capture p[] -> MutBorrow
30+
//~| ERROR: Min Capture p[] -> MutBorrow
3131
println!("{:?}", p);
3232
//~^ ERROR: Capturing p[] -> ImmBorrow
3333
};

src/test/ui/closures/2229_closure_analysis/wild_patterns.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn wild_struct() {
2323
// FIXME(arora-aman): Change `_x` to `_`
2424
let Point { x: _x, y: _ } = p;
2525
//~^ ERROR: Capturing p[(0, 0)] -> ImmBorrow
26-
//~^^ ERROR: Min Capture p[(0, 0)] -> ImmBorrow
26+
//~| ERROR: Min Capture p[(0, 0)] -> ImmBorrow
2727
};
2828

2929
c();
@@ -38,7 +38,7 @@ fn wild_tuple() {
3838
// FIXME(arora-aman): Change `_x` to `_`
3939
let (_x, _) = t;
4040
//~^ ERROR: Capturing t[(0, 0)] -> ByValue
41-
//~^^ ERROR: Min Capture t[(0, 0)] -> ByValue
41+
//~| ERROR: Min Capture t[(0, 0)] -> ByValue
4242
};
4343

4444
c();
@@ -53,7 +53,7 @@ fn wild_arr() {
5353
// FIXME(arora-aman): Change `_x` to `_`
5454
let [_x, _] = arr;
5555
//~^ ERROR: Capturing arr[Index] -> ByValue
56-
//~^^ ERROR: Min Capture arr[] -> ByValue
56+
//~| ERROR: Min Capture arr[] -> ByValue
5757
};
5858

5959
c();

0 commit comments

Comments
 (0)