File tree Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5
5
6
6
## Unreleased
7
7
8
+ ### Added
9
+
10
+ - New method ` Toolchain::rustup_binary ` to allow running arbitrary binaries managed by rustup. Before, only ` rustc ` and ` cargo ` could be run.
11
+
8
12
## [ 0.12.0] - 2021-01-28
9
13
10
14
### Added
11
15
12
16
- New variant ` PrepareError::MissingDependencies ` , returned during the prepare
13
17
step when a dependency does not exist.
14
-
15
18
### Changed
16
19
17
20
- Path dependencies are no longer removed from ` Cargo.toml ` during the prepare
Original file line number Diff line number Diff line change @@ -400,10 +400,7 @@ impl Toolchain {
400
400
/// # }
401
401
/// ```
402
402
pub fn cargo ( & self ) -> impl Runnable + ' _ {
403
- RustupProxy {
404
- toolchain : self ,
405
- name : "cargo" ,
406
- }
403
+ self . rustup_binary ( "cargo" )
407
404
}
408
405
409
406
/// Return a runnable object configured to run `rustc` with this toolchain. This method is
@@ -424,9 +421,29 @@ impl Toolchain {
424
421
/// # }
425
422
/// ```
426
423
pub fn rustc ( & self ) -> impl Runnable + ' _ {
424
+ self . rustup_binary ( "rustc" )
425
+ }
426
+
427
+ /// Return a runnable object configured to run `name` with this toolchain. This method is
428
+ /// intended to be used with [`rustwide::cmd::Command`](cmd/struct.Command.html).
429
+ ///
430
+ /// # Example
431
+ ///
432
+ /// ```no_run
433
+ /// # use rustwide::{WorkspaceBuilder, Toolchain, cmd::Command};
434
+ /// # use std::error::Error;
435
+ /// # fn main() -> Result<(), Box<dyn Error>> {
436
+ /// # let workspace = WorkspaceBuilder::new("".as_ref(), "").init()?;
437
+ /// let toolchain = Toolchain::dist("beta");
438
+ /// Command::new(&workspace, toolchain.rustup_binary("rustdoc"))
439
+ /// .args(&["hello.rs"])
440
+ /// .run()?;
441
+ /// # Ok(())
442
+ /// # }
443
+ pub fn rustup_binary ( & self , name : & ' static str ) -> impl Runnable + ' _ {
427
444
RustupProxy {
428
445
toolchain : self ,
429
- name : "rustc" ,
446
+ name,
430
447
}
431
448
}
432
449
You can’t perform that action at this time.
0 commit comments