@@ -405,7 +405,7 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
405405 resolution. exts = Some (
406406 match self . cm ( ) . resolve_macro_path (
407407 & resolution. path ,
408- Some ( MacroKind :: Derive ) ,
408+ MacroKind :: Derive ,
409409 & parent_scope,
410410 true ,
411411 force,
@@ -570,7 +570,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
570570 ) -> Result < ( Arc < SyntaxExtension > , Res ) , Indeterminate > {
571571 let ( ext, res) = match self . cm ( ) . resolve_macro_or_delegation_path (
572572 path,
573- Some ( kind) ,
573+ kind,
574574 parent_scope,
575575 true ,
576576 force,
@@ -716,7 +716,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
716716 pub ( crate ) fn resolve_macro_path < ' r > (
717717 self : CmResolver < ' r , ' ra , ' tcx > ,
718718 path : & ast:: Path ,
719- kind : Option < MacroKind > ,
719+ kind : MacroKind ,
720720 parent_scope : & ParentScope < ' ra > ,
721721 trace : bool ,
722722 force : bool ,
@@ -739,7 +739,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
739739 fn resolve_macro_or_delegation_path < ' r > (
740740 mut self : CmResolver < ' r , ' ra , ' tcx > ,
741741 ast_path : & ast:: Path ,
742- kind : Option < MacroKind > ,
742+ kind : MacroKind ,
743743 parent_scope : & ParentScope < ' ra > ,
744744 trace : bool ,
745745 force : bool ,
@@ -753,7 +753,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
753753
754754 // Possibly apply the macro helper hack
755755 if deleg_impl. is_none ( )
756- && kind == Some ( MacroKind :: Bang )
756+ && kind == MacroKind :: Bang
757757 && let [ segment] = path. as_slice ( )
758758 && segment. ident . span . ctxt ( ) . outer_expn_data ( ) . local_inner_macros
759759 {
@@ -781,7 +781,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
781781 } ;
782782
783783 if trace {
784- let kind = kind. expect ( "macro kind must be specified if tracing is enabled" ) ;
785784 // FIXME: Should be an output of Speculative Resolution.
786785 self . multi_segment_macro_resolutions . borrow_mut ( ) . push ( (
787786 path,
@@ -796,10 +795,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
796795 self . prohibit_imported_non_macro_attrs ( None , res. ok ( ) , path_span) ;
797796 res
798797 } else {
799- let scope_set = kind. map_or ( ScopeSet :: All ( MacroNS ) , ScopeSet :: Macro ) ;
800798 let binding = self . reborrow ( ) . early_resolve_ident_in_lexical_scope (
801799 path[ 0 ] . ident ,
802- scope_set ,
800+ ScopeSet :: Macro ( kind ) ,
803801 parent_scope,
804802 None ,
805803 force,
@@ -811,7 +809,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
811809 }
812810
813811 if trace {
814- let kind = kind. expect ( "macro kind must be specified if tracing is enabled" ) ;
815812 // FIXME: Should be an output of Speculative Resolution.
816813 self . single_segment_macro_resolutions . borrow_mut ( ) . push ( (
817814 path[ 0 ] . ident ,
@@ -843,7 +840,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
843840 _ => None ,
844841 } ,
845842 None => self . get_macro ( res) . map ( |macro_data| match kind {
846- Some ( MacroKind :: Attr ) if let Some ( ref ext) = macro_data. attr_ext => Arc :: clone ( ext) ,
843+ MacroKind :: Attr if let Some ( ref ext) = macro_data. attr_ext => Arc :: clone ( ext) ,
847844 _ => Arc :: clone ( & macro_data. ext ) ,
848845 } ) ,
849846 } ;
0 commit comments