Skip to content

Commit

Permalink
Merge pull request #28 from aya-rs/fix-build-1.79-nightly
Browse files Browse the repository at this point in the history
Fix build in rust 1.79
  • Loading branch information
tamird authored Mar 21, 2024
2 parents d662d4c + 418d60c commit 30f00a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aya-rustc-llvm-proxy"
version = "0.9.1"
version = "0.9.2"
authors = ["Alessandro Decina <[email protected]>"]
description = "Dynamically proxy LLVM calls into Rust own shared library"
license = "MIT"
Expand All @@ -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 30f00a5

Please sign in to comment.