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
// NOTE: `offset` is explicitly absent from the error message, it has no significance
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())));
84
+
}
85
+
}
86
+
}
87
+
12
88
/// Some information that is irrelevant for the algorithm but very
13
89
/// convenient to know about a tag for debugging and testing.
14
90
#[derive(Clone,Debug)]
@@ -20,18 +96,29 @@ pub struct NodeDebugInfo {
20
96
/// pointer in the source code.
21
97
/// Helps match tag numbers to human-readable names.
22
98
pubname:Option<String>,
99
+
/// Notable events in the history of this tag, used for
100
+
/// diagnostics.
101
+
///
102
+
/// NOTE: by virtue of being part of `NodeDebugInfo`,
103
+
/// the history is automatically cleaned up by the GC.
104
+
/// NOTE: this is `!Send`, it needs to be converted before displaying
105
+
/// the actual diagnostics because `src/diagnostics.rs` requires `Send`.
106
+
pubhistory:History,
23
107
}
108
+
24
109
implNodeDebugInfo{
25
-
/// New node info with a name.
26
-
pubfnnew(tag:BorTag) -> Self{
27
-
Self{ tag,name:None}
110
+
/// Information for a new node. By default it has no
"{kind} through {initial} is forbidden because it is a child of {current} which is {perm}.",
132
-
kind=self.access_kind,
133
-
initial=self.tag_of_access,
134
-
current=self.faulty_tag,
135
-
perm=perm,
271
+
let conflicting_tag_name =
272
+
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,
136
283
)
137
284
}
138
-
ProtectedTransition(start, end) => {
139
-
format!(
140
-
"{kind} through {initial} is forbidden because it is a foreign tag for {current}, which would hence change from {start} to {end}, but {current} is protected",
141
-
current=self.faulty_tag,
142
-
start=start,
143
-
end=end,
144
-
kind=self.access_kind,
145
-
initial=self.tag_of_access,
285
+
ProtectedTransition(transition) => {
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
+
)),
293
+
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.",
295
+
loss = transition.summary(),
296
+
),
297
+
conflicting_tag_name,
146
298
)
147
299
}
148
300
ProtectedDealloc => {
149
-
format!(
150
-
"the allocation of {initial} also contains {current} which is strongly protected, cannot deallocate",
151
-
initial=self.tag_of_access,
152
-
current=self.faulty_tag,
301
+
let conflicting_tag_name = "strongly protected";
302
+
(
303
+
started_as,
304
+
format!("deallocation through {accessed} is forbidden."),
305
+
Some(format!(
306
+
"the allocation of the accessed tag {accessed} also contains the {conflicting_tag_name} tag {conflicting}."
307
+
)),
308
+
format!(
309
+
"the {conflicting_tag_name} tag {conflicting} disallows deallocations."
310
+
),
311
+
conflicting_tag_name,
153
312
)
154
313
}
155
-
}).into()
314
+
};
315
+
let pre_transition = PermTransition::from(started_as, pre_error).unwrap();
0 commit comments