670dc7d551
Add a lot more information to SB fatal errors In fatal errors, this clarifies the difference between a tag not being present in the borrow stack at all, and the tag being present but granting SRO. It also introduces a little notation for memory ranges so we can mention to the user that the span may point to code that operates on multiple memory locations, but we are reporting an error at a particular offset. This also gets rid of the unqualified phrase "the borrow stack" in errors, and clarifies that it is the borrow stack _for some location_. The crate `pdqselect` v0.1.1: Before: ``` 2103 | unsafe { copy_nonoverlapping(src, dst, count) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item granting read access to tag <2357> at alloc1029 found in borrow stack. ``` After: ``` 2103 | unsafe { copy_nonoverlapping(src, dst, count) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | attempting a read access using <2357> at alloc1029[0x0], but that tag does not exist in the borrow stack for this location | this error occurs as part of an access at alloc1029[0x0..0x4] ``` And the crate `half` v1.8.2 Before: ``` 131 | unsafe { &mut *ptr::slice_from_raw_parts_mut(data, len) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to reborrow for Unique at alloc1051, but parent tag <2091> does not have an appropriate item in the borrow stack ``` After: ``` 131 | unsafe { &mut *ptr::slice_from_raw_parts_mut(data, len) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | trying to reborrow <2091> for Unique permission at alloc1051[0x0], but that tag only grants SharedReadOnly permission for this location | this error occurs as part of a reborrow at alloc1051[0x0..0x6] ```