X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Fmiddle%2Fresolve.rs;h=950b374b2c4fe5a0d286bc6397f5685cd5bc5782;hb=1813b8cf550772d84c1737a048bccccc79730a5b;hp=6fa33f4b5aa03206944834b46f795f7999eb66d6;hpb=49dd8e8c366f492d3ba3d0d2fd9d943f92073a18;p=rust.git diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 6fa33f4b5aa..950b374b2c4 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -270,8 +270,8 @@ enum TypeParameters<'a> { RibKind) } -// The rib kind controls the translation of argument or local definitions -// (`def_arg` or `def_local`) to upvars (`def_upvar`). +// The rib kind controls the translation of local +// definitions (`DefLocal`) to upvars (`DefUpvar`). enum RibKind { // No translation needs to be applied. @@ -1895,8 +1895,7 @@ fn handle_external_def(&mut self, ignoring {:?}", def); // Ignored; handled elsewhere. } - DefArg(..) | DefLocal(..) | DefPrimTy(..) | - DefTyParam(..) | DefBinding(..) | + DefLocal(..) | DefPrimTy(..) | DefTyParam(..) | DefUse(..) | DefUpvar(..) | DefRegion(..) | DefTyParamBinder(..) | DefLabel(..) | DefSelfTy(..) => { fail!("didn't expect `{:?}`", def); @@ -3840,8 +3839,7 @@ fn upvarify(&self, let is_ty_param; match def_like { - DlDef(d @ DefLocal(..)) | DlDef(d @ DefUpvar(..)) | - DlDef(d @ DefArg(..)) | DlDef(d @ DefBinding(..)) => { + DlDef(d @ DefLocal(..)) | DlDef(d @ DefUpvar(..)) => { def = d; is_ty_param = false; } @@ -4942,22 +4940,7 @@ struct or enum variant", debug!("(resolving pattern) binding `{}`", token::get_name(renamed)); - let def = match mode { - RefutableMode => { - // For pattern arms, we must use - // `def_binding` definitions. - - DefBinding(pattern.id, binding_mode) - } - LocalIrrefutableMode => { - // But for locals, we use `def_local`. - DefLocal(pattern.id, binding_mode) - } - ArgumentIrrefutableMode => { - // And for function arguments, `def_arg`. - DefArg(pattern.id, binding_mode) - } - }; + let def = DefLocal(pattern.id, binding_mode); // Record the definition so that later passes // will be able to distinguish variants from