1
1
use rustc_ast:: tokenstream:: TokenStream ;
2
2
use rustc_attr_parsing as attr;
3
3
use rustc_expand:: base:: { DummyResult , ExpandResult , ExtCtxt , MacroExpanderResult } ;
4
- use rustc_parse:: parser:: cfg_select:: { CfgSelectBranches , CfgSelectRule , parse_cfg_select} ;
4
+ use rustc_parse:: parser:: cfg_select:: { CfgSelectBranches , CfgSelectPredicate , parse_cfg_select} ;
5
5
use rustc_span:: { Ident , Span , sym} ;
6
6
7
7
use crate :: errors:: { CfgSelectNoMatches , CfgSelectUnreachable } ;
8
8
9
- /// Selects the first arm whose rule evaluates to true.
9
+ /// Selects the first arm whose predicate evaluates to true.
10
10
fn select_arm ( ecx : & ExtCtxt < ' _ > , branches : CfgSelectBranches ) -> Option < ( TokenStream , Span ) > {
11
11
for ( cfg, tt, arm_span) in branches. reachable {
12
12
if attr:: cfg_matches (
@@ -30,11 +30,11 @@ pub(super) fn expand_cfg_select<'cx>(
30
30
ExpandResult :: Ready ( match parse_cfg_select ( & mut ecx. new_parser_from_tts ( tts) ) {
31
31
Ok ( branches) => {
32
32
if let Some ( ( underscore, _, _) ) = branches. wildcard {
33
- // Warn for every unreachable rule . We store the fully parsed branch for rustfmt.
34
- for ( rule , _, _) in & branches. unreachable {
35
- let span = match rule {
36
- CfgSelectRule :: Wildcard ( underscore) => underscore. span ,
37
- CfgSelectRule :: Cfg ( cfg) => cfg. span ( ) ,
33
+ // Warn for every unreachable predicate . We store the fully parsed branch for rustfmt.
34
+ for ( predicate , _, _) in & branches. unreachable {
35
+ let span = match predicate {
36
+ CfgSelectPredicate :: Wildcard ( underscore) => underscore. span ,
37
+ CfgSelectPredicate :: Cfg ( cfg) => cfg. span ( ) ,
38
38
} ;
39
39
let err = CfgSelectUnreachable { span, wildcard_span : underscore. span } ;
40
40
ecx. dcx ( ) . emit_warn ( err) ;
@@ -50,7 +50,7 @@ pub(super) fn expand_cfg_select<'cx>(
50
50
Ident :: with_dummy_span ( sym:: cfg_select) ,
51
51
) ;
52
52
} else {
53
- // Emit a compiler error when none of the rules matched.
53
+ // Emit a compiler error when none of the predicates matched.
54
54
let guar = ecx. dcx ( ) . emit_err ( CfgSelectNoMatches { span : sp } ) ;
55
55
DummyResult :: any ( sp, guar)
56
56
}
0 commit comments