File tree 3 files changed +12
-10
lines changed
3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ pub enum Command {
37
37
#[ structopt( long) ]
38
38
check : bool ,
39
39
40
- /// Any arguments to pass to `cargo check`.
40
+ /// Any arguments to pass to `cargo rustc`;
41
+ /// Cargo args (preceding `--` in `cargo rustc ... -- ...`) only.
41
42
#[ structopt( name = "Cargo args" , last = true ) ]
42
43
cargo_args : Vec < String > ,
43
44
} ,
Original file line number Diff line number Diff line change @@ -76,13 +76,17 @@ fn run_prepare_step(cargo_args: Vec<String>) -> anyhow::Result<QueryData> {
76
76
. context ( "`prepare` subcommand may only be invoked as `cargo sqlx prepare``" ) ?;
77
77
78
78
let check_status = Command :: new ( & cargo)
79
- . arg ( "check " )
79
+ . arg ( "rustc " )
80
80
. args ( cargo_args)
81
- // set an always-changing env var that the macros depend on via `env!()`
82
- . env (
83
- "__SQLX_RECOMPILE_TRIGGER" ,
84
- SystemTime :: UNIX_EPOCH . elapsed ( ) ?. as_millis ( ) . to_string ( ) ,
85
- )
81
+ . arg ( "--" )
82
+ . arg ( "--emit" )
83
+ . arg ( "dep-info,metadata" )
84
+ // set an always-changing cfg so we can consistently trigger recompile
85
+ . arg ( "--cfg" )
86
+ . arg ( format ! (
87
+ "__sqlx_recompile_trigger=\" {}\" " ,
88
+ SystemTime :: UNIX_EPOCH . elapsed( ) ?. as_millis( )
89
+ ) )
86
90
. status ( ) ?;
87
91
88
92
if !check_status. success ( ) {
Original file line number Diff line number Diff line change @@ -222,9 +222,6 @@ where
222
222
( #( $#arg_names: expr) , * ) => { {
223
223
use sqlx:: arguments:: Arguments as _;
224
224
225
- // lets `cargo sqlx prepare` ensure that we can always trigger a recompile
226
- const _: Option <& ' static str > = option_env!( "__SQLX_RECOMPILE_TRIGGER" ) ;
227
-
228
225
#args_tokens
229
226
230
227
#output
You can’t perform that action at this time.
0 commit comments