Skip to content

Commit 58b7147

Browse files
committed
normalize tree borrow diagnostics across targets
1 parent 0709693 commit 58b7147

12 files changed

+54
-52
lines changed

tests/compiletest.rs

+2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ regexes! {
190190
// erase borrow tags
191191
"<[0-9]+>" => "<TAG>",
192192
"<[0-9]+=" => "<TAG=",
193+
// normalize width of Tree Borrows diagnostic borders (which otherwise leak borrow tag info)
194+
"(─{50})─+" => "$1",
193195
// erase whitespace that differs between platforms
194196
r" +at (.*\.rs)" => " at $1",
195197
// erase generics in backtraces

tests/fail/tree_borrows/reserved/cell-protected-write.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
──────────────────────────────────────────────────────────────────────
1+
──────────────────────────────────────────────────
22
Warning: this tree is indicative only. Some tags may have been hidden.
33
0.. 1
44
| Act| └─┬──<TAG=root of the allocation>
@@ -7,7 +7,7 @@ Warning: this tree is indicative only. Some tags may have been hidden.
77
| Re*| │ └─┬──<TAG=caller:x>
88
| Re*| │ └────<TAG=callee:x> Strongly protected
99
| Re*| └────<TAG=y, callee:y, caller:y>
10-
──────────────────────────────────────────────────────────────────────
10+
──────────────────────────────────────────────────
1111
error: Undefined Behavior: write access through <TAG> (y, callee:y, caller:y) is forbidden
1212
--> $DIR/cell-protected-write.rs:LL:CC
1313
|

tests/fail/tree_borrows/reserved/int-protected-write.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
──────────────────────────────────────────────────────────────────────
1+
──────────────────────────────────────────────────
22
Warning: this tree is indicative only. Some tags may have been hidden.
33
0.. 1
44
| Act| └─┬──<TAG=root of the allocation>
@@ -7,7 +7,7 @@ Warning: this tree is indicative only. Some tags may have been hidden.
77
| Res| │ └─┬──<TAG=caller:x>
88
| Res| │ └────<TAG=callee:x> Strongly protected
99
| Res| └────<TAG=y, callee:y, caller:y>
10-
──────────────────────────────────────────────────────────────────────
10+
──────────────────────────────────────────────────
1111
error: Undefined Behavior: write access through <TAG> (y, callee:y, caller:y) is forbidden
1212
--> $DIR/int-protected-write.rs:LL:CC
1313
|
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
──────────────────────────────────────────────────────────────────────
1+
──────────────────────────────────────────────────
22
Warning: this tree is indicative only. Some tags may have been hidden.
33
0.. 1
44
| Act| └─┬──<TAG=root of the allocation>
55
| Re*| └────<TAG=data, x, y>
6-
──────────────────────────────────────────────────────────────────────
7-
──────────────────────────────────────────────────────────────────────
6+
──────────────────────────────────────────────────
7+
──────────────────────────────────────────────────
88
Warning: this tree is indicative only. Some tags may have been hidden.
99
0.. 1
1010
| Act| └─┬──<TAG=root of the allocation>
1111
| Act| └────<TAG=data, x, y>
12-
──────────────────────────────────────────────────────────────────────
12+
──────────────────────────────────────────────────
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
──────────────────────────────────────────────────────────────────────
1+
──────────────────────────────────────────────────
22
Warning: this tree is indicative only. Some tags may have been hidden.
33
0.. 1
44
| Act| └─┬──<TAG=root of the allocation>
55
| Res| └─┬──<TAG=data>
66
| Res| └────<TAG=x>
7-
──────────────────────────────────────────────────────────────────────
8-
──────────────────────────────────────────────────────────────────────
7+
──────────────────────────────────────────────────
8+
──────────────────────────────────────────────────
99
Warning: this tree is indicative only. Some tags may have been hidden.
1010
0.. 1
1111
| Act| └─┬──<TAG=root of the allocation>
1212
| Res| └─┬──<TAG=data>
1313
| Res| └─┬──<TAG=x>
1414
| Res| └─┬──<TAG=caller:x>
1515
| Res| └────<TAG=callee:x> Strongly protected
16-
──────────────────────────────────────────────────────────────────────
17-
──────────────────────────────────────────────────────────────────────
16+
──────────────────────────────────────────────────
17+
──────────────────────────────────────────────────
1818
Warning: this tree is indicative only. Some tags may have been hidden.
1919
0.. 1
2020
| Act| └─┬──<TAG=root of the allocation>
@@ -23,8 +23,8 @@ Warning: this tree is indicative only. Some tags may have been hidden.
2323
| Res| │ └─┬──<TAG=caller:x>
2424
| Res| │ └────<TAG=callee:x>
2525
| Res| └────<TAG=y>
26-
──────────────────────────────────────────────────────────────────────
27-
──────────────────────────────────────────────────────────────────────
26+
──────────────────────────────────────────────────
27+
──────────────────────────────────────────────────
2828
Warning: this tree is indicative only. Some tags may have been hidden.
2929
0.. 1
3030
| Act| └─┬──<TAG=root of the allocation>
@@ -33,4 +33,4 @@ Warning: this tree is indicative only. Some tags may have been hidden.
3333
| Dis| │ └─┬──<TAG=caller:x>
3434
| Dis| │ └────<TAG=callee:x>
3535
| Act| └────<TAG=y>
36-
──────────────────────────────────────────────────────────────────────
36+
──────────────────────────────────────────────────

tests/pass/tree_borrows/formatting.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
───────────────────────────────────────────────────────────────────────────────────────
1+
──────────────────────────────────────────────────
22
Warning: this tree is indicative only. Some tags may have been hidden.
33
0.. 1.. 2.. 10.. 11..100..101..1000..1001..1024
44
| Act| Act| Act| Act| Act| Act| Act| Act| Act| └─┬──<TAG=root of the allocation>
@@ -7,8 +7,8 @@ Warning: this tree is indicative only. Some tags may have been hidden.
77
|----|----|----| Act|----|?Dis| ----| ?Dis| ----| ├────<TAG=data[10]>
88
|----|----|----|----|----| Frz| ----| ?Dis| ----| ├────<TAG=data[100]>
99
|----|----|----|----|----|----| ----| Act| ----| └────<TAG=data[1000]>
10-
───────────────────────────────────────────────────────────────────────────────────────
11-
──────────────────────────────────────────────────────────────────────
10+
──────────────────────────────────────────────────
11+
──────────────────────────────────────────────────
1212
Warning: this tree is indicative only. Some tags may have been hidden.
1313
0.. 1
1414
| Act| └─┬──<TAG=root of the allocation>
@@ -28,4 +28,4 @@ Warning: this tree is indicative only. Some tags may have been hidden.
2828
| Frz| └─┬──<TAG=xcb>
2929
| Frz| ├────<TAG=xcba>
3030
| Frz| └────<TAG=xcbb>
31-
──────────────────────────────────────────────────────────────────────
31+
──────────────────────────────────────────────────
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
──────────────────────────────────────────────────────────────────────
1+
──────────────────────────────────────────────────
22
Warning: this tree is indicative only. Some tags may have been hidden.
33
0.. 1
44
| Act| └─┬──<TAG=root of the allocation>
55
| Act| └─┬──<TAG=parent>
66
| Act| └────<TAG=x>
7-
──────────────────────────────────────────────────────────────────────
8-
──────────────────────────────────────────────────────────────────────
7+
──────────────────────────────────────────────────
8+
──────────────────────────────────────────────────
99
Warning: this tree is indicative only. Some tags may have been hidden.
1010
0.. 1
1111
| Act| └─┬──<TAG=root of the allocation>
1212
| Act| └─┬──<TAG=parent>
1313
| Frz| ├────<TAG=x>
1414
| Res| └────<TAG=y>
15-
──────────────────────────────────────────────────────────────────────
15+
──────────────────────────────────────────────────
+12-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[interior mut + protected] Foreign Read: Re* -> Frz
2-
──────────────────────────────────────────────────────────────────────
2+
──────────────────────────────────────────────────
33
Warning: this tree is indicative only. Some tags may have been hidden.
44
0.. 1
55
| Act| └─┬──<TAG=root of the allocation>
@@ -8,27 +8,27 @@ Warning: this tree is indicative only. Some tags may have been hidden.
88
| Re*| │ └─┬──<TAG=caller:x>
99
| Frz| │ └────<TAG=callee:x>
1010
| Re*| └────<TAG=y, caller:y, callee:y>
11-
──────────────────────────────────────────────────────────────────────
11+
──────────────────────────────────────────────────
1212
[interior mut] Foreign Read: Re* -> Re*
13-
──────────────────────────────────────────────────────────────────────
13+
──────────────────────────────────────────────────
1414
Warning: this tree is indicative only. Some tags may have been hidden.
1515
0.. 8
1616
| Act| └─┬──<TAG=root of the allocation>
1717
| Re*| └─┬──<TAG=base>
1818
| Re*| ├────<TAG=x>
1919
| Re*| └────<TAG=y>
20-
──────────────────────────────────────────────────────────────────────
20+
──────────────────────────────────────────────────
2121
[interior mut] Foreign Write: Re* -> Re*
22-
──────────────────────────────────────────────────────────────────────
22+
──────────────────────────────────────────────────
2323
Warning: this tree is indicative only. Some tags may have been hidden.
2424
0.. 8
2525
| Act| └─┬──<TAG=root of the allocation>
2626
| Act| └─┬──<TAG=base>
2727
| Re*| ├────<TAG=x>
2828
| Act| └────<TAG=y>
29-
──────────────────────────────────────────────────────────────────────
29+
──────────────────────────────────────────────────
3030
[protected] Foreign Read: Res -> Frz
31-
──────────────────────────────────────────────────────────────────────
31+
──────────────────────────────────────────────────
3232
Warning: this tree is indicative only. Some tags may have been hidden.
3333
0.. 1
3434
| Act| └─┬──<TAG=root of the allocation>
@@ -37,22 +37,22 @@ Warning: this tree is indicative only. Some tags may have been hidden.
3737
| Res| │ └─┬──<TAG=caller:x>
3838
| Frz| │ └────<TAG=callee:x>
3939
| Res| └────<TAG=y, caller:y, callee:y>
40-
──────────────────────────────────────────────────────────────────────
40+
──────────────────────────────────────────────────
4141
[] Foreign Read: Res -> Res
42-
──────────────────────────────────────────────────────────────────────
42+
──────────────────────────────────────────────────
4343
Warning: this tree is indicative only. Some tags may have been hidden.
4444
0.. 1
4545
| Act| └─┬──<TAG=root of the allocation>
4646
| Res| └─┬──<TAG=base>
4747
| Res| ├────<TAG=x>
4848
| Res| └────<TAG=y>
49-
──────────────────────────────────────────────────────────────────────
49+
──────────────────────────────────────────────────
5050
[] Foreign Write: Res -> Dis
51-
──────────────────────────────────────────────────────────────────────
51+
──────────────────────────────────────────────────
5252
Warning: this tree is indicative only. Some tags may have been hidden.
5353
0.. 1
5454
| Act| └─┬──<TAG=root of the allocation>
5555
| Act| └─┬──<TAG=base>
5656
| Dis| ├────<TAG=x>
5757
| Act| └────<TAG=y>
58-
──────────────────────────────────────────────────────────────────────
58+
──────────────────────────────────────────────────

0 commit comments

Comments
 (0)