Skip to content

Commit d3b2e1f

Browse files
committed
fmt
1 parent ff39457 commit d3b2e1f

File tree

1 file changed

+16
-27
lines changed

1 file changed

+16
-27
lines changed

src/librustc_mir/interpret/intern.rs

+16-27
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,7 @@ impl<'rt, 'mir, 'tcx, M: CompileTimeMachine<'mir, 'tcx>> InternVisitor<'rt, 'mir
146146
mode: InternMode,
147147
ty: Option<Ty<'tcx>>,
148148
) -> 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)
156150
}
157151
}
158152

@@ -216,10 +210,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx>> ValueVisitor<'mir
216210
self.intern_shallow(vtable.alloc_id, InternMode::ConstInner, None);
217211
} else {
218212
// 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");
223215
}
224216
}
225217
// 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
264256
ty::Array(_, n)
265257
if n.eval_usize(tcx.tcx, self.ecx.param_env) == 0 => {}
266258
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 => {}
268261
_ => mutable_memory_in_const(tcx, "`&mut`"),
269262
}
270263
} else {
@@ -315,16 +308,16 @@ pub fn intern_const_alloc_recursive<M: CompileTimeMachine<'mir, 'tcx>>(
315308
intern_kind: InternKind,
316309
ret: MPlaceTy<'tcx>,
317310
ignore_interior_mut_in_const: bool,
318-
)
319-
where
311+
) where
320312
'tcx: 'mir,
321313
{
322314
let tcx = ecx.tcx;
323315
let base_intern_mode = match intern_kind {
324316
InternKind::Static(mutbl) => InternMode::Static(mutbl),
325317
// 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+
}
328321
};
329322

330323
// Type based interning.
@@ -362,7 +355,7 @@ where
362355
// references are "leftover"-interned, and later validation will show a proper error
363356
// and point at the right part of the value causing the problem.
364357
match res {
365-
Ok(()) => {},
358+
Ok(()) => {}
366359
Err(error) => {
367360
ecx.tcx.sess.delay_span_bug(
368361
ecx.tcx.span,
@@ -412,10 +405,9 @@ where
412405
// is tracked by const-checking.
413406
// FIXME: downgrade this to a warning? It rejects some legitimate consts,
414407
// 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");
419411
// For better errors later, mark the allocation as immutable.
420412
alloc.mutability = Mutability::Not;
421413
}
@@ -430,13 +422,10 @@ where
430422
} else if ecx.memory.dead_alloc_map.contains_key(&alloc_id) {
431423
// Codegen does not like dangling pointers, and generally `tcx` assumes that
432424
// 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");
437426
} 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.
440429
span_bug!(ecx.tcx.span, "encountered unknown alloc id {:?}", alloc_id);
441430
}
442431
}

0 commit comments

Comments
 (0)