@@ -150,7 +150,7 @@ impl<O> AssertKind<O> {
150
150
ResumedAfterReturn ( CoroutineKind :: Async ( _) ) => "`async fn` resumed after completion" ,
151
151
ResumedAfterPanic ( CoroutineKind :: Coroutine ) => "coroutine resumed after panicking" ,
152
152
ResumedAfterPanic ( CoroutineKind :: Async ( _) ) => "`async fn` resumed after panicking" ,
153
- BoundsCheck { .. } | MisalignedPointerDereference { .. } => {
153
+ BoundsCheck { .. } | MisalignedPointerDereference { .. } | OccupiedNiche { .. } => {
154
154
bug ! ( "Unexpected AssertKind" )
155
155
}
156
156
}
@@ -213,6 +213,13 @@ impl<O> AssertKind<O> {
213
213
"\" misaligned pointer dereference: address must be a multiple of {{}} but is {{}}\" , {required:?}, {found:?}"
214
214
)
215
215
}
216
+ OccupiedNiche { found, start, end, type_name, offset, niche_ty } => {
217
+ write ! (
218
+ f,
219
+ "\" occupied niche: {{}} must be in {{}}..={{}} in a {{}} at offset {{}} with type {{}}\" {:?} {:?} {:?} {:?} {:?} {:?}" ,
220
+ found, start, end, type_name, offset, niche_ty
221
+ )
222
+ }
216
223
_ => write ! ( f, "\" {}\" " , self . description( ) ) ,
217
224
}
218
225
}
@@ -243,8 +250,8 @@ impl<O> AssertKind<O> {
243
250
ResumedAfterPanic ( CoroutineKind :: Coroutine ) => {
244
251
middle_assert_coroutine_resume_after_panic
245
252
}
246
-
247
253
MisalignedPointerDereference { .. } => middle_assert_misaligned_ptr_deref,
254
+ OccupiedNiche { .. } => middle_assert_occupied_niche,
248
255
}
249
256
}
250
257
@@ -281,6 +288,14 @@ impl<O> AssertKind<O> {
281
288
add ! ( "required" , format!( "{required:#?}" ) ) ;
282
289
add ! ( "found" , format!( "{found:#?}" ) ) ;
283
290
}
291
+ OccupiedNiche { found, start, end, type_name, offset, niche_ty } => {
292
+ add ! ( "found" , format!( "{found:?}" ) ) ;
293
+ add ! ( "start" , format!( "{start:?}" ) ) ;
294
+ add ! ( "end" , format!( "{end:?}" ) ) ;
295
+ add ! ( "type_name" , format!( "{type_name}" ) ) ;
296
+ add ! ( "offset" , format!( "{offset:?}" ) ) ;
297
+ add ! ( "niche_ty" , format!( "{niche_ty}" ) ) ;
298
+ }
284
299
}
285
300
}
286
301
}
0 commit comments