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

Using version 1.0.0, without default features, fails with compile error [edited: not an issue] #481

Closed
cipriancraciun opened this issue May 19, 2018 · 2 comments

Comments

@cipriancraciun
Copy link
Contributor

cipriancraciun commented May 19, 2018

[Not sure if this is an issue indeed, or a small "feature request".]


As the subject says, trying to use the regex crate version 1.0.0, without the default features, and with the latest nightly (2018-05-18) fails with the following compile time error:

error[E0432]: unresolved import `Error`
  --> /home/ciprian/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.0.0/src/compile.rs:25:5
   |
25 | use Error;
   |     ^^^^^ no `Error` in the root. Did you mean to use `error`?

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.

The way I include the dependency is:

[dependencies.regex]
version = "~1.0.0"
optional = true
features = []
default-features = false

It seems that with the default-features = true and without any additional features enabled, it succeeds. On further investigation it seems that requiring (without default features) just use_std succeeds, which is in fact the default.

If the crate does require that one always use use_std, then perhaps a compile time error would be helpful, like for example:

#[ cfg ( not ( feature = "use_std" ) ) ]
compile_error! ("`use_std` feature is currently required to build this crate");
@BurntSushi
Copy link
Member

This is intentional, as documented in the changelog.

I don't think I knew about the existence of compile_error!. PRs are welcome. :-)

@cipriancraciun
Copy link
Contributor Author

Pull request done: #482


Regarding the changelog, indeed it is listed there exactly as it happens... However I guess not many read the changelogs of all their dependencies... (Indeed this is an "user" error, but to the "user" defense, there are so many dependencies these days...) :)

@cipriancraciun cipriancraciun changed the title Using version 1.0.0, without default features, and with latest nightly (2018-05-18) fails with compile error Using version 1.0.0, without default features, fails with compile error [edited: not an issue] May 19, 2018
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

No branches or pull requests

2 participants