@@ -19,6 +19,7 @@ use cargo::util::important_paths::find_root_manifest_for_wd;
19
19
20
20
use getopts:: { Matches , Options } ;
21
21
22
+ use std:: env;
22
23
use std:: io:: Write ;
23
24
use std:: path:: PathBuf ;
24
25
use std:: process:: { Stdio , Command } ;
@@ -114,11 +115,21 @@ impl<'a> WorkInfo<'a> {
114
115
}
115
116
116
117
/// Obtain the paths to the produced rlib and the dependency output directory.
117
- fn rlib_and_dep_output ( & self , config : & ' a Config , name : & str )
118
+ fn rlib_and_dep_output ( & self , config : & ' a Config , name : & str , current : bool )
118
119
-> CargoResult < ( PathBuf , PathBuf ) >
119
120
{
120
121
let opts = CompileOptions :: default ( config, CompileMode :: Build ) ;
122
+
123
+ if current {
124
+ env:: set_var ( "RUSTFLAGS" , "-C metadata=new" ) ;
125
+ } else {
126
+ env:: set_var ( "RUSTFLAGS" , "-C metadata=old" ) ;
127
+ }
128
+
121
129
let compilation = compile ( & self . workspace , & opts) ?;
130
+
131
+ env:: remove_var ( "RUSTFLAGS" ) ;
132
+
122
133
let rlib = compilation. libraries [ self . package . package_id ( ) ]
123
134
. iter ( )
124
135
. find ( |t| t. 0 . name ( ) == name)
@@ -185,8 +196,8 @@ fn do_main(config: &Config, matches: &Matches) -> CargoResult<()> {
185
196
( work_info, stable_crate. max_version . clone ( ) )
186
197
} ;
187
198
188
- let ( current_rlib, current_deps_output) = current. rlib_and_dep_output ( config, & name) ?;
189
- let ( stable_rlib, stable_deps_output) = stable. rlib_and_dep_output ( config, & name) ?;
199
+ let ( current_rlib, current_deps_output) = current. rlib_and_dep_output ( config, & name, true ) ?;
200
+ let ( stable_rlib, stable_deps_output) = stable. rlib_and_dep_output ( config, & name, false ) ?;
190
201
191
202
if matches. opt_present ( "d" ) {
192
203
println ! ( "--extern old={} -L{} --extern new={} -L{}" ,
0 commit comments