Skip to content

Commit

Permalink
Remove uses of feature(rustc_attrs)
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jul 26, 2023
1 parent 256af91 commit 3af2b50
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 41 deletions.
1 change: 0 additions & 1 deletion .github/.cspell/project-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ IXUSR
lseek
musicpal
nlink
nonnull
norvc
nsec
OMAP
Expand Down
19 changes: 0 additions & 19 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ fn main() {
}
};

if version.nightly && is_allowed_feature("rustc_attrs") {
println!("cargo:rustc-cfg=semihosting_unstable_rustc_attrs");
}

if target_arch == "arm" {
if target.starts_with("thumb") {
target_feature_if("thumb-mode", true, &version, None, true)
Expand Down Expand Up @@ -129,21 +125,6 @@ fn target_feature_if(
}
}

fn is_allowed_feature(name: &str) -> bool {
// allowed by default
let mut allowed = true;
if let Some(rustflags) = env::var_os("CARGO_ENCODED_RUSTFLAGS") {
for mut flag in rustflags.to_string_lossy().split('\x1f') {
flag = flag.strip_prefix("-Z").unwrap_or(flag);
if let Some(flag) = flag.strip_prefix("allow-features=") {
// If it is specified multiple times, the last value will be preferred.
allowed = flag.split(',').any(|allowed| allowed == name);
}
}
}
allowed
}

mod version {
use std::{env, process::Command, str};

Expand Down
20 changes: 0 additions & 20 deletions src/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ static_assert!(core::mem::size_of::<RawFd>() == core::mem::size_of::<u16>());
/// value `-1`.
#[derive(Copy, Clone)]
#[repr(transparent)]
#[cfg_attr(semihosting_unstable_rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
#[cfg_attr(
all(semihosting_unstable_rustc_attrs, not(target_pointer_width = "16")),
rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE)
)]
#[cfg_attr(
all(semihosting_unstable_rustc_attrs, target_pointer_width = "16"),
rustc_layout_scalar_valid_range_end(0xFF_FE)
)]
#[cfg_attr(semihosting_unstable_rustc_attrs, rustc_nonnull_optimization_guaranteed)]
pub struct BorrowedFd<'fd> {
fd: RawFd,
_phantom: PhantomData<&'fd OwnedFd>,
Expand All @@ -60,16 +50,6 @@ pub struct BorrowedFd<'fd> {
/// passed as a consumed argument or returned as an owned value, and it never
/// has the value `-1`.
#[repr(transparent)]
#[cfg_attr(semihosting_unstable_rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
#[cfg_attr(
all(semihosting_unstable_rustc_attrs, not(target_pointer_width = "16")),
rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE)
)]
#[cfg_attr(
all(semihosting_unstable_rustc_attrs, target_pointer_width = "16"),
rustc_layout_scalar_valid_range_end(0xFF_FE)
)]
#[cfg_attr(semihosting_unstable_rustc_attrs, rustc_nonnull_optimization_guaranteed)]
pub struct OwnedFd {
fd: RawFd,
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ semihosting = { version = "0.1", features = ["stdio", "panic-handler"] }
)),
feature(asm_experimental_arch)
)]
#![cfg_attr(semihosting_unstable_rustc_attrs, feature(rustc_attrs))]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![allow(clippy::empty_loop)] // this crate is #![no_std]
#![allow(clippy::len_without_is_empty, clippy::new_without_default)]

// TODO: mips32r6, mips64r6?
#[cfg(not(any(
target_arch = "aarch64",
target_arch = "arm",
Expand Down

0 comments on commit 3af2b50

Please sign in to comment.