seanmonstar / httparse

A push parser for the HTTP 1.x protocol in Rust.
https://docs.rs/httparse
Apache License 2.0
573 stars 113 forks source link

enable stdsimd #46

Closed MarcAntoine-Arnaud closed 5 years ago

MarcAntoine-Arnaud commented 6 years ago

I try to launch: cargo +nightly clippy on my project and I get this error:

error[E0658]: macro is_x86_feature_detected! is unstable (see issue #0)
  --> /Users/marco/.cargo/registry/src/github.com-1ecc6299db9ec823/httparse-1.3.2/src/simd/mod.rs:72:48
   |
72 |             if cfg!(target_arch = "x86_64") && is_x86_feature_detected!("avx2") {
   |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: add #![feature(stdsimd)] to the crate attributes to enable

error[E0658]: macro is_x86_feature_detected! is unstable (see issue #0)
  --> /Users/marco/.cargo/registry/src/github.com-1ecc6299db9ec823/httparse-1.3.2/src/simd/mod.rs:75:23
   |
75 |             } else if is_x86_feature_detected!("sse4.2") {
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: add #![feature(stdsimd)] to the crate attributes to enable

error: aborting due to 2 previous errors

I have tried to add httparse in my dependencies with:

#![feature(stdsimd)]
extern crate httparse;

but it stay similar.

Is it possible to have some help on it ? Thanks, Marc-Antoine

seanmonstar commented 6 years ago

What version of rustc is used when you use +nightly? Specifically, the output of rustc +nightly -V.

MarcAntoine-Arnaud commented 6 years ago

it's the latest one: rustc 1.27.0-nightly (ad610bed8 2018-04-11)

MarcAntoine-Arnaud commented 6 years ago

You can found project here: https://github.com/media-io/phoenix-rs With the travis error: https://travis-ci.org/media-io/phoenix-rs/jobs/404466234

seanmonstar commented 6 years ago

That version is actually several months old. For instance, I see the output rustc 1.29.0-nightly (254f8796b 2018-07-13).

httparse uses a build script to detect if the version is at least 1.27, before enabling SIMD support. The problem is that when the nightly version of 1.27 is run, SIMD wasn't yet stable, and so requires the #![feature(...)] flag. If compiling with any stable version of the compiler, you shouldn't see an issue.