

Provide slightly better notes when tracking a pointer tag by saethlin · Pull Req...
source link: https://github.com/rust-lang/miri/pull/1945
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

I slapped this in as a sort of advanced println-based debugging when trying to figure out a track-raw-pointers finding in smallvec
. Perhaps this looks like a good idea to you all?
EDIT: User scenario
Run MIRIFLAGS=-Ztag-raw-pointers cargo miri test
, get a diagnostic that looks like
error: Undefined Behavior: trying to reborrow for SharedReadOnly at alloc99465+0x9, but parent tag <265507> does not have an appropriate item in the borrow stack
So now run MIRIFLAGS=-Ztag-raw-pointers -Zmiri-track-pointer-tag=265507 cargo miri test
Old:
note: tracking was triggered
--> src/lib.rs:822:36
|
822 | vec: NonNull::from(self),
| ^^^^ popped tracked tag for item [SharedReadOnly for <265507>]
note: tracking was triggered
--> src/lib.rs:822:36
|
822 | vec: NonNull::from(self),
| ^^^^ popped tracked tag for item [SharedReadOnly for <265507>] due to Write access for <265356>
So that if a user is now beginning to question their sanity because they don't really understand SB yet, they can then track the tag which caused the parent tag to be removed from the stack to be sure what's going on here:
--> src/lib.rs:792:5
|
792 | / pub fn drain<R>(&mut self, range: R) -> Drain<'_, A>
793 | | where
794 | | R: RangeBounds<usize>,
795 | | {
... |
824 | | }
825 | | }
| |_____^ created tag 265356
The existing diagnostic can tell you where the tag you'd need was invalidated, but it cannot tell you what and why that tag was invalidated.
Recommend
-
16
Collaborator rust-highfive commented
-
10
Copy link Contributor Author saethlin ...
-
16
Serializing Serialization: How does pointer tracking work? advertisements How does pointer tracking work in boost serialization? I am using it...
-
10
Notes on COM aggregation: Obtaining a pointer to your aggregated partner without introducing a reference cycle Raymond February 10th...
-
14
Copy link Contributor saethlin ...
-
9
Copy link Contributor
-
12
Contributor ...
-
9
Remove the size of locals heuristic in MIR inlining #110705
-
9
Conversation Contributor In
-
10
Tracking Issue for pointer_bytes_offsets #96283 ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK