@@ -170,15 +170,7 @@ impl<'cfg, 'a> InstallablePackage<'cfg, 'a> {
170
170
}
171
171
} ;
172
172
173
- // When we build this package, we want to build the *specified* package only,
174
- // and avoid building e.g. workspace default-members instead. Do so by constructing
175
- // specialized compile options specific to the identified package.
176
- // See test `path_install_workspace_root_despite_default_members`.
177
- let mut opts = original_opts. clone ( ) ;
178
- let pkgidspec = PackageIdSpec :: from_package_id ( pkg. package_id ( ) ) ;
179
- opts. spec = Packages :: Packages ( vec ! [ pkgidspec. to_string( ) ] ) ;
180
-
181
- let ( ws, rustc, target) = make_ws_rustc_target ( config, & opts, & source_id, pkg. clone ( ) ) ?;
173
+ let ( ws, rustc, target) = make_ws_rustc_target ( config, & original_opts, & source_id, pkg. clone ( ) ) ?;
182
174
// If we're installing in --locked mode and there's no `Cargo.lock` published
183
175
// ie. the bin was published before https://github.com/rust-lang/cargo/pull/7026
184
176
if config. locked ( ) && !ws. root ( ) . join ( "Cargo.lock" ) . exists ( ) {
@@ -195,6 +187,16 @@ impl<'cfg, 'a> InstallablePackage<'cfg, 'a> {
195
187
ws. current ( ) ?. clone ( )
196
188
} ;
197
189
190
+ // When we build this package, we want to build the *specified* package only,
191
+ // and avoid building e.g. workspace default-members instead. Do so by constructing
192
+ // specialized compile options specific to the identified package.
193
+ // See test `path_install_workspace_root_despite_default_members`.
194
+ let mut opts = original_opts. clone ( ) ;
195
+ // Unlike install source tracking (for --git, see above), use the spec url from the
196
+ // build workspace (hence unconditional `ws.current()` instead of `pkg` to get `package_id()`).
197
+ let pkgidspec = PackageIdSpec :: from_package_id ( ws. current ( ) ?. package_id ( ) ) ;
198
+ opts. spec = Packages :: Packages ( vec ! [ pkgidspec. to_string( ) ] ) ;
199
+
198
200
if from_cwd {
199
201
if pkg. manifest ( ) . edition ( ) == Edition :: Edition2015 {
200
202
config. shell ( ) . warn (
0 commit comments