Sha256: dba46ae4291317fb644ba2143f44eaf54a8ab946ba1367a33d055d694715f68a

Contents?: true

Size: 1012 Bytes

Versions: 8

Compression:

Stored size: 1012 Bytes

Contents

use std::env;
use std::process::Command;
use std::str;

fn main() {
    println!("cargo:rerun-if-changed=build.rs");

    let version = match rustc_version() {
        Some(version) => version,
        None => return,
    };

    if version.minor >= 80 {
        println!("cargo:rustc-check-cfg=cfg(no_literal_fromstr)");
        println!("cargo:rustc-check-cfg=cfg(feature, values(\"protocol_feature_paste\"))");
    }

    if version.minor < 54 {
        // https://github.com/rust-lang/rust/pull/84717
        println!("cargo:rustc-cfg=no_literal_fromstr");
    }
}

struct RustcVersion {
    minor: u32,
}

fn rustc_version() -> Option<RustcVersion> {
    let rustc = env::var_os("RUSTC")?;
    let output = Command::new(rustc).arg("--version").output().ok()?;
    let version = str::from_utf8(&output.stdout).ok()?;
    let mut pieces = version.split('.');
    if pieces.next() != Some("rustc 1") {
        return None;
    }
    let minor = pieces.next()?.parse().ok()?;
    Some(RustcVersion { minor })
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/paste-1.0.15/build.rs
wasmtime-28.0.0 ./ext/cargo-vendor/paste-1.0.15/build.rs
wasmtime-27.0.0 ./ext/cargo-vendor/paste-1.0.15/build.rs
wasmtime-26.0.0 ./ext/cargo-vendor/paste-1.0.15/build.rs
wasmtime-25.0.2 ./ext/cargo-vendor/paste-1.0.15/build.rs
wasmtime-25.0.1 ./ext/cargo-vendor/paste-1.0.15/build.rs
wasmtime-25.0.0 ./ext/cargo-vendor/paste-1.0.15/build.rs
wasmtime-24.0.0 ./ext/cargo-vendor/paste-1.0.15/build.rs