@@ -186,17 +186,17 @@ pub enum CheckInAllocMsg {
186
186
187
187
impl fmt:: Display for CheckInAllocMsg {
188
188
/// When this is printed as an error the context looks like this:
189
- /// "{msg}0x01 is not a valid pointer".
189
+ /// "{msg}{pointer} is a dangling pointer".
190
190
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
191
191
write ! (
192
192
f,
193
193
"{}" ,
194
194
match * self {
195
195
CheckInAllocMsg :: DerefTest => "dereferencing pointer failed: " ,
196
196
CheckInAllocMsg :: MemoryAccessTest => "memory access failed: " ,
197
- CheckInAllocMsg :: PointerArithmeticTest => "pointer arithmetic failed : " ,
197
+ CheckInAllocMsg :: PointerArithmeticTest => "out-of-bounds pointer arithmetic: " ,
198
198
CheckInAllocMsg :: OffsetFromTest => "out-of-bounds offset_from: " ,
199
- CheckInAllocMsg :: InboundsTest => "" ,
199
+ CheckInAllocMsg :: InboundsTest => "out-of-bounds pointer use: " ,
200
200
}
201
201
)
202
202
}
@@ -350,14 +350,12 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> {
350
350
ptr_size = ptr_size. bytes( ) ,
351
351
ptr_size_p = pluralize!( ptr_size. bytes( ) ) ,
352
352
) ,
353
- DanglingIntPointer ( 0 , CheckInAllocMsg :: InboundsTest ) => {
354
- write ! ( f, "null pointer is not a valid pointer for this operation" )
355
- }
356
- DanglingIntPointer ( 0 , msg) => {
357
- write ! ( f, "{msg}null pointer is not a valid pointer" )
358
- }
359
353
DanglingIntPointer ( i, msg) => {
360
- write ! ( f, "{msg}{i:#x} is not a valid pointer" )
354
+ write ! (
355
+ f,
356
+ "{msg}{pointer} is a dangling pointer (it has no provenance)" ,
357
+ pointer = Pointer :: <Option <AllocId >>:: from_addr( * i) ,
358
+ )
361
359
}
362
360
AlignmentCheckFailed { required, has } => write ! (
363
361
f,
0 commit comments