]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/_match.rs
Merge pull request #20674 from jbcrail/fix-misspelled-comments
[rust.git] / src / librustc_typeck / check / _match.rs
index c5b5325e9d441ca980ce914701fb3d04ff3da955..d9829fd14168c5fc48d82649a8e2b3217f3e13b6 100644 (file)
@@ -97,7 +97,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
 
             fcx.write_ty(pat.id, lhs_ty);
 
-            // subtyping doens't matter here, as the value is some kind of scalar
+            // subtyping doesn't matter here, as the value is some kind of scalar
             demand::eqtype(fcx, pat.span, expected, lhs_ty);
         }
         ast::PatEnum(..) | ast::PatIdent(..) if pat_is_const(&tcx.def_map, pat) => {
@@ -195,10 +195,10 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
         ast::PatRegion(ref inner, mutbl) => {
             let inner_ty = fcx.infcx().next_ty_var();
 
-            // SNAP c894171 remove this `if`-`else` entirely after next snapshot
+            // SNAP 340ac04 remove this `if`-`else` entirely after next snapshot
             let mutbl = if mutbl == ast::MutImmutable {
                 ty::deref(fcx.infcx().shallow_resolve(expected), true)
-                   .map(|mt| mt.mutbl).unwrap_or(ast::MutImmutable);
+                   .map(|mt| mt.mutbl).unwrap_or(ast::MutImmutable)
             } else {
                 mutbl
             };
@@ -505,9 +505,10 @@ pub fn check_pat_enum<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>, pat: &ast::Pat,
 
     let ctor_scheme = ty::lookup_item_type(tcx, enum_def);
     let path_scheme = if ty::is_fn_ty(ctor_scheme.ty) {
+        let fn_ret = ty::assert_no_late_bound_regions(tcx, &ty::ty_fn_ret(ctor_scheme.ty));
         ty::TypeScheme {
-            ty: ty::ty_fn_ret(ctor_scheme.ty).unwrap(),
-            ..ctor_scheme
+            ty: fn_ret.unwrap(),
+            generics: ctor_scheme.generics,
         }
     } else {
         ctor_scheme
@@ -603,7 +604,7 @@ pub fn check_struct_pat_fields<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
 
     // Typecheck each field.
     for &Spanned { node: ref field, span } in fields.iter() {
-        let field_type = match used_fields.entry(&field.ident.name) {
+        let field_type = match used_fields.entry(field.ident.name) {
             Occupied(occupied) => {
                 span_err!(tcx.sess, span, E0025,
                     "field `{}` bound multiple times in the pattern",