File tree 2 files changed +6
-27
lines changed
compiler/rustc_builtin_macros/src
2 files changed +6
-27
lines changed Original file line number Diff line number Diff line change 3
3
//! configs (autodiff enabled or disabled), so we have to add cfg's to each import.
4
4
//! FIXME(ZuseZ4): Remove this once we have a smarter linter.
5
5
6
- #[ cfg( llvm_enzyme) ]
7
6
mod llvm_enzyme {
8
7
use std:: str:: FromStr ;
9
8
use std:: string:: String ;
@@ -130,6 +129,11 @@ mod llvm_enzyme {
130
129
meta_item : & ast:: MetaItem ,
131
130
mut item : Annotatable ,
132
131
) -> Vec < Annotatable > {
132
+
133
+ if cfg ! ( not( llvm_enzyme) ) {
134
+ ecx. sess . dcx ( ) . emit_err ( errors:: AutoDiffSupportNotBuild { span : meta_item. span } ) ;
135
+ return vec ! [ item] ;
136
+ }
133
137
let dcx = ecx. sess . dcx ( ) ;
134
138
// first get the annotable item:
135
139
let ( sig, is_impl) : ( FnSig , bool ) = match & item {
@@ -801,25 +805,4 @@ mod llvm_enzyme {
801
805
}
802
806
}
803
807
804
- #[ cfg( not( llvm_enzyme) ) ]
805
- mod ad_fallback {
806
- use rustc_ast:: ast;
807
- use rustc_expand:: base:: { Annotatable , ExtCtxt } ;
808
- use rustc_span:: Span ;
809
-
810
- use crate :: errors;
811
- pub ( crate ) fn expand (
812
- ecx : & mut ExtCtxt < ' _ > ,
813
- _expand_span : Span ,
814
- meta_item : & ast:: MetaItem ,
815
- item : Annotatable ,
816
- ) -> Vec < Annotatable > {
817
- ecx. sess . dcx ( ) . emit_err ( errors:: AutoDiffSupportNotBuild { span : meta_item. span } ) ;
818
- return vec ! [ item] ;
819
- }
820
- }
821
-
822
- #[ cfg( not( llvm_enzyme) ) ]
823
- pub ( crate ) use ad_fallback:: expand;
824
- #[ cfg( llvm_enzyme) ]
825
- pub ( crate ) use llvm_enzyme:: expand;
808
+ pub ( crate ) use llvm_enzyme:: expand;
Original file line number Diff line number Diff line change @@ -144,10 +144,8 @@ pub(crate) struct AllocMustStatics {
144
144
pub ( crate ) span : Span ,
145
145
}
146
146
147
- #[ cfg( llvm_enzyme) ]
148
147
pub ( crate ) use autodiff:: * ;
149
148
150
- #[ cfg( llvm_enzyme) ]
151
149
mod autodiff {
152
150
use super :: * ;
153
151
#[ derive( Diagnostic ) ]
@@ -203,9 +201,7 @@ mod autodiff {
203
201
}
204
202
}
205
203
206
- #[ cfg( not( llvm_enzyme) ) ]
207
204
pub ( crate ) use ad_fallback:: * ;
208
- #[ cfg( not( llvm_enzyme) ) ]
209
205
mod ad_fallback {
210
206
use super :: * ;
211
207
#[ derive( Diagnostic ) ]
You can’t perform that action at this time.
0 commit comments