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
Reserved loses permissions too quickly.
Adding more fine-grained behavior of Reserved lets it lose
write permissions only temporarily.
Protected tags receive a read access on initialized locations.
Copy file name to clipboardExpand all lines: src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs
+18-3
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ pub enum AccessCause {
19
19
Explicit(AccessKind),
20
20
Reborrow,
21
21
Dealloc,
22
+
FnExit,
22
23
}
23
24
24
25
impl fmt::DisplayforAccessCause{
@@ -27,6 +28,7 @@ impl fmt::Display for AccessCause {
27
28
Self::Explicit(kind) => write!(f,"{kind}"),
28
29
Self::Reborrow => write!(f,"reborrow"),
29
30
Self::Dealloc => write!(f,"deallocation"),
31
+
Self::FnExit => write!(f,"protector release"),
30
32
}
31
33
}
32
34
}
@@ -38,6 +40,7 @@ impl AccessCause {
38
40
Self::Explicit(kind) => format!("{rel} {kind}"),
39
41
Self::Reborrow => format!("reborrow (acting as a {rel} read access)"),
40
42
Self::Dealloc => format!("deallocation (acting as a {rel} write access)"),
43
+
Self::FnExit => format!("protector release (acting as a {rel} read access)"),
41
44
}
42
45
}
43
46
}
@@ -52,7 +55,9 @@ pub struct Event {
52
55
/// Relative position of the tag to the one used for the access.
53
56
pubis_foreign:bool,
54
57
/// User-visible range of the access.
55
-
pubaccess_range:AllocRange,
58
+
/// `None` means that this is an implicit access to the entire allocation
59
+
/// (used for the implicit read on protector release).
60
+
pubaccess_range:Option<AllocRange>,
56
61
/// The transition recorded by this event only occured on a subrange of
57
62
/// `access_range`: a single access on `access_range` triggers several events,
58
63
/// each with their own mutually disjoint `transition_range`. No-op transitions
@@ -123,7 +128,17 @@ impl HistoryData {
123
128
// NOTE: `transition_range` is explicitly absent from the error message, it has no significance
124
129
// to the user. The meaningful one is `access_range`.
125
130
let access = access_cause.print_as_access(is_foreign);
126
-
self.events.push((Some(span.data()),format!("{this} later transitioned to {endpoint} due to a {access} at offsets {access_range:?}", endpoint = transition.endpoint())));
131
+
let access_range_text = match access_range {
132
+
Some(r) => format!("at offsets {r:?}"),
133
+
None => format!("on every location previously accessed by this tag"),
134
+
};
135
+
self.events.push((
136
+
Some(span.data()),
137
+
format!(
138
+
"{this} later transitioned to {endpoint} due to a {access} {access_range_text}",
139
+
endpoint = transition.endpoint()
140
+
),
141
+
));
127
142
self.events
128
143
.push((None,format!("this transition corresponds to {}", transition.summary())));
0 commit comments