@@ -134,7 +134,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
134134 // }
135135 // ```
136136 //
137- // cc #46688
137+ // See issue #46688.
138138 def_bm = ty:: BindByValue ( hir:: MutImmutable ) ;
139139 }
140140
@@ -152,7 +152,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
152152 let ty = self . node_ty ( lt. hir_id ) ;
153153
154154 // Byte string patterns behave the same way as array patterns
155- // They can denote both statically and dynamically sized byte arrays
155+ // They can denote both statically and dynamically- sized byte arrays.
156156 let mut pat_ty = ty;
157157 if let hir:: ExprKind :: Lit ( ref lt) = lt. node {
158158 if let ast:: LitKind :: ByteStr ( _) = lt. node {
@@ -166,7 +166,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
166166 }
167167 }
168168
169- // somewhat surprising: in this case, the subtyping
169+ // Somewhat surprising: in this case, the subtyping
170170 // relation goes the opposite way as the other
171171 // cases. Actually what we really want is not a subtyping
172172 // relation at all but rather that there exists a LUB (so
@@ -177,7 +177,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
177177 //
178178 // &'static str <: expected
179179 //
180- // that's equivalent to there existing a LUB.
180+ // then that's equivalent to there existing a LUB.
181181 if let Some ( mut err) = self . demand_suptype_diag ( pat. span , expected, pat_ty) {
182182 err. emit_unless ( discrim_span
183183 . filter ( |& s| s. is_compiler_desugaring ( CompilerDesugaringKind :: IfTemporary ) )
@@ -230,7 +230,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
230230 // it to type the entire expression.
231231 let common_type = self . resolve_vars_if_possible ( & lhs_ty) ;
232232
233- // subtyping doesn't matter here, as the value is some kind of scalar
233+ // Subtyping doesn't matter here, as the value is some kind of scalar.
234234 self . demand_eqtype_pat ( pat. span , expected, lhs_ty, discrim_span) ;
235235 self . demand_eqtype_pat ( pat. span , expected, rhs_ty, discrim_span) ;
236236 common_type
@@ -250,8 +250,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
250250 let local_ty = self . local_ty ( pat. span , pat. hir_id ) . decl_ty ;
251251 match bm {
252252 ty:: BindByReference ( mutbl) => {
253- // if the binding is like
254- // ref x | ref const x | ref mut x
253+ // If the binding is like
254+ // ref x | ref const x | ref mut x
255255 // then `x` is assigned a value of type `&M T` where M is the mutability
256256 // and T is the expected type.
257257 let region_var = self . next_region_var ( infer:: PatternRegion ( pat. span ) ) ;
@@ -263,16 +263,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
263263 // an explanation.
264264 self . demand_eqtype_pat ( pat. span , region_ty, local_ty, discrim_span) ;
265265 }
266- // otherwise the type of x is the expected type T
266+ // Otherwise, the type of x is the expected type `T`.
267267 ty:: BindByValue ( _) => {
268- // As above, `T <: typeof(x)` is required but we
268+ // As above, `T <: typeof(x)` is required, but we
269269 // use equality, see (*) below.
270270 self . demand_eqtype_pat ( pat. span , expected, local_ty, discrim_span) ;
271271 }
272272 }
273273
274- // if there are multiple arms, make sure they all agree on
275- // what the type of the binding `x` ought to be
274+ // If there are multiple arms, make sure they all agree on
275+ // what the type of the binding `x` ought to be.
276276 if var_id != pat. hir_id {
277277 let vt = self . local_ty ( pat. span , var_id) . decl_ty ;
278278 self . demand_eqtype_pat ( pat. span , vt, local_ty, discrim_span) ;
@@ -880,7 +880,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
880880 // possibly incorrect trailing `;` in the else arm
881881 remove_semicolon = self . could_remove_semicolon ( block, then_ty) ;
882882 stmt. span
883- } else { // empty block, point at its entirety
883+ } else { // empty block; point at its entirety
884884 // Avoid overlapping spans that aren't as readable:
885885 // ```
886886 // 2 | let x = if true {
@@ -917,19 +917,19 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
917917 else_expr. span
918918 } ;
919919
920- // Compute `Span` of `then` part of `if`-expression:
920+ // Compute `Span` of `then` part of `if`-expression.
921921 let then_sp = if let ExprKind :: Block ( block, _) = & then_expr. node {
922922 if let Some ( expr) = & block. expr {
923923 expr. span
924924 } else if let Some ( stmt) = block. stmts . last ( ) {
925925 // possibly incorrect trailing `;` in the else arm
926926 remove_semicolon = remove_semicolon. or ( self . could_remove_semicolon ( block, else_ty) ) ;
927927 stmt. span
928- } else { // empty block, point at its entirety
929- outer_sp = None ; // same as in `error_sp`, cleanup output
928+ } else { // empty block; point at its entirety
929+ outer_sp = None ; // same as in `error_sp`; cleanup output
930930 then_expr. span
931931 }
932- } else { // shouldn't happen unless the parser has done something weird
932+ } else { // shouldn't happen unless the parser has done something weird
933933 then_expr. span
934934 } ;
935935
0 commit comments