Clean up formatting.
Reflow overly long comments, plus some minor whitespace improvements.
This commit is contained in:
parent
bdacdfe95f
commit
cd3da000c0
12 changed files with 72 additions and 48 deletions
|
@ -996,7 +996,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
// To get a `*mut RcBox<Self>`, we just keep unwrapping newtypes until
|
||||
// we get a value of a built-in pointer type.
|
||||
//
|
||||
// This is also relevant for `Pin<&mut Self>`, where we need to peel the `Pin`.
|
||||
// This is also relevant for `Pin<&mut Self>`, where we need to peel the
|
||||
// `Pin`.
|
||||
while !op.layout.ty.is_unsafe_ptr() && !op.layout.ty.is_ref() {
|
||||
let (idx, _) = op.layout.non_1zst_field(bx).expect(
|
||||
"not exactly one non-1-ZST field in a `DispatchFromDyn` type",
|
||||
|
@ -1004,9 +1005,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
op = op.extract_field(bx, idx);
|
||||
}
|
||||
|
||||
// now that we have `*dyn Trait` or `&dyn Trait`, split it up into its
|
||||
// Now that we have `*dyn Trait` or `&dyn Trait`, split it up into its
|
||||
// data pointer and vtable. Look up the method in the vtable, and pass
|
||||
// the data pointer as the first argument
|
||||
// the data pointer as the first argument.
|
||||
llfn = Some(meth::VirtualIndex::from_index(idx).get_fn(
|
||||
bx,
|
||||
meta,
|
||||
|
@ -1440,8 +1441,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
let (mut llval, align, by_ref) = match op.val {
|
||||
Immediate(_) | Pair(..) => match arg.mode {
|
||||
PassMode::Indirect { attrs, .. } => {
|
||||
// Indirect argument may have higher alignment requirements than the type's alignment.
|
||||
// This can happen, e.g. when passing types with <4 byte alignment on the stack on x86.
|
||||
// Indirect argument may have higher alignment requirements than the type's
|
||||
// alignment. This can happen, e.g. when passing types with <4 byte alignment
|
||||
// on the stack on x86.
|
||||
let required_align = match attrs.pointee_align {
|
||||
Some(pointee_align) => cmp::max(pointee_align, arg.layout.align.abi),
|
||||
None => arg.layout.align.abi,
|
||||
|
|
|
@ -32,7 +32,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
/// that the given `constant` is an `Const::Unevaluated` and must be convertible to
|
||||
/// a `ValTree`. If you want a more general version of this, talk to `wg-const-eval` on zulip.
|
||||
///
|
||||
/// Note that this function is cursed, since usually MIR consts should not be evaluated to valtrees!
|
||||
/// Note that this function is cursed, since usually MIR consts should not be evaluated to
|
||||
/// valtrees!
|
||||
fn eval_unevaluated_mir_constant_to_valtree(
|
||||
&self,
|
||||
constant: &mir::ConstOperand<'tcx>,
|
||||
|
@ -40,19 +41,19 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
let uv = match self.monomorphize(constant.const_) {
|
||||
mir::Const::Unevaluated(uv, _) => uv.shrink(),
|
||||
mir::Const::Ty(_, c) => match c.kind() {
|
||||
// A constant that came from a const generic but was then used as an argument to old-style
|
||||
// simd_shuffle (passing as argument instead of as a generic param).
|
||||
// A constant that came from a const generic but was then used as an argument to
|
||||
// old-style simd_shuffle (passing as argument instead of as a generic param).
|
||||
rustc_type_ir::ConstKind::Value(_, valtree) => return Ok(Ok(valtree)),
|
||||
other => span_bug!(constant.span, "{other:#?}"),
|
||||
},
|
||||
// We should never encounter `Const::Val` unless MIR opts (like const prop) evaluate
|
||||
// a constant and write that value back into `Operand`s. This could happen, but is unlikely.
|
||||
// Also: all users of `simd_shuffle` are on unstable and already need to take a lot of care
|
||||
// around intrinsics. For an issue to happen here, it would require a macro expanding to a
|
||||
// `simd_shuffle` call without wrapping the constant argument in a `const {}` block, but
|
||||
// the user pass through arbitrary expressions.
|
||||
// FIXME(oli-obk): replace the magic const generic argument of `simd_shuffle` with a real
|
||||
// const generic, and get rid of this entire function.
|
||||
// a constant and write that value back into `Operand`s. This could happen, but is
|
||||
// unlikely. Also: all users of `simd_shuffle` are on unstable and already need to take
|
||||
// a lot of care around intrinsics. For an issue to happen here, it would require a
|
||||
// macro expanding to a `simd_shuffle` call without wrapping the constant argument in a
|
||||
// `const {}` block, but the user pass through arbitrary expressions.
|
||||
// FIXME(oli-obk): replace the magic const generic argument of `simd_shuffle` with a
|
||||
// real const generic, and get rid of this entire function.
|
||||
other => span_bug!(constant.span, "{other:#?}"),
|
||||
};
|
||||
let uv = self.monomorphize(uv);
|
||||
|
|
|
@ -24,6 +24,7 @@ pub struct FunctionDebugContext<'tcx, S, L> {
|
|||
/// Maps from an inlined function to its debug info declaration.
|
||||
pub inlined_function_scopes: FxHashMap<Instance<'tcx>, S>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum VariableKind {
|
||||
ArgumentVariable(usize /*index*/),
|
||||
|
|
|
@ -478,8 +478,8 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> {
|
|||
debug!("OperandRef::store: operand={:?}, dest={:?}", self, dest);
|
||||
match self {
|
||||
OperandValue::ZeroSized => {
|
||||
// Avoid generating stores of zero-sized values, because the only way to have a zero-sized
|
||||
// value is through `undef`/`poison`, and the store itself is useless.
|
||||
// Avoid generating stores of zero-sized values, because the only way to have a
|
||||
// zero-sized value is through `undef`/`poison`, and the store itself is useless.
|
||||
}
|
||||
OperandValue::Ref(val) => {
|
||||
assert!(dest.layout.is_sized(), "cannot directly store unsized values");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue