@@ -10,51 +10,35 @@ use rustc_span::symbol::sym;
10
10
use rustc_span:: Span ;
11
11
use rustc_target:: spec:: abi;
12
12
use thin_vec:: ThinVec ;
13
- use tracing:: debug;
14
13
15
14
use crate :: errors;
16
15
17
16
macro_rules! gate_feature_fn {
18
- ( $visitor: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr, $help: expr) => { {
19
- let ( visitor, has_feature, span, name, explain, help) =
20
- ( & * $visitor, $has_feature, $span, $name, $explain, $help) ;
21
- let has_feature: bool = has_feature( visitor. features) ;
22
- debug!( "gate_feature(feature = {:?}, span = {:?}); has? {}" , name, span, has_feature) ;
23
- if !has_feature && !span. allows_unstable( $name) {
24
- feature_err( & visitor. sess. parse_sess, name, span, explain) . help( help) . emit( ) ;
17
+ ( $visitor: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr, $help: expr) => { {
18
+ if !$has_feature( $visitor. features) && !$span. allows_unstable( $name) {
19
+ feature_err( & $visitor. sess. parse_sess, $name, $span, $explain) . help( $help) . emit( ) ;
25
20
}
26
21
} } ;
27
- ( $visitor: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr) => { {
28
- let ( visitor, has_feature, span, name, explain) =
29
- ( & * $visitor, $has_feature, $span, $name, $explain) ;
30
- let has_feature: bool = has_feature( visitor. features) ;
31
- debug!( "gate_feature(feature = {:?}, span = {:?}); has? {}" , name, span, has_feature) ;
32
- if !has_feature && !span. allows_unstable( $name) {
33
- feature_err( & visitor. sess. parse_sess, name, span, explain) . emit( ) ;
22
+ ( $visitor: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr) => { {
23
+ if !$has_feature( $visitor. features) && !$span. allows_unstable( $name) {
24
+ feature_err( & $visitor. sess. parse_sess, $name, $span, $explain) . emit( ) ;
34
25
}
35
26
} } ;
36
- ( future_incompatible; $visitor: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr) => { {
37
- let ( visitor, has_feature, span, name, explain) =
38
- ( & * $visitor, $has_feature, $span, $name, $explain) ;
39
- let has_feature: bool = has_feature( visitor. features) ;
40
- debug!(
41
- "gate_feature(feature = {:?}, span = {:?}); has? {} (future_incompatible)" ,
42
- name, span, has_feature
43
- ) ;
44
- if !has_feature && !span. allows_unstable( $name) {
45
- feature_warn( & visitor. sess. parse_sess, name, span, explain) ;
27
+ ( future_incompatible; $visitor: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr) => { {
28
+ if !$has_feature( $visitor. features) && !$span. allows_unstable( $name) {
29
+ feature_warn( & $visitor. sess. parse_sess, $name, $span, $explain) ;
46
30
}
47
31
} } ;
48
32
}
49
33
50
34
macro_rules! gate_feature_post {
51
- ( $visitor: expr, $feature: ident, $span: expr, $explain: expr, $help: expr) => {
52
- gate_feature_fn!( $visitor, |x: & Features | x. $feature, $span, sym:: $feature, $explain, $help)
35
+ ( $visitor: expr, $feature: ident, $span: expr, $explain: expr, $help: expr) => {
36
+ gate_feature_fn!( $visitor, |x: & Features | x. $feature, $span, sym:: $feature, $explain, $help)
53
37
} ;
54
- ( $visitor: expr, $feature: ident, $span: expr, $explain: expr) => {
55
- gate_feature_fn!( $visitor, |x: & Features | x. $feature, $span, sym:: $feature, $explain)
38
+ ( $visitor: expr, $feature: ident, $span: expr, $explain: expr) => {
39
+ gate_feature_fn!( $visitor, |x: & Features | x. $feature, $span, sym:: $feature, $explain)
56
40
} ;
57
- ( future_incompatible; $visitor: expr, $feature: ident, $span: expr, $explain: expr) => {
41
+ ( future_incompatible; $visitor: expr, $feature: ident, $span: expr, $explain: expr) => {
58
42
gate_feature_fn!( future_incompatible; $visitor, |x: & Features | x. $feature, $span, sym:: $feature, $explain)
59
43
} ;
60
44
}
0 commit comments