Skip to content

Commit db72534

Browse files
committed
build: relax lifetime restrictions when creating new commands
1 parent ed421a6 commit db72534

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
### Changed
99

1010
- `winapi` is no longer required on unix; `nix` is no longer required on windows.
11+
- Relaxed lifetime restrictions of `Build::cmd` and `Build::cargo`.
1112

1213
## [0.9.0] - 2020-07-01
1314

src/build.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ impl BuildDirectory {
188188
/// API to interact with a running build.
189189
///
190190
/// This is created from [`BuildDirectory::build`](struct.BuildDirectory.html#method.build)
191-
pub struct Build<'b> {
192-
dir: &'b BuildDirectory,
193-
toolchain: &'b Toolchain,
191+
pub struct Build<'ws> {
192+
dir: &'ws BuildDirectory,
193+
toolchain: &'ws Toolchain,
194194
sandbox: SandboxBuilder,
195195
}
196196

197-
impl Build<'_> {
197+
impl<'ws> Build<'ws> {
198198
/// Run a command inside the sandbox.
199199
///
200200
/// Any `cargo` invocation will automatically be configured to use a target directory mounted
@@ -219,7 +219,7 @@ impl Build<'_> {
219219
/// # Ok(())
220220
/// # }
221221
/// ```
222-
pub fn cmd<R: Runnable>(&self, bin: R) -> Command {
222+
pub fn cmd<'pl, R: Runnable>(&self, bin: R) -> Command<'ws, 'pl> {
223223
let container_dir = &*crate::cmd::container_dirs::TARGET_DIR;
224224

225225
Command::new_sandboxed(
@@ -256,7 +256,7 @@ impl Build<'_> {
256256
/// # Ok(())
257257
/// # }
258258
/// ```
259-
pub fn cargo(&self) -> Command {
259+
pub fn cargo<'pl>(&self) -> Command<'ws, 'pl> {
260260
self.cmd(self.toolchain.cargo())
261261
}
262262

0 commit comments

Comments
 (0)