From 82b2a6ea3d82329fbc0f396df46a9ac4cbe8c805 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 3 Nov 2018 01:00:01 -0700 Subject: [PATCH] Replace interpolate_idents with stable code --- Cargo.toml | 2 +- micro_benchmarks/Cargo.toml | 2 +- micro_benchmarks/benches/mask_reductions.rs | 15 +++--- src/api/cast/macros.rs | 8 +-- src/api/cmp/eq.rs | 4 +- src/api/cmp/ord.rs | 4 +- src/api/cmp/partial_eq.rs | 4 +- src/api/cmp/partial_ord.rs | 8 +-- src/api/cmp/vertical.rs | 4 +- src/api/default.rs | 4 +- src/api/fmt/binary.rs | 4 +- src/api/fmt/debug.rs | 4 +- src/api/fmt/lower_hex.rs | 4 +- src/api/fmt/octal.rs | 4 +- src/api/fmt/upper_hex.rs | 4 +- src/api/from/from_array.rs | 8 +-- src/api/from/from_vector.rs | 4 +- src/api/hash.rs | 4 +- src/api/into_bits/macros.rs | 4 +- src/api/math/float/abs.rs | 4 +- src/api/math/float/cos.rs | 4 +- src/api/math/float/exp.rs | 4 +- src/api/math/float/ln.rs | 4 +- src/api/math/float/mul_add.rs | 4 +- src/api/math/float/mul_adde.rs | 4 +- src/api/math/float/powf.rs | 4 +- src/api/math/float/recpre.rs | 4 +- src/api/math/float/rsqrte.rs | 4 +- src/api/math/float/sin.rs | 4 +- src/api/math/float/sqrt.rs | 4 +- src/api/math/float/sqrte.rs | 4 +- src/api/minimal/iuf.rs | 4 +- src/api/minimal/mask.rs | 4 +- src/api/minimal/ptr.rs | 54 ++++++++++----------- src/api/ops/scalar_arithmetic.rs | 4 +- src/api/ops/scalar_bitwise.rs | 4 +- src/api/ops/scalar_mask_bitwise.rs | 4 +- src/api/ops/scalar_shifts.rs | 4 +- src/api/ops/vector_arithmetic.rs | 4 +- src/api/ops/vector_bitwise.rs | 4 +- src/api/ops/vector_float_min_max.rs | 4 +- src/api/ops/vector_int_min_max.rs | 4 +- src/api/ops/vector_mask_bitwise.rs | 4 +- src/api/ops/vector_neg.rs | 4 +- src/api/ops/vector_rotates.rs | 4 +- src/api/ops/vector_shifts.rs | 4 +- src/api/ptr/gather_scatter.rs | 18 +++---- src/api/reductions/bitwise.rs | 4 +- src/api/reductions/float_arithmetic.rs | 8 +-- src/api/reductions/integer_arithmetic.rs | 4 +- src/api/reductions/mask.rs | 4 +- src/api/reductions/min_max.rs | 8 +-- src/api/select.rs | 4 +- src/api/shuffle1_dyn.rs | 8 +-- src/api/slice/from_slice.rs | 8 +-- src/api/slice/write_to_slice.rs | 6 +-- src/api/swap_bytes.rs | 6 +-- src/lib.rs | 3 +- verify/verify/Cargo.toml | 2 +- verify/verify/src/api/reductions/mask.rs | 8 +-- verify/verify/src/lib.rs | 3 +- 61 files changed, 172 insertions(+), 175 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cba8ada57..94f5a9377 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ default = [] into_bits = [] [dev-dependencies] -interpolate_idents = "0.2" +paste = "^0.1.3" arrayvec = { version = "^0.4", default-features = false } [target.'cfg(target_arch = "x86_64")'.dependencies.sleef-sys] diff --git a/micro_benchmarks/Cargo.toml b/micro_benchmarks/Cargo.toml index a87a9aa91..d585562a0 100644 --- a/micro_benchmarks/Cargo.toml +++ b/micro_benchmarks/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dev-dependencies] packed_simd = { path = ".." } -interpolate_idents = "0.2" +paste = "0.1.3" criterion = "0.2" [profile.bench] diff --git a/micro_benchmarks/benches/mask_reductions.rs b/micro_benchmarks/benches/mask_reductions.rs index 7f364eef6..7c8f90eae 100644 --- a/micro_benchmarks/benches/mask_reductions.rs +++ b/micro_benchmarks/benches/mask_reductions.rs @@ -1,7 +1,6 @@ //! Benchmarks for the mask reductions `all`, `any`, and `none`. #![deny(warnings, rust_2018_idioms)] -#![feature(plugin, test)] -#![plugin(interpolate_idents)] +#![feature(test)] use test::black_box; use packed_simd::*; @@ -11,8 +10,8 @@ const NO_ITERATIONS: u32 = 1_000; macro_rules! bench { ($id:ident) => { - interpolate_idents! { - fn [ $id _all ](c: &mut Criterion) { + paste::item! { + fn [<$id _all>](c: &mut Criterion) { c.bench( stringify!($id), Benchmark::new("all", |b| b.iter(|| { @@ -25,7 +24,7 @@ macro_rules! bench { })).throughput(Throughput::Elements(NO_ITERATIONS)) ); } - fn [ $id _any ](c: &mut Criterion) { + fn [<$id _any>](c: &mut Criterion) { c.bench( stringify!($id), Benchmark::new("any", |b| b.iter(|| { @@ -38,7 +37,7 @@ macro_rules! bench { })).throughput(Throughput::Elements(NO_ITERATIONS)) ); } - fn [ $id _none ](c: &mut Criterion) { + fn [<$id _none>](c: &mut Criterion) { c.bench( stringify!($id), Benchmark::new("none", |b| b.iter(|| { @@ -55,10 +54,10 @@ macro_rules! bench { }; ($($id:ident),*) => { $( bench!($id); )* - interpolate_idents! { + paste::item! { criterion_group!( benches, - $([$id _all]),*, $([$id _any]),*, $([$id _none]),* + $([<$id _all>]),*, $([<$id _any>]),*, $([<$id _none>]),* ); } }; diff --git a/src/api/cast/macros.rs b/src/api/cast/macros.rs index 117b52ac9..3bb29f0b8 100644 --- a/src/api/cast/macros.rs +++ b/src/api/cast/macros.rs @@ -13,8 +13,8 @@ macro_rules! impl_from_cast_ { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _from_cast_ $from_ty] { + paste::item! { + pub mod [<$id _from_cast_ $from_ty>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn test() { @@ -47,8 +47,8 @@ macro_rules! impl_from_cast_mask_ { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _from_cast_ $from_ty] { + paste::item! { + pub mod [<$id _from_cast_ $from_ty>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn test() { diff --git a/src/api/cmp/eq.rs b/src/api/cmp/eq.rs index 1b68fbe97..3c55d0dce 100644 --- a/src/api/cmp/eq.rs +++ b/src/api/cmp/eq.rs @@ -11,8 +11,8 @@ macro_rules! impl_cmp_eq { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _cmp_eq] { + paste::item! { + pub mod [<$id _cmp_eq>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn eq() { diff --git a/src/api/cmp/ord.rs b/src/api/cmp/ord.rs index 64cacb6a4..e54ba3bfd 100644 --- a/src/api/cmp/ord.rs +++ b/src/api/cmp/ord.rs @@ -26,8 +26,8 @@ macro_rules! impl_cmp_ord { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _cmp_ord] { + paste::item! { + pub mod [<$id _cmp_ord>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn eq() { diff --git a/src/api/cmp/partial_eq.rs b/src/api/cmp/partial_eq.rs index 6182a03e8..7e2782f0f 100644 --- a/src/api/cmp/partial_eq.rs +++ b/src/api/cmp/partial_eq.rs @@ -36,8 +36,8 @@ macro_rules! impl_cmp_partial_eq { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _cmp_PartialEq] { + paste::item! { + pub mod [<$id _cmp_PartialEq>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn partial_eq() { diff --git a/src/api/cmp/partial_ord.rs b/src/api/cmp/partial_ord.rs index e3f9f3707..7123c3113 100644 --- a/src/api/cmp/partial_ord.rs +++ b/src/api/cmp/partial_ord.rs @@ -69,8 +69,8 @@ macro_rules! test_cmp_partial_ord_int { ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _cmp_PartialOrd] { + paste::item! { + pub mod [<$id _cmp_PartialOrd>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn partial_lex_ord() { @@ -156,8 +156,8 @@ macro_rules! test_cmp_partial_ord_mask { ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _cmp_PartialOrd] { + paste::item! { + pub mod [<$id _cmp_PartialOrd>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn partial_lex_ord() { diff --git a/src/api/cmp/vertical.rs b/src/api/cmp/vertical.rs index c86f6760a..ea4a0d1a3 100644 --- a/src/api/cmp/vertical.rs +++ b/src/api/cmp/vertical.rs @@ -68,8 +68,8 @@ macro_rules! impl_cmp_vertical { } test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _cmp_vertical] { + paste::item! { + pub mod [<$id _cmp_vertical>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn cmp() { diff --git a/src/api/default.rs b/src/api/default.rs index 548dd07c7..843d51bcc 100644 --- a/src/api/default.rs +++ b/src/api/default.rs @@ -11,8 +11,8 @@ macro_rules! impl_default { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _default] { + paste::item! { + pub mod [<$id _default>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn default() { diff --git a/src/api/fmt/binary.rs b/src/api/fmt/binary.rs index 7c943ca5a..8ddce2c1e 100644 --- a/src/api/fmt/binary.rs +++ b/src/api/fmt/binary.rs @@ -19,8 +19,8 @@ macro_rules! impl_fmt_binary { } test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _fmt_binary] { + paste::item! { + pub mod [<$id _fmt_binary>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn binary() { diff --git a/src/api/fmt/debug.rs b/src/api/fmt/debug.rs index 289c13d4d..f34a237d9 100644 --- a/src/api/fmt/debug.rs +++ b/src/api/fmt/debug.rs @@ -4,8 +4,8 @@ macro_rules! impl_fmt_debug_tests { ([$elem_ty:ty; $elem_count:expr]: $id:ident | $test_tt:tt) => { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _fmt_debug] { + paste::item! { + pub mod [<$id _fmt_debug>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn debug() { diff --git a/src/api/fmt/lower_hex.rs b/src/api/fmt/lower_hex.rs index 3ceff863c..4415b99b3 100644 --- a/src/api/fmt/lower_hex.rs +++ b/src/api/fmt/lower_hex.rs @@ -19,8 +19,8 @@ macro_rules! impl_fmt_lower_hex { } test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _fmt_lower_hex] { + paste::item! { + pub mod [<$id _fmt_lower_hex>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn lower_hex() { diff --git a/src/api/fmt/octal.rs b/src/api/fmt/octal.rs index c2d05ae5d..b7104ee82 100644 --- a/src/api/fmt/octal.rs +++ b/src/api/fmt/octal.rs @@ -19,8 +19,8 @@ macro_rules! impl_fmt_octal { } test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _fmt_octal] { + paste::item! { + pub mod [<$id _fmt_octal>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn octal_hex() { diff --git a/src/api/fmt/upper_hex.rs b/src/api/fmt/upper_hex.rs index 5d3596994..cccad0cf8 100644 --- a/src/api/fmt/upper_hex.rs +++ b/src/api/fmt/upper_hex.rs @@ -19,8 +19,8 @@ macro_rules! impl_fmt_upper_hex { } test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _fmt_upper_hex] { + paste::item! { + pub mod [<$id _fmt_upper_hex>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn upper_hex() { diff --git a/src/api/from/from_array.rs b/src/api/from/from_array.rs index 56ec7b563..73f5beaf7 100644 --- a/src/api/from/from_array.rs +++ b/src/api/from/from_array.rs @@ -55,8 +55,8 @@ macro_rules! impl_from_array { test_if!{ $test_tt: - interpolate_idents! { - mod [$id _from] { + paste::item! { + mod [<$id _from>] { use super::*; #[test] fn array() { @@ -89,7 +89,7 @@ macro_rules! impl_from_array { let array_from_vec = <[$elem_ty; $elem_count]>::from(vec); // FIXME: Workaround for arrays with more than 32 elements. for i in 0..$elem_count { - assert_eq!(array_from_vec[[i]], array[[i]]); + assert_eq!(array_from_vec[i], array[i]); } let vec_from_into_array: $id = array.into(); @@ -97,7 +97,7 @@ macro_rules! impl_from_array { let array_from_into_vec: [$elem_ty; $elem_count] = vec.into(); // FIXME: Workaround for arrays with more than 32 elements. for i in 0..$elem_count { - assert_eq!(array_from_into_vec[[i]], array[[i]]); + assert_eq!(array_from_into_vec[i], array[i]); } } } diff --git a/src/api/from/from_vector.rs b/src/api/from/from_vector.rs index 3bb655336..5ae44c213 100644 --- a/src/api/from/from_vector.rs +++ b/src/api/from/from_vector.rs @@ -32,8 +32,8 @@ macro_rules! impl_from_vector { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _from_ $source] { + paste::item! { + pub mod [<$id _from_ $source>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn from() { diff --git a/src/api/hash.rs b/src/api/hash.rs index 29155b10a..4eb22031f 100644 --- a/src/api/hash.rs +++ b/src/api/hash.rs @@ -17,8 +17,8 @@ macro_rules! impl_hash { test_if! { $test_tt: - interpolate_idents! { - pub mod [$id _hash] { + paste::item! { + pub mod [<$id _hash>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn hash() { diff --git a/src/api/into_bits/macros.rs b/src/api/into_bits/macros.rs index ad2343d0a..1ae44156a 100644 --- a/src/api/into_bits/macros.rs +++ b/src/api/into_bits/macros.rs @@ -11,8 +11,8 @@ macro_rules! impl_from_bits_ { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _from_bits_ $from_ty] { + paste::item! { + pub mod [<$id _from_bits_ $from_ty>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn test() { diff --git a/src/api/math/float/abs.rs b/src/api/math/float/abs.rs index 2d3532b3a..1865bdb68 100644 --- a/src/api/math/float/abs.rs +++ b/src/api/math/float/abs.rs @@ -13,8 +13,8 @@ macro_rules! impl_math_float_abs { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_abs] { + paste::item! { + pub mod [<$id _math_abs>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn abs() { diff --git a/src/api/math/float/cos.rs b/src/api/math/float/cos.rs index 82583fa49..e5b8f4603 100644 --- a/src/api/math/float/cos.rs +++ b/src/api/math/float/cos.rs @@ -20,8 +20,8 @@ macro_rules! impl_math_float_cos { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_cos] { + paste::item! { + pub mod [<$id _math_cos>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn cos() { diff --git a/src/api/math/float/exp.rs b/src/api/math/float/exp.rs index 8f3abdf9e..e3356d853 100644 --- a/src/api/math/float/exp.rs +++ b/src/api/math/float/exp.rs @@ -13,8 +13,8 @@ macro_rules! impl_math_float_exp { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_exp] { + paste::item! { + pub mod [<$id _math_exp>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn exp() { diff --git a/src/api/math/float/ln.rs b/src/api/math/float/ln.rs index 83d41316f..5ceb9173a 100644 --- a/src/api/math/float/ln.rs +++ b/src/api/math/float/ln.rs @@ -13,8 +13,8 @@ macro_rules! impl_math_float_ln { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_ln] { + paste::item! { + pub mod [<$id _math_ln>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn ln() { diff --git a/src/api/math/float/mul_add.rs b/src/api/math/float/mul_add.rs index d83ad7372..4b170ee2b 100644 --- a/src/api/math/float/mul_add.rs +++ b/src/api/math/float/mul_add.rs @@ -13,8 +13,8 @@ macro_rules! impl_math_float_mul_add { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_mul_add] { + paste::item! { + pub mod [<$id _math_mul_add>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn mul_add() { diff --git a/src/api/math/float/mul_adde.rs b/src/api/math/float/mul_adde.rs index 90a735841..c5b27110f 100644 --- a/src/api/math/float/mul_adde.rs +++ b/src/api/math/float/mul_adde.rs @@ -17,8 +17,8 @@ macro_rules! impl_math_float_mul_adde { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_mul_adde] { + paste::item! { + pub mod [<$id _math_mul_adde>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn mul_adde() { diff --git a/src/api/math/float/powf.rs b/src/api/math/float/powf.rs index 08bf0d2ec..83dc9ff9c 100644 --- a/src/api/math/float/powf.rs +++ b/src/api/math/float/powf.rs @@ -13,8 +13,8 @@ macro_rules! impl_math_float_powf { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_powf] { + paste::item! { + pub mod [<$id _math_powf>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn powf() { diff --git a/src/api/math/float/recpre.rs b/src/api/math/float/recpre.rs index 371d1dfc1..127f0b2ff 100644 --- a/src/api/math/float/recpre.rs +++ b/src/api/math/float/recpre.rs @@ -14,8 +14,8 @@ macro_rules! impl_math_float_recpre { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_recpre] { + paste::item! { + pub mod [<$id _math_recpre>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn recpre() { diff --git a/src/api/math/float/rsqrte.rs b/src/api/math/float/rsqrte.rs index 43166708d..c77977f7b 100644 --- a/src/api/math/float/rsqrte.rs +++ b/src/api/math/float/rsqrte.rs @@ -17,8 +17,8 @@ macro_rules! impl_math_float_rsqrte { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_rsqrte] { + paste::item! { + pub mod [<$id _math_rsqrte>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn rsqrte() { diff --git a/src/api/math/float/sin.rs b/src/api/math/float/sin.rs index 3d444d203..49908319b 100644 --- a/src/api/math/float/sin.rs +++ b/src/api/math/float/sin.rs @@ -27,8 +27,8 @@ macro_rules! impl_math_float_sin { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_sin] { + paste::item! { + pub mod [<$id _math_sin>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn sin() { diff --git a/src/api/math/float/sqrt.rs b/src/api/math/float/sqrt.rs index d31f2fc15..ae624122d 100644 --- a/src/api/math/float/sqrt.rs +++ b/src/api/math/float/sqrt.rs @@ -12,8 +12,8 @@ macro_rules! impl_math_float_sqrt { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_sqrt] { + paste::item! { + pub mod [<$id _math_sqrt>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn sqrt() { diff --git a/src/api/math/float/sqrte.rs b/src/api/math/float/sqrte.rs index 8bf8df42c..f7ffad748 100644 --- a/src/api/math/float/sqrte.rs +++ b/src/api/math/float/sqrte.rs @@ -15,8 +15,8 @@ macro_rules! impl_math_float_sqrte { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _math_sqrte] { + paste::item! { + pub mod [<$id _math_sqrte>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn sqrte() { diff --git a/src/api/minimal/iuf.rs b/src/api/minimal/iuf.rs index b7f3d90ec..2de616cab 100644 --- a/src/api/minimal/iuf.rs +++ b/src/api/minimal/iuf.rs @@ -96,8 +96,8 @@ macro_rules! impl_minimal_iuf { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _minimal] { + paste::item! { + pub mod [<$id _minimal>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn minimal() { diff --git a/src/api/minimal/mask.rs b/src/api/minimal/mask.rs index abe065af3..32a0f3588 100644 --- a/src/api/minimal/mask.rs +++ b/src/api/minimal/mask.rs @@ -97,8 +97,8 @@ macro_rules! impl_minimal_mask { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _minimal] { + paste::item! { + pub mod [<$id _minimal>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn minimal() { diff --git a/src/api/minimal/ptr.rs b/src/api/minimal/ptr.rs index cb973288b..72e4799fe 100644 --- a/src/api/minimal/ptr.rs +++ b/src/api/minimal/ptr.rs @@ -107,8 +107,8 @@ macro_rules! impl_minimal_p { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _minimal] { + paste::item! { + pub mod [<$id _minimal>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn minimal() { @@ -199,8 +199,8 @@ macro_rules! impl_minimal_p { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _fmt_debug] { + paste::item! { + pub mod [<$id _fmt_debug>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn debug() { @@ -242,8 +242,8 @@ macro_rules! impl_minimal_p { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _default] { + paste::item! { + pub mod [<$id _default>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn default() { @@ -326,8 +326,8 @@ macro_rules! impl_minimal_p { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _cmp_vertical] { + paste::item! { + pub mod [<$id _cmp_vertical>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn cmp() { @@ -398,8 +398,8 @@ macro_rules! impl_minimal_p { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _cmp_PartialEq] { + paste::item! { + pub mod [<$id _cmp_PartialEq>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn partial_eq() { @@ -430,8 +430,8 @@ macro_rules! impl_minimal_p { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _cmp_eq] { + paste::item! { + pub mod [<$id _cmp_eq>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn eq() { @@ -476,8 +476,8 @@ macro_rules! impl_minimal_p { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _from] { + paste::item! { + pub mod [<$id _from>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn array() { @@ -487,9 +487,9 @@ macro_rules! impl_minimal_p { let mut array = [$id::::null().extract(0); $elem_count]; for i in 0..$elem_count { - let ptr = unsafe { crate::mem::transmute(&values[[i]] as *const i32) }; + let ptr = unsafe { crate::mem::transmute(&values[i] as *const i32) }; vec = vec.replace(i, ptr); - array[[i]] = ptr; + array[i] = ptr; } // FIXME: there is no impl of From<$id> for [$elem_ty; N] @@ -579,8 +579,8 @@ macro_rules! impl_minimal_p { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _slice_from_slice] { + paste::item! { + pub mod [<$id _slice_from_slice>] { use super::*; use crate::iter::Iterator; @@ -626,7 +626,7 @@ macro_rules! impl_minimal_p { }; for i in $id::::lanes()..(2 * $id::::lanes()) { unsafe { - aligned.data[[i]] = non_null; + aligned.data[i] = non_null; } } @@ -766,8 +766,8 @@ macro_rules! impl_minimal_p { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _slice_write_to_slice] { + paste::item! { + pub mod [<$id _slice_write_to_slice>] { use super::*; use crate::iter::Iterator; @@ -887,8 +887,8 @@ macro_rules! impl_minimal_p { test_if! { $test_tt: - interpolate_idents! { - pub mod [$id _hash] { + paste::item! { + pub mod [<$id _hash>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn hash() { @@ -902,9 +902,9 @@ macro_rules! impl_minimal_p { let mut array = [$id::::null().extract(0); $elem_count]; for i in 0..$elem_count { - let ptr = unsafe { crate::mem::transmute(&values[[i]] as *const i32) }; + let ptr = unsafe { crate::mem::transmute(&values[i] as *const i32) }; vec = vec.replace(i, ptr); - array[[i]] = ptr; + array[i] = ptr; } #[allow(deprecated)] @@ -1187,8 +1187,8 @@ macro_rules! impl_minimal_p { test_if! { $test_tt: - interpolate_idents! { - pub mod [$id _shuffle1_dyn] { + paste::item! { + pub mod [<$id _shuffle1_dyn>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn shuffle1_dyn() { diff --git a/src/api/ops/scalar_arithmetic.rs b/src/api/ops/scalar_arithmetic.rs index 07ec7a342..da1a2037e 100644 --- a/src/api/ops/scalar_arithmetic.rs +++ b/src/api/ops/scalar_arithmetic.rs @@ -114,8 +114,8 @@ macro_rules! impl_ops_scalar_arithmetic { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _ops_scalar_arith] { + paste::item! { + pub mod [<$id _ops_scalar_arith>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn ops_scalar_arithmetic() { diff --git a/src/api/ops/scalar_bitwise.rs b/src/api/ops/scalar_bitwise.rs index 3ff0a75f0..88216769a 100644 --- a/src/api/ops/scalar_bitwise.rs +++ b/src/api/ops/scalar_bitwise.rs @@ -72,8 +72,8 @@ macro_rules! impl_ops_scalar_bitwise { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _ops_scalar_bitwise] { + paste::item! { + pub mod [<$id _ops_scalar_bitwise>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] diff --git a/src/api/ops/scalar_mask_bitwise.rs b/src/api/ops/scalar_mask_bitwise.rs index d731a8af9..523a85207 100644 --- a/src/api/ops/scalar_mask_bitwise.rs +++ b/src/api/ops/scalar_mask_bitwise.rs @@ -72,8 +72,8 @@ macro_rules! impl_ops_scalar_mask_bitwise { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _ops_scalar_mask_bitwise] { + paste::item! { + pub mod [<$id _ops_scalar_mask_bitwise>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn ops_scalar_mask_bitwise() { diff --git a/src/api/ops/scalar_shifts.rs b/src/api/ops/scalar_shifts.rs index b4219b327..263c3de7e 100644 --- a/src/api/ops/scalar_shifts.rs +++ b/src/api/ops/scalar_shifts.rs @@ -31,8 +31,8 @@ macro_rules! impl_ops_scalar_shifts { } test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _ops_scalar_shifts] { + paste::item! { + pub mod [<$id _ops_scalar_shifts>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] #[cfg_attr(any(target_arch = "s390x", target_arch = "sparc64"), diff --git a/src/api/ops/vector_arithmetic.rs b/src/api/ops/vector_arithmetic.rs index d3f55a6e6..7057f52d0 100644 --- a/src/api/ops/vector_arithmetic.rs +++ b/src/api/ops/vector_arithmetic.rs @@ -84,8 +84,8 @@ macro_rules! impl_ops_vector_arithmetic { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _ops_vector_arith] { + paste::item! { + pub mod [<$id _ops_vector_arith>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn ops_vector_arithmetic() { diff --git a/src/api/ops/vector_bitwise.rs b/src/api/ops/vector_bitwise.rs index 189bc8044..7be9603fa 100644 --- a/src/api/ops/vector_bitwise.rs +++ b/src/api/ops/vector_bitwise.rs @@ -58,8 +58,8 @@ macro_rules! impl_ops_vector_bitwise { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _ops_vector_bitwise] { + paste::item! { + pub mod [<$id _ops_vector_bitwise>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn ops_vector_bitwise() { diff --git a/src/api/ops/vector_float_min_max.rs b/src/api/ops/vector_float_min_max.rs index 931dfd69a..4126e8704 100644 --- a/src/api/ops/vector_float_min_max.rs +++ b/src/api/ops/vector_float_min_max.rs @@ -25,8 +25,8 @@ macro_rules! impl_ops_vector_float_min_max { } test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _ops_vector_min_max] { + paste::item! { + pub mod [<$id _ops_vector_min_max>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn min_max() { diff --git a/src/api/ops/vector_int_min_max.rs b/src/api/ops/vector_int_min_max.rs index 7be56f217..36ea98e6b 100644 --- a/src/api/ops/vector_int_min_max.rs +++ b/src/api/ops/vector_int_min_max.rs @@ -22,8 +22,8 @@ macro_rules! impl_ops_vector_int_min_max { } } test_if!{$test_tt: - interpolate_idents! { - pub mod [$id _ops_vector_min_max] { + paste::item! { + pub mod [<$id _ops_vector_min_max>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn min_max() { diff --git a/src/api/ops/vector_mask_bitwise.rs b/src/api/ops/vector_mask_bitwise.rs index 469c9b44e..295fc1ca8 100644 --- a/src/api/ops/vector_mask_bitwise.rs +++ b/src/api/ops/vector_mask_bitwise.rs @@ -58,8 +58,8 @@ macro_rules! impl_ops_vector_mask_bitwise { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _ops_vector_mask_bitwise] { + paste::item! { + pub mod [<$id _ops_vector_mask_bitwise>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn ops_vector_mask_bitwise() { diff --git a/src/api/ops/vector_neg.rs b/src/api/ops/vector_neg.rs index 4117a3d93..e2d91fd2f 100644 --- a/src/api/ops/vector_neg.rs +++ b/src/api/ops/vector_neg.rs @@ -11,8 +11,8 @@ macro_rules! impl_ops_vector_neg { } test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _ops_vector_neg] { + paste::item! { + pub mod [<$id _ops_vector_neg>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn neg() { diff --git a/src/api/ops/vector_rotates.rs b/src/api/ops/vector_rotates.rs index e92334691..6c794ecf4 100644 --- a/src/api/ops/vector_rotates.rs +++ b/src/api/ops/vector_rotates.rs @@ -37,14 +37,14 @@ macro_rules! impl_ops_vector_rotates { test_if!{ $test_tt: - interpolate_idents! { + paste::item! { // FIXME: // https://github.com/rust-lang-nursery/packed_simd/issues/75 #[cfg(not(any( target_arch = "s390x", target_arch = "sparc64", )))] - pub mod [$id _ops_vector_rotate] { + pub mod [<$id _ops_vector_rotate>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn rotate_ops() { diff --git a/src/api/ops/vector_shifts.rs b/src/api/ops/vector_shifts.rs index ce72203fa..a30c6a09c 100644 --- a/src/api/ops/vector_shifts.rs +++ b/src/api/ops/vector_shifts.rs @@ -32,8 +32,8 @@ macro_rules! impl_ops_vector_shifts { } test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _ops_vector_shifts] { + paste::item! { + pub mod [<$id _ops_vector_shifts>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] #[cfg_attr(any(target_arch = "s390x", target_arch = "sparc64"), diff --git a/src/api/ptr/gather_scatter.rs b/src/api/ptr/gather_scatter.rs index 4d98c3d55..1ac8584b6 100644 --- a/src/api/ptr/gather_scatter.rs +++ b/src/api/ptr/gather_scatter.rs @@ -31,21 +31,21 @@ macro_rules! impl_ptr_read { test_if! { $test_tt: - interpolate_idents! { - mod [$id _read] { + paste::item! { + mod [<$id _read>] { use super::*; #[test] fn read() { let mut v = [0_i32; $elem_count]; for i in 0..$elem_count { - v[[i]] = i as i32; + v[i] = i as i32; } let mut ptr = $id::::null(); for i in 0..$elem_count { ptr = ptr.replace(i, unsafe { - crate::mem::transmute(&v[[i]] as *const i32) + crate::mem::transmute(&v[i] as *const i32) }); } @@ -67,7 +67,7 @@ macro_rules! impl_ptr_read { let mut e = v; for i in 0..$elem_count { if i % 2 != 0 { - e[[i]] = 42; + e[i] = 42; } } assert_eq!(r, Simd::<[i32; $elem_count]>::from_slice_unaligned(&e)); @@ -136,8 +136,8 @@ macro_rules! impl_ptr_write { test_if! { $test_tt: - interpolate_idents! { - mod [$id _write] { + paste::item! { + mod [<$id _write>] { use super::*; #[test] fn write() { @@ -147,7 +147,7 @@ macro_rules! impl_ptr_write { // This test will write to this array let mut arr = [0_i32; $elem_count]; for i in 0..$elem_count { - arr[[i]] = i as i32; + arr[i] = i as i32; } // arr = [0, 1, 2, ...] @@ -182,7 +182,7 @@ macro_rules! impl_ptr_write { let mut r = arr; for i in 0..$elem_count { if i % 2 == 0 { - r[[i]] = 42; + r[i] = 42; } } diff --git a/src/api/reductions/bitwise.rs b/src/api/reductions/bitwise.rs index 75e439101..5bad4f474 100644 --- a/src/api/reductions/bitwise.rs +++ b/src/api/reductions/bitwise.rs @@ -84,8 +84,8 @@ macro_rules! impl_reduction_bitwise { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _reduction_bitwise] { + paste::item! { + pub mod [<$id _reduction_bitwise>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] diff --git a/src/api/reductions/float_arithmetic.rs b/src/api/reductions/float_arithmetic.rs index 4fa1edb66..3604d6bfc 100644 --- a/src/api/reductions/float_arithmetic.rs +++ b/src/api/reductions/float_arithmetic.rs @@ -88,8 +88,8 @@ macro_rules! impl_reduction_float_arithmetic { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _reduction_float_arith] { + paste::item! { + pub mod [<$id _reduction_float_arith>] { use super::*; fn alternating(x: usize) -> $id { let mut v = $id::splat(1 as $elem_ty); @@ -193,7 +193,7 @@ macro_rules! impl_reduction_float_arithmetic { #[allow(unused, dead_code)] fn sum_roundoff() { // Performs a tree-reduction - fn tree_reduce_sum(a: &[[$elem_ty]]) -> $elem_ty { + fn tree_reduce_sum(a: &[$elem_ty]) -> $elem_ty { assert!(!a.is_empty()); if a.len() == 1 { a[0] @@ -242,7 +242,7 @@ macro_rules! impl_reduction_float_arithmetic { #[allow(unused, dead_code)] fn product_roundoff() { // Performs a tree-reduction - fn tree_reduce_product(a: &[[$elem_ty]]) -> $elem_ty { + fn tree_reduce_product(a: &[$elem_ty]) -> $elem_ty { assert!(!a.is_empty()); if a.len() == 1 { a[0] diff --git a/src/api/reductions/integer_arithmetic.rs b/src/api/reductions/integer_arithmetic.rs index a0d512b65..c7e6d7576 100644 --- a/src/api/reductions/integer_arithmetic.rs +++ b/src/api/reductions/integer_arithmetic.rs @@ -97,8 +97,8 @@ macro_rules! impl_reduction_integer_arithmetic { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _reduction_int_arith] { + paste::item! { + pub mod [<$id _reduction_int_arith>] { use super::*; fn alternating(x: usize) -> $id { diff --git a/src/api/reductions/mask.rs b/src/api/reductions/mask.rs index d550b47ac..13d713067 100644 --- a/src/api/reductions/mask.rs +++ b/src/api/reductions/mask.rs @@ -22,8 +22,8 @@ macro_rules! impl_reduction_mask { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _reduction] { + paste::item! { + pub mod [<$id _reduction>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn all() { diff --git a/src/api/reductions/min_max.rs b/src/api/reductions/min_max.rs index 434782257..a7801e648 100644 --- a/src/api/reductions/min_max.rs +++ b/src/api/reductions/min_max.rs @@ -75,8 +75,8 @@ macro_rules! impl_reduction_min_max { } } test_if!{$test_tt: - interpolate_idents! { - pub mod [$id _reduction_min_max] { + paste::item! { + pub mod [<$id _reduction_min_max>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] pub fn max_element() { @@ -121,8 +121,8 @@ macro_rules! test_reduction_float_min_max { ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _reduction_min_max_nan] { + paste::item! { + pub mod [<$id _reduction_min_max_nan>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn min_element_test() { diff --git a/src/api/select.rs b/src/api/select.rs index 07168ade1..24525df56 100644 --- a/src/api/select.rs +++ b/src/api/select.rs @@ -34,8 +34,8 @@ macro_rules! test_select { ) => { test_if! { $test_tt: - interpolate_idents! { - pub mod [$vec_ty _select] { + paste::item! { + pub mod [<$vec_ty _select>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] diff --git a/src/api/shuffle1_dyn.rs b/src/api/shuffle1_dyn.rs index e952cc961..00df89ca4 100644 --- a/src/api/shuffle1_dyn.rs +++ b/src/api/shuffle1_dyn.rs @@ -19,8 +19,8 @@ macro_rules! test_shuffle1_dyn { ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => { test_if! { $test_tt: - interpolate_idents! { - pub mod [$id _shuffle1_dyn] { + paste::item! { + pub mod [<$id _shuffle1_dyn>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn shuffle1_dyn() { @@ -72,8 +72,8 @@ macro_rules! test_shuffle1_dyn_mask { ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => { test_if! { $test_tt: - interpolate_idents! { - pub mod [$id _shuffle1_dyn] { + paste::item! { + pub mod [<$id _shuffle1_dyn>] { use super::*; #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn shuffle1_dyn() { diff --git a/src/api/slice/from_slice.rs b/src/api/slice/from_slice.rs index 12de03b9e..b184c33b7 100644 --- a/src/api/slice/from_slice.rs +++ b/src/api/slice/from_slice.rs @@ -80,8 +80,8 @@ macro_rules! impl_slice_from_slice { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _slice_from_slice] { + paste::item! { + pub mod [<$id _slice_from_slice>] { use super::*; use crate::iter::Iterator; @@ -124,7 +124,7 @@ macro_rules! impl_slice_from_slice { }; for i in $id::lanes()..(2 * $id::lanes()) { unsafe { - aligned.data[[i]] = 42 as $elem_ty; + aligned.data[i] = 42 as $elem_ty; } } @@ -179,7 +179,7 @@ macro_rules! impl_slice_from_slice { // create a slice - this is safe, because the elements // of the slice exist, are properly initialized, and properly aligned: - let s: &[[$elem_ty]] = slice::from_raw_parts(ptr, $id::lanes()); + let s: &[$elem_ty] = slice::from_raw_parts(ptr, $id::lanes()); // this should always panic because the slice alignment does not match // the alignment requirements for the vector type: let _vec = $id::from_slice_aligned(s); diff --git a/src/api/slice/write_to_slice.rs b/src/api/slice/write_to_slice.rs index e3fa52751..6a72cdc2b 100644 --- a/src/api/slice/write_to_slice.rs +++ b/src/api/slice/write_to_slice.rs @@ -83,8 +83,8 @@ macro_rules! impl_slice_write_to_slice { test_if!{ $test_tt: - interpolate_idents! { - pub mod [$id _slice_write_to_slice] { + paste::item! { + pub mod [<$id _slice_write_to_slice>] { use super::*; use crate::iter::Iterator; @@ -176,7 +176,7 @@ macro_rules! impl_slice_write_to_slice { // create a slice - this is safe, because the elements // of the slice exist, are properly initialized, and properly aligned: - let s: &mut [[$elem_ty]] = slice::from_raw_parts_mut(ptr, $id::lanes()); + let s: &mut [$elem_ty] = slice::from_raw_parts_mut(ptr, $id::lanes()); // this should always panic because the slice alignment does not match // the alignment requirements for the vector type: let vec = $id::splat(42 as $elem_ty); diff --git a/src/api/swap_bytes.rs b/src/api/swap_bytes.rs index cc9d137f2..eacd5e3ee 100644 --- a/src/api/swap_bytes.rs +++ b/src/api/swap_bytes.rs @@ -44,8 +44,8 @@ macro_rules! impl_swap_bytes { test_if! { $test_tt: - interpolate_idents! { - pub mod [$id _swap_bytes] { + paste::item_with_macros! { + pub mod [<$id _swap_bytes>] { use super::*; const BYTES: [u8; 64] = [ @@ -61,7 +61,7 @@ macro_rules! impl_swap_bytes { assert!(mem::size_of::<$id>() <= 64); let mut actual = BYTES; - let elems: &mut [[$elem_ty]] = unsafe { + let elems: &mut [$elem_ty] = unsafe { slice::from_raw_parts_mut( actual.as_mut_ptr() as *mut $elem_ty, $id::lanes(), diff --git a/src/lib.rs b/src/lib.rs index a8c535395..b9b997cae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -215,8 +215,7 @@ custom_inner_attributes )] #![allow(non_camel_case_types, non_snake_case)] -#![cfg_attr(test, feature(plugin, hashmap_internals))] -#![cfg_attr(test, plugin(interpolate_idents))] +#![cfg_attr(test, feature(hashmap_internals))] #![cfg_attr( feature = "cargo-clippy", allow( diff --git a/verify/verify/Cargo.toml b/verify/verify/Cargo.toml index 2ba367152..f8254a932 100644 --- a/verify/verify/Cargo.toml +++ b/verify/verify/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" stdsimd-test = { git = "https://github.com/rust-lang-nursery/stdsimd.git" } packed_simd = { path = "../.." } cfg-if = "^0.1" -interpolate_idents = "0.2" +paste = "^0.1.3" diff --git a/verify/verify/src/api/reductions/mask.rs b/verify/verify/src/api/reductions/mask.rs index d95958caa..d880dc854 100644 --- a/verify/verify/src/api/reductions/mask.rs +++ b/verify/verify/src/api/reductions/mask.rs @@ -5,23 +5,23 @@ use cfg_if::cfg_if; #[allow(unused)] macro_rules! verify_mask { ($mask_id:ident[$target_feature:tt] => $all_instr:tt, $any_instr:tt, $none_instr:tt) => { - interpolate_idents! { + paste::item! { #[inline] #[target_feature(enable = $target_feature)] #[assert_instr($all_instr)] - pub unsafe fn [$mask_id _all](x: $mask_id) -> bool { + pub unsafe fn [<$mask_id _all>](x: $mask_id) -> bool { x.all() } #[inline] #[target_feature(enable = $target_feature)] #[assert_instr($any_instr)] - pub unsafe fn [$mask_id _any](x: $mask_id) -> bool { + pub unsafe fn [<$mask_id _any>](x: $mask_id) -> bool { x.any() } #[inline] #[target_feature(enable = $target_feature)] #[assert_instr($none_instr)] - pub unsafe fn [$mask_id _none](x: $mask_id) -> bool { + pub unsafe fn [<$mask_id _none>](x: $mask_id) -> bool { x.none() } } diff --git a/verify/verify/src/lib.rs b/verify/verify/src/lib.rs index 819d43ff5..d31a583a6 100644 --- a/verify/verify/src/lib.rs +++ b/verify/verify/src/lib.rs @@ -1,6 +1,5 @@ #![deny(warnings, rust_2018_idioms)] -#![cfg_attr(test, feature(plugin, avx512_target_feature, abi_vectorcall))] -#![cfg_attr(test, plugin(interpolate_idents))] +#![cfg_attr(test, feature(avx512_target_feature, abi_vectorcall))] #[cfg(test)] mod api;