Skip to content

Commit ba83765

Browse files
dtolnaygnzlbg
authored andcommitted
Replace interpolate_idents with stable code
1 parent 38b2a49 commit ba83765

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+172
-175
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ default = []
2828
into_bits = []
2929

3030
[dev-dependencies]
31-
interpolate_idents = "0.2"
31+
paste = "^0.1.3"
3232
arrayvec = { version = "^0.4", default-features = false }
3333

3434
[target.'cfg(target_arch = "x86_64")'.dependencies.sleef-sys]

micro_benchmarks/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2018"
77

88
[dev-dependencies]
99
packed_simd = { path = ".." }
10-
interpolate_idents = "0.2"
10+
paste = "0.1.3"
1111
criterion = "0.2"
1212

1313
[profile.bench]

micro_benchmarks/benches/mask_reductions.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Benchmarks for the mask reductions `all`, `any`, and `none`.
22
#![deny(warnings, rust_2018_idioms)]
3-
#![feature(plugin, test)]
4-
#![plugin(interpolate_idents)]
3+
#![feature(test)]
54

65
use test::black_box;
76
use packed_simd::*;
@@ -11,8 +10,8 @@ const NO_ITERATIONS: u32 = 1_000;
1110

1211
macro_rules! bench {
1312
($id:ident) => {
14-
interpolate_idents! {
15-
fn [ $id _all ](c: &mut Criterion) {
13+
paste::item! {
14+
fn [<$id _all>](c: &mut Criterion) {
1615
c.bench(
1716
stringify!($id),
1817
Benchmark::new("all", |b| b.iter(|| {
@@ -25,7 +24,7 @@ macro_rules! bench {
2524
})).throughput(Throughput::Elements(NO_ITERATIONS))
2625
);
2726
}
28-
fn [ $id _any ](c: &mut Criterion) {
27+
fn [<$id _any>](c: &mut Criterion) {
2928
c.bench(
3029
stringify!($id),
3130
Benchmark::new("any", |b| b.iter(|| {
@@ -38,7 +37,7 @@ macro_rules! bench {
3837
})).throughput(Throughput::Elements(NO_ITERATIONS))
3938
);
4039
}
41-
fn [ $id _none ](c: &mut Criterion) {
40+
fn [<$id _none>](c: &mut Criterion) {
4241
c.bench(
4342
stringify!($id),
4443
Benchmark::new("none", |b| b.iter(|| {
@@ -55,10 +54,10 @@ macro_rules! bench {
5554
};
5655
($($id:ident),*) => {
5756
$( bench!($id); )*
58-
interpolate_idents! {
57+
paste::item! {
5958
criterion_group!(
6059
benches,
61-
$([$id _all]),*, $([$id _any]),*, $([$id _none]),*
60+
$([<$id _all>]),*, $([<$id _any>]),*, $([<$id _none>]),*
6261
);
6362
}
6463
};

src/api/cast/macros.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ macro_rules! impl_from_cast_ {
1313

1414
test_if!{
1515
$test_tt:
16-
interpolate_idents! {
17-
pub mod [$id _from_cast_ $from_ty] {
16+
paste::item! {
17+
pub mod [<$id _from_cast_ $from_ty>] {
1818
use super::*;
1919
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2020
fn test() {
@@ -47,8 +47,8 @@ macro_rules! impl_from_cast_mask_ {
4747

4848
test_if!{
4949
$test_tt:
50-
interpolate_idents! {
51-
pub mod [$id _from_cast_ $from_ty] {
50+
paste::item! {
51+
pub mod [<$id _from_cast_ $from_ty>] {
5252
use super::*;
5353
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
5454
fn test() {

src/api/cmp/eq.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ macro_rules! impl_cmp_eq {
1111

1212
test_if!{
1313
$test_tt:
14-
interpolate_idents! {
15-
pub mod [$id _cmp_eq] {
14+
paste::item! {
15+
pub mod [<$id _cmp_eq>] {
1616
use super::*;
1717
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
1818
fn eq() {

src/api/cmp/ord.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ macro_rules! impl_cmp_ord {
2626

2727
test_if!{
2828
$test_tt:
29-
interpolate_idents! {
30-
pub mod [$id _cmp_ord] {
29+
paste::item! {
30+
pub mod [<$id _cmp_ord>] {
3131
use super::*;
3232
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
3333
fn eq() {

src/api/cmp/partial_eq.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ macro_rules! impl_cmp_partial_eq {
3636

3737
test_if!{
3838
$test_tt:
39-
interpolate_idents! {
40-
pub mod [$id _cmp_PartialEq] {
39+
paste::item! {
40+
pub mod [<$id _cmp_PartialEq>] {
4141
use super::*;
4242
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
4343
fn partial_eq() {

src/api/cmp/partial_ord.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ macro_rules! test_cmp_partial_ord_int {
6969
([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => {
7070
test_if!{
7171
$test_tt:
72-
interpolate_idents! {
73-
pub mod [$id _cmp_PartialOrd] {
72+
paste::item! {
73+
pub mod [<$id _cmp_PartialOrd>] {
7474
use super::*;
7575
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
7676
fn partial_lex_ord() {
@@ -156,8 +156,8 @@ macro_rules! test_cmp_partial_ord_mask {
156156
([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => {
157157
test_if!{
158158
$test_tt:
159-
interpolate_idents! {
160-
pub mod [$id _cmp_PartialOrd] {
159+
paste::item! {
160+
pub mod [<$id _cmp_PartialOrd>] {
161161
use super::*;
162162
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
163163
fn partial_lex_ord() {

src/api/cmp/vertical.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ macro_rules! impl_cmp_vertical {
6868
}
6969
test_if!{
7070
$test_tt:
71-
interpolate_idents! {
72-
pub mod [$id _cmp_vertical] {
71+
paste::item! {
72+
pub mod [<$id _cmp_vertical>] {
7373
use super::*;
7474
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
7575
fn cmp() {

src/api/default.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ macro_rules! impl_default {
1111

1212
test_if!{
1313
$test_tt:
14-
interpolate_idents! {
15-
pub mod [$id _default] {
14+
paste::item! {
15+
pub mod [<$id _default>] {
1616
use super::*;
1717
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
1818
fn default() {

src/api/fmt/binary.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ macro_rules! impl_fmt_binary {
1919
}
2020
test_if!{
2121
$test_tt:
22-
interpolate_idents! {
23-
pub mod [$id _fmt_binary] {
22+
paste::item! {
23+
pub mod [<$id _fmt_binary>] {
2424
use super::*;
2525
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2626
fn binary() {

src/api/fmt/debug.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ macro_rules! impl_fmt_debug_tests {
44
([$elem_ty:ty; $elem_count:expr]: $id:ident | $test_tt:tt) => {
55
test_if!{
66
$test_tt:
7-
interpolate_idents! {
8-
pub mod [$id _fmt_debug] {
7+
paste::item! {
8+
pub mod [<$id _fmt_debug>] {
99
use super::*;
1010
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
1111
fn debug() {

src/api/fmt/lower_hex.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ macro_rules! impl_fmt_lower_hex {
1919
}
2020
test_if!{
2121
$test_tt:
22-
interpolate_idents! {
23-
pub mod [$id _fmt_lower_hex] {
22+
paste::item! {
23+
pub mod [<$id _fmt_lower_hex>] {
2424
use super::*;
2525
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2626
fn lower_hex() {

src/api/fmt/octal.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ macro_rules! impl_fmt_octal {
1919
}
2020
test_if!{
2121
$test_tt:
22-
interpolate_idents! {
23-
pub mod [$id _fmt_octal] {
22+
paste::item! {
23+
pub mod [<$id _fmt_octal>] {
2424
use super::*;
2525
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2626
fn octal_hex() {

src/api/fmt/upper_hex.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ macro_rules! impl_fmt_upper_hex {
1919
}
2020
test_if!{
2121
$test_tt:
22-
interpolate_idents! {
23-
pub mod [$id _fmt_upper_hex] {
22+
paste::item! {
23+
pub mod [<$id _fmt_upper_hex>] {
2424
use super::*;
2525
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2626
fn upper_hex() {

src/api/from/from_array.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ macro_rules! impl_from_array {
5555

5656
test_if!{
5757
$test_tt:
58-
interpolate_idents! {
59-
mod [$id _from] {
58+
paste::item! {
59+
mod [<$id _from>] {
6060
use super::*;
6161
#[test]
6262
fn array() {
@@ -89,15 +89,15 @@ macro_rules! impl_from_array {
8989
let array_from_vec = <[$elem_ty; $elem_count]>::from(vec);
9090
// FIXME: Workaround for arrays with more than 32 elements.
9191
for i in 0..$elem_count {
92-
assert_eq!(array_from_vec[[i]], array[[i]]);
92+
assert_eq!(array_from_vec[i], array[i]);
9393
}
9494

9595
let vec_from_into_array: $id = array.into();
9696
assert_eq!(vec_from_into_array, vec);
9797
let array_from_into_vec: [$elem_ty; $elem_count] = vec.into();
9898
// FIXME: Workaround for arrays with more than 32 elements.
9999
for i in 0..$elem_count {
100-
assert_eq!(array_from_into_vec[[i]], array[[i]]);
100+
assert_eq!(array_from_into_vec[i], array[i]);
101101
}
102102
}
103103
}

src/api/from/from_vector.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ macro_rules! impl_from_vector {
3232

3333
test_if!{
3434
$test_tt:
35-
interpolate_idents! {
36-
pub mod [$id _from_ $source] {
35+
paste::item! {
36+
pub mod [<$id _from_ $source>] {
3737
use super::*;
3838
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
3939
fn from() {

src/api/hash.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ macro_rules! impl_hash {
1717

1818
test_if! {
1919
$test_tt:
20-
interpolate_idents! {
21-
pub mod [$id _hash] {
20+
paste::item! {
21+
pub mod [<$id _hash>] {
2222
use super::*;
2323
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2424
fn hash() {

src/api/into_bits/macros.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ macro_rules! impl_from_bits_ {
1111

1212
test_if!{
1313
$test_tt:
14-
interpolate_idents! {
15-
pub mod [$id _from_bits_ $from_ty] {
14+
paste::item! {
15+
pub mod [<$id _from_bits_ $from_ty>] {
1616
use super::*;
1717
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
1818
fn test() {

src/api/math/float/abs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ macro_rules! impl_math_float_abs {
1313

1414
test_if!{
1515
$test_tt:
16-
interpolate_idents! {
17-
pub mod [$id _math_abs] {
16+
paste::item! {
17+
pub mod [<$id _math_abs>] {
1818
use super::*;
1919
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2020
fn abs() {

src/api/math/float/cos.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ macro_rules! impl_math_float_cos {
2020

2121
test_if!{
2222
$test_tt:
23-
interpolate_idents! {
24-
pub mod [$id _math_cos] {
23+
paste::item! {
24+
pub mod [<$id _math_cos>] {
2525
use super::*;
2626
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2727
fn cos() {

src/api/math/float/exp.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ macro_rules! impl_math_float_exp {
1313

1414
test_if!{
1515
$test_tt:
16-
interpolate_idents! {
17-
pub mod [$id _math_exp] {
16+
paste::item! {
17+
pub mod [<$id _math_exp>] {
1818
use super::*;
1919
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2020
fn exp() {

src/api/math/float/ln.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ macro_rules! impl_math_float_ln {
1313

1414
test_if!{
1515
$test_tt:
16-
interpolate_idents! {
17-
pub mod [$id _math_ln] {
16+
paste::item! {
17+
pub mod [<$id _math_ln>] {
1818
use super::*;
1919
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2020
fn ln() {

src/api/math/float/mul_add.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ macro_rules! impl_math_float_mul_add {
1313

1414
test_if!{
1515
$test_tt:
16-
interpolate_idents! {
17-
pub mod [$id _math_mul_add] {
16+
paste::item! {
17+
pub mod [<$id _math_mul_add>] {
1818
use super::*;
1919
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2020
fn mul_add() {

src/api/math/float/mul_adde.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ macro_rules! impl_math_float_mul_adde {
1717

1818
test_if!{
1919
$test_tt:
20-
interpolate_idents! {
21-
pub mod [$id _math_mul_adde] {
20+
paste::item! {
21+
pub mod [<$id _math_mul_adde>] {
2222
use super::*;
2323
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2424
fn mul_adde() {

src/api/math/float/powf.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ macro_rules! impl_math_float_powf {
1313

1414
test_if!{
1515
$test_tt:
16-
interpolate_idents! {
17-
pub mod [$id _math_powf] {
16+
paste::item! {
17+
pub mod [<$id _math_powf>] {
1818
use super::*;
1919
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2020
fn powf() {

src/api/math/float/recpre.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ macro_rules! impl_math_float_recpre {
1414

1515
test_if!{
1616
$test_tt:
17-
interpolate_idents! {
18-
pub mod [$id _math_recpre] {
17+
paste::item! {
18+
pub mod [<$id _math_recpre>] {
1919
use super::*;
2020
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2121
fn recpre() {

src/api/math/float/rsqrte.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ macro_rules! impl_math_float_rsqrte {
1717

1818
test_if!{
1919
$test_tt:
20-
interpolate_idents! {
21-
pub mod [$id _math_rsqrte] {
20+
paste::item! {
21+
pub mod [<$id _math_rsqrte>] {
2222
use super::*;
2323
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
2424
fn rsqrte() {

src/api/math/float/sin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ macro_rules! impl_math_float_sin {
2727

2828
test_if!{
2929
$test_tt:
30-
interpolate_idents! {
31-
pub mod [$id _math_sin] {
30+
paste::item! {
31+
pub mod [<$id _math_sin>] {
3232
use super::*;
3333
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
3434
fn sin() {

0 commit comments

Comments
 (0)