@@ -170,22 +170,25 @@ impl fmt::Display for InvalidProgramInfo<'_> {
170
170
/// Details of why a pointer had to be in-bounds.
171
171
#[ derive( Debug , Copy , Clone , TyEncodable , TyDecodable , HashStable ) ]
172
172
pub enum CheckInAllocMsg {
173
+ /// We are access memory.
173
174
MemoryAccessTest ,
175
+ /// We are doing pointer arithmetic.
174
176
PointerArithmeticTest ,
177
+ /// None of the above -- generic/unspecific inbounds test.
175
178
InboundsTest ,
176
179
}
177
180
178
181
impl fmt:: Display for CheckInAllocMsg {
179
182
/// 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..."
181
184
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
182
185
write ! (
183
186
f,
184
187
"{}" ,
185
188
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 => "" ,
189
192
}
190
193
)
191
194
}
@@ -299,18 +302,18 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> {
299
302
}
300
303
PointerOutOfBounds { ptr, msg, allocation_size } => write ! (
301
304
f,
302
- "{} failed: pointer must be in-bounds at offset {}, \
305
+ "{}pointer must be in-bounds at offset {}, \
303
306
but is outside bounds of {} which has size {}",
304
307
msg,
305
308
ptr. offset. bytes( ) ,
306
309
ptr. alloc_id,
307
310
allocation_size. bytes( )
308
311
) ,
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" )
311
314
}
312
315
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)
314
317
}
315
318
AlignmentCheckFailed { required, has } => write ! (
316
319
f,
0 commit comments