Skip to content

Commit 4e42c81

Browse files
committed
Make sure dogfood recompiled the driver
1 parent b8f95b7 commit 4e42c81

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

cargo-marker/src/driver.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn print_driver_version() {
4141
}
4242

4343
/// This tries to install the rustc driver specified in [`DEFAULT_DRIVER_INFO`].
44-
pub fn install_driver(verbose: bool) -> Result<(), ExitStatus> {
44+
pub fn install_driver(verbose: bool, dev_build: bool) -> Result<(), ExitStatus> {
4545
// The toolchain, driver version and api version should ideally be configurable.
4646
// However, that will require more prototyping and has a low priority rn.
4747
// See #60
@@ -50,12 +50,7 @@ pub fn install_driver(verbose: bool) -> Result<(), ExitStatus> {
5050
let toolchain = &DEFAULT_DRIVER_INFO.toolchain;
5151
check_toolchain(toolchain)?;
5252

53-
build_driver(
54-
toolchain,
55-
&DEFAULT_DRIVER_INFO.version,
56-
verbose,
57-
cfg!(feature = "dev-build"),
58-
)?;
53+
build_driver(toolchain, &DEFAULT_DRIVER_INFO.version, verbose, dev_build)?;
5954

6055
// We don't want to advice the user, to install the driver again.
6156
check_driver(verbose, false)

cargo-marker/src/main.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,27 @@ fn main() -> Result<(), ExitStatus> {
7878
);
7979

8080
let verbose = matches.get_flag("verbose");
81+
let dev_build = cfg!(feature = "dev-build");
8182

8283
if matches.get_flag("version") {
8384
print_version(verbose);
8485
return Ok(());
8586
}
8687

8788
match matches.subcommand() {
88-
Some(("setup", _args)) => driver::install_driver(verbose),
89-
Some(("check", args)) => run_check(args, verbose),
90-
None => run_check(&matches, verbose),
89+
Some(("setup", _args)) => driver::install_driver(verbose, dev_build),
90+
Some(("check", args)) => run_check(args, verbose, dev_build),
91+
None => run_check(&matches, verbose, dev_build),
9192
_ => unreachable!(),
9293
}
9394
}
9495

95-
fn run_check(matches: &clap::ArgMatches, verbose: bool) -> Result<(), ExitStatus> {
96+
fn run_check(matches: &clap::ArgMatches, verbose: bool, dev_build: bool) -> Result<(), ExitStatus> {
97+
// If this is a dev build, we want to recompile the driver before checking
98+
if dev_build {
99+
driver::install_driver(verbose, dev_build)?;
100+
}
101+
96102
let mut lint_crates = vec![];
97103
if let Some(cmd_lint_crates) = matches.get_many::<OsString>("lints") {
98104
println!();

0 commit comments

Comments
 (0)