@@ -170,22 +170,25 @@ impl fmt::Display for InvalidProgramInfo<'_> {
170170/// Details of why a pointer had to be in-bounds.
171171#[ derive( Debug , Copy , Clone , TyEncodable , TyDecodable , HashStable ) ]
172172pub enum CheckInAllocMsg {
173+ /// We are access memory.
173174 MemoryAccessTest ,
175+ /// We are doing pointer arithmetic.
174176 PointerArithmeticTest ,
177+ /// None of the above -- generic/unspecific inbounds test.
175178 InboundsTest ,
176179}
177180
178181impl fmt:: Display for CheckInAllocMsg {
179182 /// When this is printed as an error the context looks like this
180- /// "{test name} failed: pointer must be in-bounds at offset..."
183+ /// "{msg} pointer must be in-bounds at offset..."
181184 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
182185 write ! (
183186 f,
184187 "{}" ,
185188 match * self {
186- CheckInAllocMsg :: MemoryAccessTest => "memory access" ,
187- CheckInAllocMsg :: PointerArithmeticTest => "pointer arithmetic" ,
188- CheckInAllocMsg :: InboundsTest => "inbounds test " ,
189+ CheckInAllocMsg :: MemoryAccessTest => "memory access failed: " ,
190+ CheckInAllocMsg :: PointerArithmeticTest => "pointer arithmetic failed: " ,
191+ CheckInAllocMsg :: InboundsTest => "" ,
189192 }
190193 )
191194 }
@@ -299,18 +302,18 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> {
299302 }
300303 PointerOutOfBounds { ptr, msg, allocation_size } => write ! (
301304 f,
302- "{} failed: pointer must be in-bounds at offset {}, \
305+ "{}pointer must be in-bounds at offset {}, \
303306 but is outside bounds of {} which has size {}",
304307 msg,
305308 ptr. offset. bytes( ) ,
306309 ptr. alloc_id,
307310 allocation_size. bytes( )
308311 ) ,
309- DanglingIntPointer ( _ , CheckInAllocMsg :: InboundsTest ) => {
310- write ! ( f, "null pointer is not allowed for this operation" )
312+ DanglingIntPointer ( 0 , CheckInAllocMsg :: InboundsTest ) => {
313+ write ! ( f, "null pointer is not a valid pointer for this operation" )
311314 }
312315 DanglingIntPointer ( i, msg) => {
313- write ! ( f, "{} failed: 0x{:x} is not a valid pointer" , msg, i)
316+ write ! ( f, "{}0x{:x} is not a valid pointer" , msg, i)
314317 }
315318 AlignmentCheckFailed { required, has } => write ! (
316319 f,
0 commit comments