Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for non-SIMD scenarios #287

Merged
merged 2 commits into from
May 2, 2023
Merged

Conversation

Colerar
Copy link
Contributor

@Colerar Colerar commented Apr 29, 2023

Before:

error[E0308]: mismatched types
   --> (**masked**)/src/lib.rs:228:86
    |
228 | fn please_compile_with_a_simd_compatible_cpu_setting_read_the_simdjsonrs_readme() -> ! {}
    |    ----------------------------------------------------------------------------      ^ expected `!`, found `()`
    |    |
    |    implicitly returns `()` as its body has no tail or `return` expression
    |
    = note:   expected type `!`
            found unit type `()`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `simd-json` due to previous error

After:

error: Please compile with a simd compatible cpu setting, read the simdjson README.
   --> (**masked**)/src/lib.rs:229:5
    |
229 |     compile_error!("Please compile with a simd compatible cpu setting, read the simdjson README.");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not compile `simd-json` due to previous error

Much cleaner, without distracting noise.

Copy link
Member

@Licenser Licenser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love it, simple and brilliant! I learned something new :) thanks!

@Licenser Licenser enabled auto-merge (rebase) April 29, 2023 13:11
@Licenser
Copy link
Member

Licenser commented May 2, 2023

@Colerar it seems like the compiler error always fires for some reason

@Colerar
Copy link
Contributor Author

Colerar commented May 2, 2023

Caused by:

Doc-tests simd-json
error: Please compile with a simd compatible cpu setting, read the simdjson README.
   --> /home/runner/work/simd-json/simd-json/src/lib.rs:229:5
    |
229 |     compile_error!("Please compile with a simd compatible cpu setting, read the simdjson README.");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: doctest failed, to rerun pass `--doc`

Related issues:

rust-lang/cargo#4737
rust-lang/rust#43031

@Colerar
Copy link
Contributor Author

Colerar commented May 2, 2023

We need to specify rustdocflags option, as described in: rust-lang/cargo#6650 (comment)

auto-merge was automatically disabled May 2, 2023 08:02

Head branch was pushed to by a user without write access

@Licenser
Copy link
Member

Licenser commented May 2, 2023

Great find :) lets give it a try

@Licenser Licenser merged commit f0824f4 into simd-lite:main May 2, 2023
@Licenser
Copy link
Member

Licenser commented May 2, 2023

Worked perfectly, thanks again! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants