@@ -132,7 +132,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
132132 // }
133133 // ```
134134 //
135- // cc #46688
135+ // See issue #46688.
136136 def_bm = ty:: BindByValue ( hir:: MutImmutable ) ;
137137 }
138138
@@ -150,7 +150,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
150150 let ty = self . node_ty ( lt. hir_id ) ;
151151
152152 // Byte string patterns behave the same way as array patterns
153- // They can denote both statically and dynamically sized byte arrays
153+ // They can denote both statically and dynamically- sized byte arrays.
154154 let mut pat_ty = ty;
155155 if let hir:: ExprKind :: Lit ( ref lt) = lt. node {
156156 if let ast:: LitKind :: ByteStr ( _) = lt. node {
@@ -164,7 +164,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
164164 }
165165 }
166166
167- // somewhat surprising: in this case, the subtyping
167+ // Somewhat surprising: in this case, the subtyping
168168 // relation goes the opposite way as the other
169169 // cases. Actually what we really want is not a subtyping
170170 // relation at all but rather that there exists a LUB (so
@@ -175,7 +175,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
175175 //
176176 // &'static str <: expected
177177 //
178- // that's equivalent to there existing a LUB.
178+ // then that's equivalent to there existing a LUB.
179179 if let Some ( mut err) = self . demand_suptype_diag ( pat. span , expected, pat_ty) {
180180 err. emit_unless ( discrim_span
181181 . filter ( |& s| s. is_compiler_desugaring ( CompilerDesugaringKind :: IfTemporary ) )
@@ -228,7 +228,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
228228 // it to type the entire expression.
229229 let common_type = self . resolve_vars_if_possible ( & lhs_ty) ;
230230
231- // subtyping doesn't matter here, as the value is some kind of scalar
231+ // Subtyping doesn't matter here, as the value is some kind of scalar.
232232 self . demand_eqtype_pat ( pat. span , expected, lhs_ty, discrim_span) ;
233233 self . demand_eqtype_pat ( pat. span , expected, rhs_ty, discrim_span) ;
234234 common_type
@@ -248,8 +248,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
248248 let local_ty = self . local_ty ( pat. span , pat. hir_id ) . decl_ty ;
249249 match bm {
250250 ty:: BindByReference ( mutbl) => {
251- // if the binding is like
252- // ref x | ref const x | ref mut x
251+ // If the binding is like
252+ // ref x | ref const x | ref mut x
253253 // then `x` is assigned a value of type `&M T` where M is the mutability
254254 // and T is the expected type.
255255 let region_var = self . next_region_var ( infer:: PatternRegion ( pat. span ) ) ;
@@ -261,16 +261,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
261261 // an explanation.
262262 self . demand_eqtype_pat ( pat. span , region_ty, local_ty, discrim_span) ;
263263 }
264- // otherwise the type of x is the expected type T
264+ // Otherwise, the type of x is the expected type `T`.
265265 ty:: BindByValue ( _) => {
266- // As above, `T <: typeof(x)` is required but we
266+ // As above, `T <: typeof(x)` is required, but we
267267 // use equality, see (*) below.
268268 self . demand_eqtype_pat ( pat. span , expected, local_ty, discrim_span) ;
269269 }
270270 }
271271
272- // if there are multiple arms, make sure they all agree on
273- // what the type of the binding `x` ought to be
272+ // If there are multiple arms, make sure they all agree on
273+ // what the type of the binding `x` ought to be.
274274 if var_id != pat. hir_id {
275275 let vt = self . local_ty ( pat. span , var_id) . decl_ty ;
276276 self . demand_eqtype_pat ( pat. span , vt, local_ty, discrim_span) ;
@@ -878,7 +878,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
878878 // possibly incorrect trailing `;` in the else arm
879879 remove_semicolon = self . could_remove_semicolon ( block, then_ty) ;
880880 stmt. span
881- } else { // empty block, point at its entirety
881+ } else { // empty block; point at its entirety
882882 // Avoid overlapping spans that aren't as readable:
883883 // ```
884884 // 2 | let x = if true {
@@ -915,19 +915,19 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
915915 else_expr. span
916916 } ;
917917
918- // Compute `Span` of `then` part of `if`-expression:
918+ // Compute `Span` of `then` part of `if`-expression.
919919 let then_sp = if let ExprKind :: Block ( block, _) = & then_expr. node {
920920 if let Some ( expr) = & block. expr {
921921 expr. span
922922 } else if let Some ( stmt) = block. stmts . last ( ) {
923923 // possibly incorrect trailing `;` in the else arm
924924 remove_semicolon = remove_semicolon. or ( self . could_remove_semicolon ( block, else_ty) ) ;
925925 stmt. span
926- } else { // empty block, point at its entirety
927- outer_sp = None ; // same as in `error_sp`, cleanup output
926+ } else { // empty block; point at its entirety
927+ outer_sp = None ; // same as in `error_sp`; cleanup output
928928 then_expr. span
929929 }
930- } else { // shouldn't happen unless the parser has done something weird
930+ } else { // shouldn't happen unless the parser has done something weird
931931 then_expr. span
932932 } ;
933933
0 commit comments