Skip to content

Commit 50baa9f

Browse files
authored
Merge pull request #547 from klensy/edition-up
2 parents efd227f + 1ac3230 commit 50baa9f

21 files changed

+40
-31
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ readme = "README.md"
77
repository = "https://github.com/rust-lang/compiler-builtins"
88
homepage = "https://github.com/rust-lang/compiler-builtins"
99
documentation = "https://docs.rs/compiler_builtins"
10+
edition = "2018"
1011
description = """
1112
Compiler intrinsics used by the Rust compiler. Also available for other targets
1213
if necessary!

examples/intrinsics.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#![allow(unused_features)]
77
#![allow(stable_features)] // bench_black_box feature is stable, leaving for backcompat
8+
#![allow(internal_features)]
89
#![cfg_attr(thumb, no_main)]
910
#![deny(dead_code)]
1011
#![feature(bench_black_box)]

src/arm.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ intrinsics! {
9191
#[weak]
9292
#[cfg(not(target_os = "ios"))]
9393
pub unsafe extern "aapcs" fn __aeabi_memcpy(dest: *mut u8, src: *const u8, n: usize) {
94-
::mem::memcpy(dest, src, n);
94+
crate::mem::memcpy(dest, src, n);
9595
}
9696

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

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

146146
#[weak]

src/float/add.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use float::Float;
2-
use int::{CastInto, Int};
1+
use crate::float::Float;
2+
use crate::int::{CastInto, Int};
33

44
/// Returns `a + b`
55
fn add<F: Float>(a: F, b: F) -> F

src/float/cmp.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(unreachable_code)]
22

3-
use float::Float;
4-
use int::Int;
3+
use crate::float::Float;
4+
use crate::int::Int;
55

66
#[derive(Clone, Copy)]
77
enum Result {

src/float/div.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// `return`s makes it clear where function exit points are
33
#![allow(clippy::needless_return)]
44

5-
use float::Float;
6-
use int::{CastInto, DInt, HInt, Int};
5+
use crate::float::Float;
6+
use crate::int::{CastInto, DInt, HInt, Int};
77

88
fn div32<F: Float>(a: F, b: F) -> F
99
where

src/float/extend.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use float::Float;
2-
use int::{CastInto, Int};
1+
use crate::float::Float;
2+
use crate::int::{CastInto, Int};
33

44
/// Generic conversion from a narrower to a wider IEEE-754 floating-point type
55
fn extend<F: Float, R: Float>(a: F) -> R

src/float/mul.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use float::Float;
2-
use int::{CastInto, DInt, HInt, Int};
1+
use crate::float::Float;
2+
use crate::int::{CastInto, DInt, HInt, Int};
33

44
fn mul<F: Float>(a: F, b: F) -> F
55
where

src/float/pow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use float::Float;
2-
use int::Int;
1+
use crate::float::Float;
2+
use crate::int::Int;
33

44
/// Returns `a` raised to the power `b`
55
fn pow<F: Float>(a: F, b: i32) -> F {

src/float/sub.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use float::add::__adddf3;
2-
use float::add::__addsf3;
3-
use float::Float;
1+
use crate::float::add::__adddf3;
2+
use crate::float::add::__addsf3;
3+
use crate::float::Float;
44

55
intrinsics! {
66
#[arm_aeabi_alias = __aeabi_fsub]

src/float/trunc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use float::Float;
2-
use int::{CastInto, Int};
1+
use crate::float::Float;
2+
use crate::int::{CastInto, Int};
33

44
fn trunc<F: Float, R: Float>(a: F) -> R
55
where

src/int/addsub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use int::{DInt, Int};
1+
use crate::int::{DInt, Int};
22

33
trait UAddSub: DInt {
44
fn uadd(self, other: Self) -> Self {

src/int/mul.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use int::{DInt, HInt, Int};
1+
use crate::int::{DInt, HInt, Int};
22

33
trait Mul: DInt
44
where

src/int/sdiv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use int::udiv::*;
1+
use crate::int::udiv::*;
22

33
macro_rules! sdivmod {
44
(

src/int/shift.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use int::{DInt, HInt, Int};
1+
use crate::int::{DInt, HInt, Int};
22

33
trait Ashl: DInt {
44
/// Returns `a << b`, requires `b < Self::BITS`

src/int/specialized_div_rem/binary_long.rs

+4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ macro_rules! impl_binary_long {
1313
$n:tt, // the number of bits in a $iX or $uX
1414
$uX:ident, // unsigned integer type for the inputs and outputs of `$fn`
1515
$iX:ident // signed integer type with same bitwidth as `$uX`
16+
$(, $fun_attr:meta)* // attributes for the function
1617
) => {
1718
/// Computes the quotient and remainder of `duo` divided by `div` and returns them as a
1819
/// tuple.
20+
$(
21+
#[$fun_attr]
22+
)*
1923
pub fn $fn(duo: $uX, div: $uX) -> ($uX, $uX) {
2024
let mut duo = duo;
2125
// handle edge cases before calling `$normalization_shift`

src/int/specialized_div_rem/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -306,5 +306,6 @@ impl_binary_long!(
306306
u32_normalization_shift,
307307
32,
308308
u32,
309-
i32
309+
i32,
310+
allow(dead_code)
310311
);

src/int/udiv.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#[cfg(not(feature = "public-test-deps"))]
2-
pub(crate) use int::specialized_div_rem::*;
2+
pub(crate) use crate::int::specialized_div_rem::*;
33

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

77
intrinsics! {
88
#[maybe_use_optimized_c_shim]

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#![no_builtins]
1515
#![no_std]
1616
#![allow(unused_features)]
17+
#![allow(internal_features)]
1718
// We use `u128` in a whole bunch of places which we currently agree with the
1819
// compiler on ABIs and such, so we should be "good enough" for now and changes
1920
// to the `u128` ABI will be reflected here.

src/macros.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,10 @@ macro_rules! intrinsics {
321321
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
322322
#[cfg_attr(feature = "weak-intrinsics", linkage = "weak")]
323323
pub extern $abi fn $name( $($argname: $ty),* )
324-
-> ::macros::win64_128bit_abi_hack::U64x2
324+
-> $crate::macros::win64_128bit_abi_hack::U64x2
325325
{
326326
let e: $($ret)? = super::$name($($argname),*);
327-
::macros::win64_128bit_abi_hack::U64x2::from(e)
327+
$crate::macros::win64_128bit_abi_hack::U64x2::from(e)
328328
}
329329
}
330330

@@ -540,15 +540,15 @@ pub mod win64_128bit_abi_hack {
540540

541541
impl From<i128> for U64x2 {
542542
fn from(i: i128) -> U64x2 {
543-
use int::DInt;
543+
use crate::int::DInt;
544544
let j = i as u128;
545545
U64x2(j.lo(), j.hi())
546546
}
547547
}
548548

549549
impl From<u128> for U64x2 {
550550
fn from(i: u128) -> U64x2 {
551-
use int::DInt;
551+
use crate::int::DInt;
552552
U64x2(i.lo(), i.hi())
553553
}
554554
}

src/math.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#[path = "../libm/src/math/mod.rs"]
33
mod libm;
44

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

0 commit comments

Comments
 (0)