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