@@ -2654,23 +2654,22 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
26542654 let pat_id = pattern. id ;
26552655 walk_pat ( pattern, |pattern| {
26562656 match pattern. node {
2657- PatIdent ( binding_mode, ref path1, _) => {
2658-
2659- // The meaning of pat_ident with no type parameters
2657+ PatIdent ( binding_mode, ref path1, ref at_rhs) => {
2658+ // The meaning of PatIdent with no type parameters
26602659 // depends on whether an enum variant or unit-like struct
26612660 // with that name is in scope. The probing lookup has to
26622661 // be careful not to emit spurious errors. Only matching
26632662 // patterns (match) can match nullary variants or
2664- // unit-like structs. For binding patterns (let), matching
2665- // such a value is simply disallowed (since it's rarely
2666- // what you want).
2663+ // unit-like structs. For binding patterns (let
2664+ // and the LHS of @-patterns), matching such a value is
2665+ // simply disallowed (since it's rarely what you want).
2666+ let const_ok = mode == RefutableMode && at_rhs. is_none ( ) ;
26672667
26682668 let ident = path1. node ;
26692669 let renamed = mtwt:: resolve ( ident) ;
26702670
26712671 match self . resolve_bare_identifier_pattern ( ident. name , pattern. span ) {
2672- FoundStructOrEnumVariant ( def, lp)
2673- if mode == RefutableMode => {
2672+ FoundStructOrEnumVariant ( def, lp) if const_ok => {
26742673 debug ! ( "(resolving pattern) resolving `{}` to \
26752674 struct or enum variant",
26762675 renamed) ;
@@ -2693,7 +2692,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
26932692 renamed)
26942693 ) ;
26952694 }
2696- FoundConst ( def, lp) if mode == RefutableMode => {
2695+ FoundConst ( def, lp) if const_ok => {
26972696 debug ! ( "(resolving pattern) resolving `{}` to \
26982697 constant",
26992698 renamed) ;
0 commit comments