Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to edition 2018, allow internal_features #547

Merged
merged 3 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ readme = "README.md"
repository = "https://github.com/rust-lang/compiler-builtins"
homepage = "https://github.com/rust-lang/compiler-builtins"
documentation = "https://docs.rs/compiler_builtins"
edition = "2018"
description = """
Compiler intrinsics used by the Rust compiler. Also available for other targets
if necessary!
Expand Down
1 change: 1 addition & 0 deletions examples/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#![allow(unused_features)]
#![allow(stable_features)] // bench_black_box feature is stable, leaving for backcompat
#![allow(internal_features)]
klensy marked this conversation as resolved.
Show resolved Hide resolved
#![cfg_attr(thumb, no_main)]
#![deny(dead_code)]
#![feature(bench_black_box)]
Expand Down
6 changes: 3 additions & 3 deletions src/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ intrinsics! {
#[weak]
#[cfg(not(target_os = "ios"))]
pub unsafe extern "aapcs" fn __aeabi_memcpy(dest: *mut u8, src: *const u8, n: usize) {
::mem::memcpy(dest, src, n);
crate::mem::memcpy(dest, src, n);
}

#[weak]
Expand Down Expand Up @@ -121,7 +121,7 @@ intrinsics! {
#[weak]
#[cfg(not(target_os = "ios"))]
pub unsafe extern "aapcs" fn __aeabi_memmove(dest: *mut u8, src: *const u8, n: usize) {
::mem::memmove(dest, src, n);
crate::mem::memmove(dest, src, n);
}

#[weak]
Expand All @@ -140,7 +140,7 @@ intrinsics! {
#[cfg(not(target_os = "ios"))]
pub unsafe extern "aapcs" fn __aeabi_memset(dest: *mut u8, n: usize, c: i32) {
// Note the different argument order
::mem::memset(dest, c, n);
crate::mem::memset(dest, c, n);
}

#[weak]
Expand Down
4 changes: 2 additions & 2 deletions src/float/add.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use float::Float;
use int::{CastInto, Int};
use crate::float::Float;
use crate::int::{CastInto, Int};

/// Returns `a + b`
fn add<F: Float>(a: F, b: F) -> F
Expand Down
4 changes: 2 additions & 2 deletions src/float/cmp.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(unreachable_code)]

use float::Float;
use int::Int;
use crate::float::Float;
use crate::int::Int;

#[derive(Clone, Copy)]
enum Result {
Expand Down
4 changes: 2 additions & 2 deletions src/float/div.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// `return`s makes it clear where function exit points are
#![allow(clippy::needless_return)]

use float::Float;
use int::{CastInto, DInt, HInt, Int};
use crate::float::Float;
use crate::int::{CastInto, DInt, HInt, Int};

fn div32<F: Float>(a: F, b: F) -> F
where
Expand Down
4 changes: 2 additions & 2 deletions src/float/extend.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use float::Float;
use int::{CastInto, Int};
use crate::float::Float;
use crate::int::{CastInto, Int};

/// Generic conversion from a narrower to a wider IEEE-754 floating-point type
fn extend<F: Float, R: Float>(a: F) -> R
Expand Down
4 changes: 2 additions & 2 deletions src/float/mul.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use float::Float;
use int::{CastInto, DInt, HInt, Int};
use crate::float::Float;
use crate::int::{CastInto, DInt, HInt, Int};

fn mul<F: Float>(a: F, b: F) -> F
where
Expand Down
4 changes: 2 additions & 2 deletions src/float/pow.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use float::Float;
use int::Int;
use crate::float::Float;
use crate::int::Int;

/// Returns `a` raised to the power `b`
fn pow<F: Float>(a: F, b: i32) -> F {
Expand Down
6 changes: 3 additions & 3 deletions src/float/sub.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use float::add::__adddf3;
use float::add::__addsf3;
use float::Float;
use crate::float::add::__adddf3;
use crate::float::add::__addsf3;
use crate::float::Float;

intrinsics! {
#[arm_aeabi_alias = __aeabi_fsub]
Expand Down
4 changes: 2 additions & 2 deletions src/float/trunc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use float::Float;
use int::{CastInto, Int};
use crate::float::Float;
use crate::int::{CastInto, Int};

fn trunc<F: Float, R: Float>(a: F) -> R
where
Expand Down
2 changes: 1 addition & 1 deletion src/int/addsub.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use int::{DInt, Int};
use crate::int::{DInt, Int};

trait UAddSub: DInt {
fn uadd(self, other: Self) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/int/mul.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use int::{DInt, HInt, Int};
use crate::int::{DInt, HInt, Int};

trait Mul: DInt
where
Expand Down
2 changes: 1 addition & 1 deletion src/int/sdiv.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use int::udiv::*;
use crate::int::udiv::*;

macro_rules! sdivmod {
(
Expand Down
2 changes: 1 addition & 1 deletion src/int/shift.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use int::{DInt, HInt, Int};
use crate::int::{DInt, HInt, Int};

trait Ashl: DInt {
/// Returns `a << b`, requires `b < Self::BITS`
Expand Down
4 changes: 4 additions & 0 deletions src/int/specialized_div_rem/binary_long.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ macro_rules! impl_binary_long {
$n:tt, // the number of bits in a $iX or $uX
$uX:ident, // unsigned integer type for the inputs and outputs of `$fn`
$iX:ident // signed integer type with same bitwidth as `$uX`
$(, $fun_attr:meta)* // attributes for the function
) => {
/// Computes the quotient and remainder of `duo` divided by `div` and returns them as a
/// tuple.
$(
#[$fun_attr]
)*
pub fn $fn(duo: $uX, div: $uX) -> ($uX, $uX) {
let mut duo = duo;
// handle edge cases before calling `$normalization_shift`
Expand Down
3 changes: 2 additions & 1 deletion src/int/specialized_div_rem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,5 +306,6 @@ impl_binary_long!(
u32_normalization_shift,
32,
u32,
i32
i32,
allow(dead_code)
);
4 changes: 2 additions & 2 deletions src/int/udiv.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#[cfg(not(feature = "public-test-deps"))]
pub(crate) use int::specialized_div_rem::*;
pub(crate) use crate::int::specialized_div_rem::*;

#[cfg(feature = "public-test-deps")]
pub use int::specialized_div_rem::*;
pub use crate::int::specialized_div_rem::*;

intrinsics! {
#[maybe_use_optimized_c_shim]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#![no_builtins]
#![no_std]
#![allow(unused_features)]
#![allow(internal_features)]
// We use `u128` in a whole bunch of places which we currently agree with the
// compiler on ABIs and such, so we should be "good enough" for now and changes
// to the `u128` ABI will be reflected here.
Expand Down
8 changes: 4 additions & 4 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,10 @@ macro_rules! intrinsics {
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
#[cfg_attr(feature = "weak-intrinsics", linkage = "weak")]
pub extern $abi fn $name( $($argname: $ty),* )
-> ::macros::win64_128bit_abi_hack::U64x2
-> $crate::macros::win64_128bit_abi_hack::U64x2
{
let e: $($ret)? = super::$name($($argname),*);
::macros::win64_128bit_abi_hack::U64x2::from(e)
$crate::macros::win64_128bit_abi_hack::U64x2::from(e)
}
}

Expand Down Expand Up @@ -540,15 +540,15 @@ pub mod win64_128bit_abi_hack {

impl From<i128> for U64x2 {
fn from(i: i128) -> U64x2 {
use int::DInt;
use crate::int::DInt;
let j = i as u128;
U64x2(j.lo(), j.hi())
}
}

impl From<u128> for U64x2 {
fn from(i: u128) -> U64x2 {
use int::DInt;
use crate::int::DInt;
U64x2(i.lo(), i.hi())
}
}
Expand Down
1 change: 1 addition & 0 deletions src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#[path = "../libm/src/math/mod.rs"]
mod libm;

#[allow(unused_macros)]
macro_rules! no_mangle {
($(fn $fun:ident($($iid:ident : $ity:ty),+) -> $oty:ty;)+) => {
intrinsics! {
Expand Down