File tree 3 files changed +34
-1
lines changed
3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,11 @@ continuous integration systems.",
75
75
76
76
pub fn exec ( config : & mut Config , args : & ArgMatches ) -> CliResult {
77
77
let mut compile_opts = args. compile_options ( config, CompileMode :: Build ) ?;
78
+
79
+ // for `cargo-install` we want to use what the user specified via `--target` and ignore what's
80
+ // in `.cargo/config` and what the environment says
81
+ compile_opts. build_config . requested_target = args. target ( ) ;
82
+
78
83
compile_opts. build_config . release = !args. is_present ( "debug" ) ;
79
84
80
85
let krates = args. values_of ( "crate" )
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ check-revoke = true # Indicates whether SSL certs are checked for revocation
100
100
jobs = 1 # number of parallel jobs, defaults to # of CPUs
101
101
rustc = " rustc" # the rust compiler tool
102
102
rustdoc = " rustdoc" # the doc generator tool
103
- target = " triple" # build for the target triple
103
+ target = " triple" # build for the target triple (ignored by `cargo install`)
104
104
target-dir = " target" # path of where to place all generated artifacts
105
105
rustflags = [" .." , " .." ] # custom flags to pass to all compiler invocations
106
106
incremental = true # whether or not to enable incremental compilation
Original file line number Diff line number Diff line change @@ -1237,3 +1237,31 @@ warning: be sure to add `[..]` to your PATH to be able to run the installed bina
1237
1237
" ,
1238
1238
) . run ( ) ;
1239
1239
}
1240
+
1241
+ #[ test]
1242
+ fn install_ignores_cargo_config ( ) {
1243
+ pkg ( "bar" , "0.0.1" ) ;
1244
+
1245
+ let p = project ( )
1246
+ . file (
1247
+ "Cargo.toml" ,
1248
+ r#"
1249
+ [package]
1250
+ name = "foo"
1251
+ version = "0.1.0"
1252
+ authors = []
1253
+ "# ,
1254
+ )
1255
+ . file (
1256
+ ".cargo/config" ,
1257
+ r#"
1258
+ [build]
1259
+ target = "non-existing-target"
1260
+ "# ,
1261
+ )
1262
+ . file ( "src/main.rs" , "fn main() {}" )
1263
+ . build ( ) ;
1264
+
1265
+ cargo_process ( "install bar" ) . cwd ( p. root ( ) ) . with_status ( 0 ) . run ( ) ;
1266
+ assert_has_installed_exe ( cargo_home ( ) , "bar" ) ;
1267
+ }
You can’t perform that action at this time.
0 commit comments