You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/borrow_tracker/tree_borrows/diagnostics.rs
+33-34Lines changed: 33 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ impl HistoryData {
70
70
let this = format!("the {tag_name} tag {tag:?}");
71
71
let msg_initial_state = format!(", in the initial state {}", created.1);
72
72
let msg_creation = format!(
73
-
"{this} was created here{maybe_msg_initial_state}.",
73
+
"{this} was created here{maybe_msg_initial_state}",
74
74
maybe_msg_initial_state = if show_initial_state {&msg_initial_state } else {""},
75
75
);
76
76
@@ -79,8 +79,8 @@ impl HistoryData {
79
79
{
80
80
// NOTE: `offset` is explicitly absent from the error message, it has no significance
81
81
// to the user. The meaningful one is `access_range`.
82
-
self.events.push((Some(span.data()),format!("{this} then transitioned {transition} due to a {rel} {access_kind} at offsets {access_range:?}.", rel = if is_foreign {"foreign"} else {"child"})));
83
-
self.events.push((None,format!("this corresponds to {}.", transition.summary())));
82
+
self.events.push((Some(span.data()),format!("{this} then transitioned {transition} due to a {rel} {access_kind} at offsets {access_range:?}", rel = if is_foreign {"foreign"} else {"child"})));
83
+
self.events.push((None,format!("this corresponds to {}", transition.summary())));
84
84
}
85
85
}
86
86
}
@@ -266,50 +266,49 @@ impl TbError<'_> {
266
266
let accessed = self.accessed_info;
267
267
let conflicting = self.conflicting_info;
268
268
let accessed_is_conflicting = accessed.tag == conflicting.tag;
if accessed_is_conflicting {"accessed"}else{"conflicting"};
273
-
(
274
-
perm,
275
-
format!("{kind} through {accessed} is forbidden."),
276
-
(!accessed_is_conflicting).then_some(format!(
277
-
"the accessed tag {accessed} is a child of the conflicting tag {conflicting}."
278
-
)),
279
-
format!(
280
-
"the {conflicting_tag_name} tag {conflicting} has state {perm} which forbids child {kind}es."
281
-
),
282
-
conflicting_tag_name,
283
-
)
273
+
let title = format!("{kind} through {accessed} is forbidden");
274
+
letmut details = Vec::new();
275
+
if !accessed_is_conflicting {
276
+
details.push(format!(
277
+
"the accessed tag {accessed} is a child of the conflicting tag {conflicting}"
278
+
));
279
+
}
280
+
details.push(format!(
281
+
"the {conflicting_tag_name} tag {conflicting} has state {perm} which forbids child {kind}es"
282
+
));
283
+
(perm, title, details, conflicting_tag_name)
284
284
}
285
285
ProtectedTransition(transition) => {
286
286
let conflicting_tag_name = "protected";
287
-
(
288
-
transition.started(),
289
-
format!("{kind} through {accessed} is forbidden."),
290
-
Some(format!(
291
-
"the accessed tag {accessed} is a foreign tag for the {conflicting_tag_name} tag {conflicting}."
292
-
)),
287
+
let title = format!("{kind} through {accessed} is forbidden");
288
+
let details = vec![
289
+
format!(
290
+
"the accessed tag {accessed} is foreign to the {conflicting_tag_name} tag {conflicting} (i.e., it is not a child)"
291
+
),
292
+
format!(
293
+
"the access would cause the {conflicting_tag_name} tag {conflicting} to transition {transition}"
294
+
),
293
295
format!(
294
-
"the access would cause the {conflicting_tag_name} tag {conflicting} to transition {transition}. This is {loss}, which is not allowed for protected tags.",
296
+
"this is {loss}, which is not allowed for protected tags",
TreeBorrowsUb{title: _, relation, problem, history } => {
226
-
letmut helps = Vec::new();
227
-
ifletSome(relation) = relation {
228
-
helps.push((None, relation.clone()));
224
+
TreeBorrowsUb{title: _, details, history } => {
225
+
letmut helps = vec![
226
+
(None, format!("this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental"))
227
+
];
228
+
for m in details {
229
+
helps.push((None, m.clone()));
229
230
}
230
-
helps.push((None, problem.clone()));
231
-
helps.push((None,format!("this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental")));
Copy file name to clipboardExpand all lines: tests/fail/tree-borrows/alternate-read-write.stderr
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,34 +1,34 @@
1
-
error: Undefined Behavior: write access through <TAG> is forbidden.
1
+
error: Undefined Behavior: write access through <TAG> is forbidden
2
2
--> $DIR/alternate-read-write.rs:LL:CC
3
3
|
4
4
LL | *y += 1; // Failure
5
-
| ^^^^^^^ write access through <TAG> is forbidden.
5
+
| ^^^^^^^ write access through <TAG> is forbidden
6
6
|
7
-
= help: the accessed tag <TAG> is a child of the conflicting tag <TAG>.
8
-
= help: the conflicting tag <TAG> has state Frozen which forbids child write accesses.
9
7
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
10
-
help: the accessed tag <TAG> was created here.
8
+
= help: the accessed tag <TAG> is a child of the conflicting tag <TAG>
9
+
= help: the conflicting tag <TAG> has state Frozen which forbids child write accesses
10
+
help: the accessed tag <TAG> was created here
11
11
--> $DIR/alternate-read-write.rs:LL:CC
12
12
|
13
13
LL | let y = unsafe { &mut *(x as *mut u8) };
14
14
| ^^^^^^^^^^^^^^^^^^^^
15
-
help: the conflicting tag <TAG> was created here, in the initial state Reserved.
15
+
help: the conflicting tag <TAG> was created here, in the initial state Reserved
16
16
--> $DIR/alternate-read-write.rs:LL:CC
17
17
|
18
18
LL | let y = unsafe { &mut *(x as *mut u8) };
19
19
| ^^^^^^^^^^^^^^^^^^^^
20
-
help: the conflicting tag <TAG> then transitioned from Reserved to Active due to a child write access at offsets [0x0..0x1].
20
+
help: the conflicting tag <TAG> then transitioned from Reserved to Active due to a child write access at offsets [0x0..0x1]
21
21
--> $DIR/alternate-read-write.rs:LL:CC
22
22
|
23
23
LL | *y += 1; // Success
24
24
| ^^^^^^^
25
-
= help: this corresponds to an activation.
26
-
help: the conflicting tag <TAG> then transitioned from Active to Frozen due to a foreign read access at offsets [0x0..0x1].
25
+
= help: this corresponds to an activation
26
+
help: the conflicting tag <TAG> then transitioned from Active to Frozen due to a foreign read access at offsets [0x0..0x1]
27
27
--> $DIR/alternate-read-write.rs:LL:CC
28
28
|
29
29
LL | let _val = *x;
30
30
| ^^
31
-
= help: this corresponds to a loss of write permissions.
31
+
= help: this corresponds to a loss of write permissions
32
32
= note: BACKTRACE (of the first span):
33
33
= note: inside `main` at $DIR/alternate-read-write.rs:LL:CC
Copy file name to clipboardExpand all lines: tests/fail/tree-borrows/error-range.stderr
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,40 +1,40 @@
1
-
error: Undefined Behavior: read access through <TAG> is forbidden.
1
+
error: Undefined Behavior: read access through <TAG> is forbidden
2
2
--> $DIR/error-range.rs:LL:CC
3
3
|
4
4
LL | rmut[5] += 1;
5
-
| ^^^^^^^^^^^^ read access through <TAG> is forbidden.
5
+
| ^^^^^^^^^^^^ read access through <TAG> is forbidden
6
6
|
7
-
= help: the accessed tag <TAG> is a child of the conflicting tag <TAG>.
8
-
= help: the conflicting tag <TAG> has state Disabled which forbids child read accesses.
9
7
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
10
-
help: the accessed tag <TAG> was created here.
8
+
= help: the accessed tag <TAG> is a child of the conflicting tag <TAG>
9
+
= help: the conflicting tag <TAG> has state Disabled which forbids child read accesses
10
+
help: the accessed tag <TAG> was created here
11
11
--> $DIR/error-range.rs:LL:CC
12
12
|
13
13
LL | let rmut = &mut *addr_of_mut!(data[0..6]);
14
14
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15
-
help: the conflicting tag <TAG> was created here, in the initial state Reserved.
15
+
help: the conflicting tag <TAG> was created here, in the initial state Reserved
16
16
--> $DIR/error-range.rs:LL:CC
17
17
|
18
18
LL | let rmut = &mut *addr_of_mut!(data[0..6]);
19
19
| ^^^^
20
-
help: the conflicting tag <TAG> then transitioned from Reserved to Active due to a child write access at offsets [0x5..0x6].
20
+
help: the conflicting tag <TAG> then transitioned from Reserved to Active due to a child write access at offsets [0x5..0x6]
21
21
--> $DIR/error-range.rs:LL:CC
22
22
|
23
23
LL | rmut[5] += 1;
24
24
| ^^^^^^^^^^^^
25
-
= help: this corresponds to an activation.
26
-
help: the conflicting tag <TAG> then transitioned from Active to Frozen due to a foreign read access at offsets [0x5..0x6].
25
+
= help: this corresponds to an activation
26
+
help: the conflicting tag <TAG> then transitioned from Active to Frozen due to a foreign read access at offsets [0x5..0x6]
27
27
--> $DIR/error-range.rs:LL:CC
28
28
|
29
29
LL | let _v = data[5];
30
30
| ^^^^^^^
31
-
= help: this corresponds to a loss of write permissions.
32
-
help: the conflicting tag <TAG> then transitioned from Frozen to Disabled due to a foreign write access at offsets [0x5..0x6].
31
+
= help: this corresponds to a loss of write permissions
32
+
help: the conflicting tag <TAG> then transitioned from Frozen to Disabled due to a foreign write access at offsets [0x5..0x6]
33
33
--> $DIR/error-range.rs:LL:CC
34
34
|
35
35
LL | data[5] = 1;
36
36
| ^^^^^^^^^^^
37
-
= help: this corresponds to a loss of read permissions.
37
+
= help: this corresponds to a loss of read permissions
38
38
= note: BACKTRACE (of the first span):
39
39
= note: inside `main` at $DIR/error-range.rs:LL:CC
Copy file name to clipboardExpand all lines: tests/fail/tree-borrows/fragile-data-race.stderr
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,28 @@
1
-
error: Undefined Behavior: write access through <TAG> is forbidden.
1
+
error: Undefined Behavior: write access through <TAG> is forbidden
2
2
--> $DIR/fragile-data-race.rs:LL:CC
3
3
|
4
4
LL | unsafe { *p = 1 };
5
-
| ^^^^^^ write access through <TAG> is forbidden.
5
+
| ^^^^^^ write access through <TAG> is forbidden
6
6
|
7
-
= help: the accessed tag <TAG> is a child of the conflicting tag <TAG>.
8
-
= help: the conflicting tag <TAG> has state Frozen which forbids child write accesses.
9
7
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
10
-
help: the accessed tag <TAG> was created here.
8
+
= help: the accessed tag <TAG> is a child of the conflicting tag <TAG>
9
+
= help: the conflicting tag <TAG> has state Frozen which forbids child write accesses
10
+
help: the accessed tag <TAG> was created here
11
11
--> $DIR/fragile-data-race.rs:LL:CC
12
12
|
13
13
LL | fn thread_1(x: &mut u8) -> SendPtr {
14
14
| ^
15
-
help: the conflicting tag <TAG> was created here, in the initial state Reserved.
15
+
help: the conflicting tag <TAG> was created here, in the initial state Reserved
Copy file name to clipboardExpand all lines: tests/fail/tree-borrows/outside-range.stderr
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,19 @@
1
-
error: Undefined Behavior: write access through <TAG> is forbidden.
1
+
error: Undefined Behavior: write access through <TAG> is forbidden
2
2
--> $DIR/outside-range.rs:LL:CC
3
3
|
4
4
LL | *y.add(3) = 42;
5
-
| ^^^^^^^^^^^^^^ write access through <TAG> is forbidden.
5
+
| ^^^^^^^^^^^^^^ write access through <TAG> is forbidden
6
6
|
7
-
= help: the accessed tag <TAG> is a foreign tag for the protected tag <TAG>.
8
-
= help: the access would cause the protected tag <TAG> to transition from Reserved to Disabled. This is a loss of read and write permissions, which is not allowed for protected tags.
9
7
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
10
-
help: the accessed tag <TAG> was created here.
8
+
= help: the accessed tag <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child)
9
+
= help: the access would cause the protected tag <TAG> to transition from Reserved to Disabled
10
+
= help: this is a loss of read and write permissions, which is not allowed for protected tags
11
+
help: the accessed tag <TAG> was created here
11
12
--> $DIR/outside-range.rs:LL:CC
12
13
|
13
14
LL | let raw = data.as_mut_ptr();
14
15
| ^^^^^^^^^^^^^^^^^
15
-
help: the protected tag <TAG> was created here, in the initial state Reserved.
16
+
help: the protected tag <TAG> was created here, in the initial state Reserved
Copy file name to clipboardExpand all lines: tests/fail/tree-borrows/read-to-local.stderr
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,28 @@
1
-
error: Undefined Behavior: write access through <TAG> is forbidden.
1
+
error: Undefined Behavior: write access through <TAG> is forbidden
2
2
--> $DIR/read-to-local.rs:LL:CC
3
3
|
4
4
LL | *ptr = 0;
5
-
| ^^^^^^^^ write access through <TAG> is forbidden.
5
+
| ^^^^^^^^ write access through <TAG> is forbidden
6
6
|
7
-
= help: the accessed tag <TAG> has state Frozen which forbids child write accesses.
8
7
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
9
-
help: the accessed tag <TAG> was created here, in the initial state Reserved.
8
+
= help: the accessed tag <TAG> has state Frozen which forbids child write accesses
9
+
help: the accessed tag <TAG> was created here, in the initial state Reserved
10
10
--> $DIR/read-to-local.rs:LL:CC
11
11
|
12
12
LL | let mref = &mut root;
13
13
| ^^^^^^^^^
14
-
help: the accessed tag <TAG> then transitioned from Reserved to Active due to a child write access at offsets [0x0..0x1].
14
+
help: the accessed tag <TAG> then transitioned from Reserved to Active due to a child write access at offsets [0x0..0x1]
15
15
--> $DIR/read-to-local.rs:LL:CC
16
16
|
17
17
LL | *ptr = 0; // Write
18
18
| ^^^^^^^^
19
-
= help: this corresponds to an activation.
20
-
help: the accessed tag <TAG> then transitioned from Active to Frozen due to a foreign read access at offsets [0x0..0x1].
19
+
= help: this corresponds to an activation
20
+
help: the accessed tag <TAG> then transitioned from Active to Frozen due to a foreign read access at offsets [0x0..0x1]
21
21
--> $DIR/read-to-local.rs:LL:CC
22
22
|
23
23
LL | assert_eq!(root, 0); // Parent Read
24
24
| ^^^^^^^^^^^^^^^^^^^
25
-
= help: this corresponds to a loss of write permissions.
25
+
= help: this corresponds to a loss of write permissions
26
26
= note: BACKTRACE (of the first span):
27
27
= note: inside `main` at $DIR/read-to-local.rs:LL:CC
28
28
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
0 commit comments