@@ -146,13 +146,7 @@ impl<'rt, 'mir, 'tcx, M: CompileTimeMachine<'mir, 'tcx>> InternVisitor<'rt, 'mir
146
146
mode : InternMode ,
147
147
ty : Option < Ty < ' tcx > > ,
148
148
) -> Option < IsStaticOrFn > {
149
- intern_shallow (
150
- self . ecx ,
151
- self . leftover_allocations ,
152
- alloc_id,
153
- mode,
154
- ty,
155
- )
149
+ intern_shallow ( self . ecx , self . leftover_allocations , alloc_id, mode, ty)
156
150
}
157
151
}
158
152
@@ -216,10 +210,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx>> ValueVisitor<'mir
216
210
self . intern_shallow ( vtable. alloc_id , InternMode :: ConstInner , None ) ;
217
211
} else {
218
212
// Let validation show the error message, but make sure it *does* error.
219
- tcx. sess . delay_span_bug (
220
- tcx. span ,
221
- "vtables pointers cannot be integer pointers" ,
222
- ) ;
213
+ tcx. sess
214
+ . delay_span_bug ( tcx. span , "vtables pointers cannot be integer pointers" ) ;
223
215
}
224
216
}
225
217
// Check if we have encountered this pointer+layout combination before.
@@ -264,7 +256,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx>> ValueVisitor<'mir
264
256
ty:: Array ( _, n)
265
257
if n. eval_usize ( tcx. tcx , self . ecx . param_env ) == 0 => { }
266
258
ty:: Slice ( _)
267
- if mplace. meta . unwrap_meta ( ) . to_machine_usize ( self . ecx ) ? == 0 => { }
259
+ if mplace. meta . unwrap_meta ( ) . to_machine_usize ( self . ecx ) ?
260
+ == 0 => { }
268
261
_ => mutable_memory_in_const ( tcx, "`&mut`" ) ,
269
262
}
270
263
} else {
@@ -315,16 +308,16 @@ pub fn intern_const_alloc_recursive<M: CompileTimeMachine<'mir, 'tcx>>(
315
308
intern_kind : InternKind ,
316
309
ret : MPlaceTy < ' tcx > ,
317
310
ignore_interior_mut_in_const : bool ,
318
- )
319
- where
311
+ ) where
320
312
' tcx : ' mir ,
321
313
{
322
314
let tcx = ecx. tcx ;
323
315
let base_intern_mode = match intern_kind {
324
316
InternKind :: Static ( mutbl) => InternMode :: Static ( mutbl) ,
325
317
// FIXME: what about array lengths, array initializers?
326
- InternKind :: Constant | InternKind :: ConstProp | InternKind :: Promoted =>
327
- InternMode :: ConstBase ,
318
+ InternKind :: Constant | InternKind :: ConstProp | InternKind :: Promoted => {
319
+ InternMode :: ConstBase
320
+ }
328
321
} ;
329
322
330
323
// Type based interning.
@@ -362,7 +355,7 @@ where
362
355
// references are "leftover"-interned, and later validation will show a proper error
363
356
// and point at the right part of the value causing the problem.
364
357
match res {
365
- Ok ( ( ) ) => { } ,
358
+ Ok ( ( ) ) => { }
366
359
Err ( error) => {
367
360
ecx. tcx . sess . delay_span_bug (
368
361
ecx. tcx . span ,
@@ -412,10 +405,9 @@ where
412
405
// is tracked by const-checking.
413
406
// FIXME: downgrade this to a warning? It rejects some legitimate consts,
414
407
// such as `const CONST_RAW: *const Vec<i32> = &Vec::new() as *const _;`.
415
- ecx. tcx . sess . span_err (
416
- ecx. tcx . span ,
417
- "untyped pointers are not allowed in constant" ,
418
- ) ;
408
+ ecx. tcx
409
+ . sess
410
+ . span_err ( ecx. tcx . span , "untyped pointers are not allowed in constant" ) ;
419
411
// For better errors later, mark the allocation as immutable.
420
412
alloc. mutability = Mutability :: Not ;
421
413
}
@@ -430,13 +422,10 @@ where
430
422
} else if ecx. memory . dead_alloc_map . contains_key ( & alloc_id) {
431
423
// Codegen does not like dangling pointers, and generally `tcx` assumes that
432
424
// all allocations referenced anywhere actually exist. So, make sure we error here.
433
- ecx. tcx . sess . span_err (
434
- ecx. tcx . span ,
435
- "encountered dangling pointer in final constant" ,
436
- ) ;
425
+ ecx. tcx . sess . span_err ( ecx. tcx . span , "encountered dangling pointer in final constant" ) ;
437
426
} else if ecx. tcx . get_global_alloc ( alloc_id) . is_none ( ) {
438
- // We have hit an `AllocId` that is neither in local or global memory and isn't
439
- // marked as dangling by local memory. That should be impossible.
427
+ // We have hit an `AllocId` that is neither in local or global memory and isn't
428
+ // marked as dangling by local memory. That should be impossible.
440
429
span_bug ! ( ecx. tcx. span, "encountered unknown alloc id {:?}" , alloc_id) ;
441
430
}
442
431
}
0 commit comments