X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_typeck%2Fcheck%2F_match.rs;h=5ffe34d61bf7d72243f3d9a70997cd3e0d779fa4;hb=5dc91a74b1428cf3d09a868727bf20b347664137;hp=cd7012cd4ec6ddb6919360d757703819629fe7a6;hpb=74185aff27a2cfed37ea553242f6e7248c820a8c;p=rust.git diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index cd7012cd4ec..5ffe34d61bf 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -9,7 +9,7 @@ // except according to those terms. use middle::def; -use middle::infer; +use middle::infer::{self, TypeOrigin}; use middle::pat_util::{PatIdMap, pat_id_map, pat_is_binding}; use middle::pat_util::pat_is_resolved_const; use middle::privacy::{AllPublic, LastMod}; @@ -25,6 +25,7 @@ use std::cmp; use std::collections::hash_map::Entry::{Occupied, Vacant}; use syntax::ast; +use syntax::ext::mtwt; use syntax::codemap::{Span, Spanned}; use syntax::ptr::P; @@ -179,7 +180,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>, // if there are multiple arms, make sure they all agree on // what the type of the binding `x` ought to be - let canon_id = *pcx.map.get(&path.node.name).unwrap(); + let canon_id = *pcx.map.get(&mtwt::resolve(path.node)).unwrap(); if canon_id != pat.id { let ct = fcx.local_ty(pat.span, canon_id); demand::eqtype(fcx, pat.span, ct, typ); @@ -508,12 +509,12 @@ pub fn check_match<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, /* if-let construct without an else block */ hir::MatchSource::IfLetDesugar { contains_else_clause } if !contains_else_clause => ( - infer::IfExpressionWithNoElse(expr.span), + TypeOrigin::IfExpressionWithNoElse(expr.span), bty, result_ty, ), _ => ( - infer::MatchExpressionArm(expr.span, arm.body.span, match_src), + TypeOrigin::MatchExpressionArm(expr.span, arm.body.span, match_src), result_ty, bty, ),