diff options
| author | gnzlbg <gnzlbg@users.noreply.github.com> | 2018-03-10 19:22:54 +0100 | 
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2018-03-10 12:22:54 -0600 | 
| commit | 2762e2ca9adcd1ced925ae29fe3a169b2223568b (patch) | |
| tree | d3073f1ccffb38a0292aba9701085d0b8cd59832 /library/stdarch/crates/assert-instr-macro | |
| parent | 63b540b07adec5c7cdfe50961a1be3f999692624 (diff) | |
| download | rust-2762e2ca9adcd1ced925ae29fe3a169b2223568b.tar.gz rust-2762e2ca9adcd1ced925ae29fe3a169b2223568b.zip | |
[mips/mips64: msa] add add_a_b intrinsic (#365)
* [mips64/msa] add add_a_b intrinsic * add make/file to mips64el's Dockerfile * add run-time detection support for mips64 * add mips64 build bot * generate docs for mips64 * fix linux test * cleanup rt-detection * support mips64/mips64el in stdsimd-test * support asserting instructions with in their name * better error msgs for the auxv_crate test * debug auxv on mips64 * override run-time detection on mips msa tests * remove unused #[macro_use] * try another MIPS cpu * detect default TARGET in simd-test-macro * use mips64r2-generic * disable unused function in mips tests * move msa to mips * remove mips from ci * split into mips and mips64 modules * add rt-detection for 32-bit mips * fmt * remove merge error * add norun build bots for mips * add -p to avoid changing the cwd * fixup * refactor run-time detection module
Diffstat (limited to 'library/stdarch/crates/assert-instr-macro')
| -rw-r--r-- | library/stdarch/crates/assert-instr-macro/src/lib.rs | 18 | 
1 files changed, 13 insertions, 5 deletions
| diff --git a/library/stdarch/crates/assert-instr-macro/src/lib.rs b/library/stdarch/crates/assert-instr-macro/src/lib.rs index 24b0e888cf6..5066d0bbcd4 100644 --- a/library/stdarch/crates/assert-instr-macro/src/lib.rs +++ b/library/stdarch/crates/assert-instr-macro/src/lib.rs @@ -39,8 +39,15 @@ pub fn assert_instr( (quote! { #[ignore] }).into() }; let name = &func.ident; + use quote::ToTokens; + let instr_str = instr + .clone() + .into_tokens() + .to_string() + .replace('.', "_") + .replace(|c: char| c.is_whitespace(), ""); let assert_name = syn::Ident::from( - &format!("assert_{}_{}", name.as_ref(), instr.as_ref())[..], + &format!("assert_{}_{}", name.as_ref(), instr_str)[..], ); let shim_name = syn::Ident::from(format!("{}_shim", name.as_ref())); let mut inputs = Vec::new(); @@ -72,7 +79,7 @@ pub fn assert_instr( attr.path .segments .first() - .unwrap() + .expect("attr.path.segments.first() failed") .value() .ident .as_ref() @@ -109,7 +116,8 @@ pub fn assert_instr( } }.into(); // why? necessary now to get tests to work? - let tts: TokenStream = tts.to_string().parse().unwrap(); + let tts: TokenStream = + tts.to_string().parse().expect("cannot parse tokenstream"); let tts: TokenStream = quote! { #item @@ -119,13 +127,13 @@ pub fn assert_instr( } struct Invoc { - instr: syn::Ident, + instr: syn::Expr, args: Vec<(syn::Ident, syn::Expr)>, } impl syn::synom::Synom for Invoc { named!(parse -> Self, map!(parens!(do_parse!( - instr: syn!(syn::Ident) >> + instr: syn!(syn::Expr) >> args: many0!(do_parse!( syn!(syn::token::Comma) >> name: syn!(syn::Ident) >> | 
