Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Incorporate suggestion from #1799
  • Loading branch information
smoelius committed Dec 10, 2025
commit 60fdb028ce5244f9b32dbac0f74f035160b3ab56
52 changes: 26 additions & 26 deletions dylint/src/driver_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,6 @@ Deleting this directory will cause Dylint to rebuild the drivers
the next time it needs them, but will have no ill effects.
";

fn cargo_toml(toolchain: &str, dylint_driver_spec: &str) -> String {
format!(
r#"
[package]
name = "dylint_driver-{toolchain}"
version = "0.1.0"
edition = "2018"

[dependencies]
anyhow = "1.0"
env_logger = "0.11"
dylint_driver = {{ {dylint_driver_spec} }}
"#,
)
}

fn rust_toolchain(toolchain: &str) -> String {
format!(
r#"
[toolchain]
channel = "{toolchain}"
components = ["llvm-tools-preview", "rustc-dev"]
"#,
)
}

// smoelius: We need `#![feature(rustc_private)]` as it changes `dylib` linking behavior and allows
// us to link to `rustc_driver`. See: https://github.com/rust-lang/rust/pull/122362
const MAIN_RS: &str = r"
Expand Down Expand Up @@ -238,6 +212,32 @@ fn initialize(toolchain: &str, package: &Path) -> Result<()> {
Ok(())
}

fn cargo_toml(toolchain: &str, dylint_driver_spec: &str) -> String {
format!(
r#"
[package]
name = "dylint_driver-{toolchain}"
version = "0.1.0"
edition = "2018"

[dependencies]
anyhow = "1.0"
env_logger = "0.11"
dylint_driver = {{ {dylint_driver_spec} }}
"#,
)
}

fn rust_toolchain(toolchain: &str) -> String {
format!(
r#"
[toolchain]
channel = "{toolchain}"
components = ["llvm-tools-preview", "rustc-dev"]
"#,
)
}

#[allow(clippy::unwrap_used)]
#[cfg(test)]
mod test {
Expand Down