-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[style] rustfmt matches with comments in or-patterns
#156518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -454,13 +454,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { | |
| OperandValue::Pair(lldata, llextra) | ||
| } | ||
| mir::CastKind::PointerCoercion( | ||
| PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer, _ | ||
| PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer, | ||
| _, | ||
| ) => { | ||
| bug!("{kind:?} is for borrowck, and should never appear in codegen"); | ||
| } | ||
| mir::CastKind::PtrToPtr | ||
| if bx.cx().is_backend_scalar_pair(operand.layout) => | ||
| { | ||
| mir::CastKind::PtrToPtr if bx.cx().is_backend_scalar_pair(operand.layout) => { | ||
| if let OperandValue::Pair(data_ptr, meta) = operand.val { | ||
| if bx.cx().is_backend_scalar_pair(cast) { | ||
| OperandValue::Pair(data_ptr, meta) | ||
|
|
@@ -483,7 +482,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { | |
| // path as the other integer-to-X casts. | ||
| | mir::CastKind::PointerWithExposedProvenance => { | ||
| let imm = operand.immediate(); | ||
| let abi::BackendRepr::Scalar(from_scalar) = operand.layout.backend_repr else { | ||
| let abi::BackendRepr::Scalar(from_scalar) = operand.layout.backend_repr | ||
| else { | ||
| bug!("Found non-scalar for operand {operand:?}"); | ||
| }; | ||
| let from_backend_ty = bx.cx().immediate_backend_type(operand.layout); | ||
|
|
@@ -498,11 +498,18 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { | |
| bug!("Found non-scalar for cast {cast:?}"); | ||
| }; | ||
|
|
||
| self.cast_immediate(bx, imm, from_scalar, from_backend_ty, to_scalar, to_backend_ty) | ||
| .map(OperandValue::Immediate) | ||
| .unwrap_or_else(|| { | ||
| bug!("Unsupported cast of {operand:?} to {cast:?}"); | ||
| }) | ||
| self.cast_immediate( | ||
| bx, | ||
| imm, | ||
| from_scalar, | ||
| from_backend_ty, | ||
| to_scalar, | ||
| to_backend_ty, | ||
| ) | ||
| .map(OperandValue::Immediate) | ||
| .unwrap_or_else(|| { | ||
| bug!("Unsupported cast of {operand:?} to {cast:?}"); | ||
| }) | ||
| } | ||
| mir::CastKind::Transmute | mir::CastKind::Subtype => { | ||
| self.codegen_transmute_operand(bx, operand, cast) | ||
|
|
@@ -553,6 +560,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { | |
| move_annotation: None, | ||
| } | ||
| } | ||
|
|
||
| mir::Rvalue::BinaryOp(op, (ref lhs, ref rhs)) => { | ||
|
Comment on lines
+563
to
564
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the extra blank lines manual or did rustfmt do this? Here and elsewhere.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe these were manual. I did that once to keep consistency throughout a single match expression. |
||
| let lhs = self.codegen_operand(bx, lhs); | ||
| let rhs = self.codegen_operand(bx, rhs); | ||
|
|
@@ -666,7 +674,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { | |
| }; | ||
| OperandRef { val: OperandValue::Immediate(static_), layout, move_annotation: None } | ||
| } | ||
|
|
||
| mir::Rvalue::Use(ref operand, _) => self.codegen_operand(bx, operand), | ||
|
|
||
| mir::Rvalue::Repeat(ref elem, len_const) => { | ||
| // All arrays have `BackendRepr::Memory`, so only the ZST cases | ||
| // end up here. Anything else forces the destination local to be | ||
|
|
@@ -682,6 +692,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { | |
| move_annotation: None, | ||
| } | ||
| } | ||
|
|
||
| mir::Rvalue::Aggregate(ref kind, ref fields) => { | ||
| let (variant_index, active_field_index) = match **kind { | ||
| mir::AggregateKind::Adt(_, variant_index, _, _, active_field_index) => { | ||
|
|
@@ -719,12 +730,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { | |
| } | ||
| } | ||
| } | ||
|
|
||
| mir::Rvalue::WrapUnsafeBinder(ref operand, binder_ty) => { | ||
| let operand = self.codegen_operand(bx, operand); | ||
| let binder_ty = self.monomorphize(binder_ty); | ||
| let layout = bx.cx().layout_of(binder_ty); | ||
| OperandRef { val: operand.val, layout, move_annotation: None } | ||
| } | ||
|
|
||
| mir::Rvalue::CopyForDeref(_) => bug!("`CopyForDeref` in codegen"), | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all these and the P[i] comments in the right place? Looks like they're below the arms they're talking about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved them around to where I think they belong (both comments were shifted one down).