@@ -405,7 +405,7 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
405
405
resolution. exts = Some (
406
406
match self . cm ( ) . resolve_macro_path (
407
407
& resolution. path ,
408
- Some ( MacroKind :: Derive ) ,
408
+ MacroKind :: Derive ,
409
409
& parent_scope,
410
410
true ,
411
411
force,
@@ -570,7 +570,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
570
570
) -> Result < ( Arc < SyntaxExtension > , Res ) , Indeterminate > {
571
571
let ( ext, res) = match self . cm ( ) . resolve_macro_or_delegation_path (
572
572
path,
573
- Some ( kind) ,
573
+ kind,
574
574
parent_scope,
575
575
true ,
576
576
force,
@@ -716,7 +716,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
716
716
pub ( crate ) fn resolve_macro_path < ' r > (
717
717
self : CmResolver < ' r , ' ra , ' tcx > ,
718
718
path : & ast:: Path ,
719
- kind : Option < MacroKind > ,
719
+ kind : MacroKind ,
720
720
parent_scope : & ParentScope < ' ra > ,
721
721
trace : bool ,
722
722
force : bool ,
@@ -739,7 +739,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
739
739
fn resolve_macro_or_delegation_path < ' r > (
740
740
mut self : CmResolver < ' r , ' ra , ' tcx > ,
741
741
ast_path : & ast:: Path ,
742
- kind : Option < MacroKind > ,
742
+ kind : MacroKind ,
743
743
parent_scope : & ParentScope < ' ra > ,
744
744
trace : bool ,
745
745
force : bool ,
@@ -753,7 +753,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
753
753
754
754
// Possibly apply the macro helper hack
755
755
if deleg_impl. is_none ( )
756
- && kind == Some ( MacroKind :: Bang )
756
+ && kind == MacroKind :: Bang
757
757
&& let [ segment] = path. as_slice ( )
758
758
&& segment. ident . span . ctxt ( ) . outer_expn_data ( ) . local_inner_macros
759
759
{
@@ -781,7 +781,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
781
781
} ;
782
782
783
783
if trace {
784
- let kind = kind. expect ( "macro kind must be specified if tracing is enabled" ) ;
785
784
// FIXME: Should be an output of Speculative Resolution.
786
785
self . multi_segment_macro_resolutions . borrow_mut ( ) . push ( (
787
786
path,
@@ -796,10 +795,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
796
795
self . prohibit_imported_non_macro_attrs ( None , res. ok ( ) , path_span) ;
797
796
res
798
797
} else {
799
- let scope_set = kind. map_or ( ScopeSet :: All ( MacroNS ) , ScopeSet :: Macro ) ;
800
798
let binding = self . reborrow ( ) . early_resolve_ident_in_lexical_scope (
801
799
path[ 0 ] . ident ,
802
- scope_set ,
800
+ ScopeSet :: Macro ( kind ) ,
803
801
parent_scope,
804
802
None ,
805
803
force,
@@ -811,7 +809,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
811
809
}
812
810
813
811
if trace {
814
- let kind = kind. expect ( "macro kind must be specified if tracing is enabled" ) ;
815
812
// FIXME: Should be an output of Speculative Resolution.
816
813
self . single_segment_macro_resolutions . borrow_mut ( ) . push ( (
817
814
path[ 0 ] . ident ,
@@ -843,7 +840,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
843
840
_ => None ,
844
841
} ,
845
842
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) ,
847
844
_ => Arc :: clone ( & macro_data. ext ) ,
848
845
} ) ,
849
846
} ;
0 commit comments