Skip to content

Commit

Permalink
Look for underscored name in rust 1.79
Browse files Browse the repository at this point in the history
  • Loading branch information
tamird committed Mar 21, 2024
1 parent d662d4c commit ab1f321
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ anyhow = "1.0.72"
cargo_metadata = "0.18.0"
prettyplease = "0.2.10"
quote = "1.0.29"
rustversion = "1.0"
syn = { version = "2.0.26", features = ["full"] }
10 changes: 9 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ mod llvm {

impl Generator {
pub fn parse_llvm_sys_crate(&mut self) -> Result<&mut Self, Error> {
// See https://github.com/rust-lang/cargo/pull/12783.

#[rustversion::before(1.79)]
const LLVM_SYS_CRATE_TARGET: &str = "llvm-sys";

#[rustversion::since(1.79)]
const LLVM_SYS_CRATE_TARGET: &str = "llvm_sys";

let metadata = MetadataCommand::new()
.exec()
.context("Unable to get crate metadata")?;
Expand All @@ -72,7 +80,7 @@ mod llvm {
targets
.into_iter()
.find_map(|Target { name, src_path, .. }| {
(name == "llvm-sys").then_some(src_path)
(name == LLVM_SYS_CRATE_TARGET).then_some(src_path)
})
})
.flatten()
Expand Down

0 comments on commit ab1f321

Please sign in to comment.