@@ -186,17 +186,17 @@ pub enum CheckInAllocMsg {
186186
187187impl fmt:: Display for CheckInAllocMsg {
188188 /// 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".
190190 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
191191 write ! (
192192 f,
193193 "{}" ,
194194 match * self {
195195 CheckInAllocMsg :: DerefTest => "dereferencing pointer failed: " ,
196196 CheckInAllocMsg :: MemoryAccessTest => "memory access failed: " ,
197- CheckInAllocMsg :: PointerArithmeticTest => "pointer arithmetic failed : " ,
197+ CheckInAllocMsg :: PointerArithmeticTest => "out-of-bounds pointer arithmetic: " ,
198198 CheckInAllocMsg :: OffsetFromTest => "out-of-bounds offset_from: " ,
199- CheckInAllocMsg :: InboundsTest => "" ,
199+ CheckInAllocMsg :: InboundsTest => "out-of-bounds pointer use: " ,
200200 }
201201 )
202202 }
@@ -350,14 +350,12 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> {
350350 ptr_size = ptr_size. bytes( ) ,
351351 ptr_size_p = pluralize!( ptr_size. bytes( ) ) ,
352352 ) ,
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- }
359353 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+ )
361359 }
362360 AlignmentCheckFailed { required, has } => write ! (
363361 f,
0 commit comments