@@ -10,51 +10,35 @@ use rustc_span::symbol::sym;
1010use rustc_span:: Span ;
1111use rustc_target:: spec:: abi;
1212use thin_vec:: ThinVec ;
13- use tracing:: debug;
1413
1514use crate :: errors;
1615
1716macro_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( ) ;
2520 }
2621 } } ;
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( ) ;
3425 }
3526 } } ;
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) ;
4630 }
4731 } } ;
4832}
4933
5034macro_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)
5337 } ;
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)
5640 } ;
57- ( future_incompatible; $visitor: expr, $feature: ident, $span: expr, $explain: expr) => {
41+ ( future_incompatible; $visitor: expr, $feature: ident, $span: expr, $explain: expr) => {
5842 gate_feature_fn!( future_incompatible; $visitor, |x: & Features | x. $feature, $span, sym:: $feature, $explain)
5943 } ;
6044}
0 commit comments