Skip to content

Commit 0a864eb

Browse files
authored
Merge pull request rust-lang#142 from MarkMcCaskey/master
Store LLVM version info directly in internal_macros
2 parents 885b487 + d9efd66 commit 0a864eb

File tree

4 files changed

+6
-56
lines changed

4 files changed

+6
-56
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ edition = "2018"
1212

1313
[features]
1414
default = ["target-all"]
15+
# Please update internal_macros::FEATURE_VERSIONS when adding a new LLVM version
1516
llvm3-6 = []
1617
llvm3-7 = []
1718
llvm3-8 = []

internal_macros/Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.1.0"
44
authors = ["Daniel Kolsoi <[email protected]>"]
55
description = "Internal macro crate for inkwell"
66
edition = "2018"
7-
build = "build.rs"
87
repository = "https://github.com/TheDan64/inkwell"
98
readme = "README.md"
109
license = "Apache-2.0"
@@ -14,9 +13,5 @@ quote = "0.6"
1413
syn = { version = "0.15", features = ["full", "fold"] }
1514
proc-macro2 = "0.4"
1615

17-
[build-dependencies]
18-
cargo_toml = "0.8"
19-
reqwest = "0.9"
20-
2116
[lib]
2217
proc-macro = true

internal_macros/build.rs

Lines changed: 0 additions & 41 deletions
This file was deleted.

internal_macros/src/lib.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,9 @@ use syn::fold::Fold;
1818
use syn::spanned::Spanned;
1919
use syn::{Token, LitFloat, Ident, Item, Field, Variant, Attribute};
2020

21-
const FEATURES_ENV: &str = env!("INKWELL_FEATURES");
22-
23-
/// Fetches a vector of feature version strings, e.g. llvm8-0
24-
fn get_feature_versions() -> Vec<&'static str> {
25-
FEATURES_ENV
26-
.split(',')
27-
.collect()
28-
}
21+
// This array should match the LLVM features in the top level Cargo manifest
22+
const FEATURE_VERSIONS: [&str; 9] =
23+
["llvm3-6", "llvm3-7", "llvm3-8", "llvm3-9", "llvm4-0", "llvm5-0", "llvm6-0", "llvm7-0", "llvm8-0"];
2924

3025
/// Gets the index of the feature version that represents `latest`
3126
fn get_latest_feature_index(features: &[&str]) -> usize {
@@ -43,7 +38,7 @@ fn get_feature_index(features: &[&str], feature: String, span: Span) -> Result<u
4338

4439
/// Gets a vector of feature versions represented by the given VersionType
4540
fn get_features(vt: VersionType) -> Result<Vec<&'static str>> {
46-
let features = get_feature_versions();
41+
let features = FEATURE_VERSIONS;
4742
let latest = get_latest_feature_index(&features);
4843
match vt {
4944
VersionType::Specific(version, span) => {
@@ -189,7 +184,7 @@ struct FeatureSet(Vec<&'static str>, Option<Error>);
189184
impl Default for FeatureSet {
190185
fn default() -> Self {
191186
// Default to all versions
192-
Self(get_feature_versions(), None)
187+
Self(FEATURE_VERSIONS.to_vec(), None)
193188
}
194189
}
195190
impl Parse for FeatureSet {

0 commit comments

Comments
 (0)