remove repr(transparent) check from build.rs

This commit is contained in:
Trevor Spiteri 2019-02-02 20:20:53 +01:00
parent b20969dc6d
commit 8bfc52c3ab
2 changed files with 6 additions and 17 deletions

View File

@ -5,6 +5,9 @@
// the copyright notice and this notice are preserved. This file is // the copyright notice and this notice are preserved. This file is
// offered as-is, without any warranty. // offered as-is, without any warranty.
#![allow(dead_code)]
#![allow(unused_variables)]
use std::env; use std::env;
use std::ffi::OsString; use std::ffi::OsString;
use std::fs::{self, File}; use std::fs::{self, File};
@ -22,12 +25,7 @@ fn main() {
out_dir: PathBuf::from(cargo_env("OUT_DIR")), out_dir: PathBuf::from(cargo_env("OUT_DIR")),
rustc: cargo_env("RUSTC"), rustc: cargo_env("RUSTC"),
}; };
env.check_feature( // env.check_feature(...);
"repr_transparent",
Optional(false),
TRY_REPR_TRANSPARENT,
Some("repr_transparent"),
);
} }
#[derive(PartialEq)] #[derive(PartialEq)]
@ -37,7 +35,7 @@ impl Environment {
// 1. If optional feature is availble (both with and without flag), output: // 1. If optional feature is availble (both with and without flag), output:
// cargo:rustc-cfg=<name> // cargo:rustc-cfg=<name>
// 2. If feature is available with flag (both optional and not), output: // 2. If feature is available with flag (both optional and not), output:
// cargo:rustc-cfg_nightly=<name> // cargo:rustc-cfg=nightly_<name>
// 3. If non-optional feature is not available, panic. // 3. If non-optional feature is not available, panic.
fn check_feature( fn check_feature(
&self, &self,
@ -78,7 +76,7 @@ impl Environment {
.status() .status()
.unwrap_or_else(|_| panic!("Unable to execute: {:?}", cmd)); .unwrap_or_else(|_| panic!("Unable to execute: {:?}", cmd));
if status.success() { if status.success() {
if !optional.0 { if optional.0 {
println!("cargo:rustc-cfg={}", name); println!("cargo:rustc-cfg={}", name);
} }
if *i == Iteration::Unstable { if *i == Iteration::Unstable {
@ -129,11 +127,3 @@ fn create_file_or_panic(filename: &Path, contents: &str) {
file.write_all(contents.as_bytes()) file.write_all(contents.as_bytes())
.unwrap_or_else(|_| panic!("Unable to write to file: {:?}", filename)); .unwrap_or_else(|_| panic!("Unable to write to file: {:?}", filename));
} }
const TRY_REPR_TRANSPARENT: &str = r#"// try_repr_transparent.rs
#[repr(transparent)]
struct Foo(i32);
fn main() {
let _ = Foo(12);
}
"#;

View File

@ -185,7 +185,6 @@ additional terms or conditions.
#![warn(missing_docs)] #![warn(missing_docs)]
#![doc(html_root_url = "https://docs.rs/fixed/0.2.1")] #![doc(html_root_url = "https://docs.rs/fixed/0.2.1")]
#![doc(test(attr(deny(warnings))))] #![doc(test(attr(deny(warnings))))]
#![cfg_attr(nightly_repr_transparent, feature(repr_transparent))]
#![cfg_attr(feature = "fail-on-warnings", deny(warnings))] #![cfg_attr(feature = "fail-on-warnings", deny(warnings))]
#[cfg(feature = "f16")] #[cfg(feature = "f16")]