Skip to content

Benchmark example is broken in the book #24923

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

Closed
gsingh93 opened this issue Apr 29, 2015 · 1 comment · Fixed by #24931
Closed

Benchmark example is broken in the book #24923

gsingh93 opened this issue Apr 29, 2015 · 1 comment · Fixed by #24931

Comments

@gsingh93
Copy link
Contributor

The benchmark example here does not compile: https://doc.rust-lang.org/book/benchmark-tests.html

Error message when running rustc foo.rs --test:

foo.rs:10:1: 23:2 error: the name `test` conflicts with an external crate that has been imported into this module [E0260]
foo.rs:10 mod test {
foo.rs:11     use super::*;
foo.rs:12     use test::Bencher;
foo.rs:13 
foo.rs:14     #[test]
foo.rs:15     fn it_works() {
          ...
error: aborting due to previous error
jooert added a commit to jooert/rust that referenced this issue Apr 29, 2015
Since rust-lang#24783, the style guidelines recommend that unit tests should live in a submodule `tests` rather than `test` to not clash with the possible use of libtest. This is especially important for benchmark tests as they require libtest. Fixes rust-lang#24923.
@jooert
Copy link
Contributor

jooert commented Apr 29, 2015

Oh, i forgot to change this part of the docs in #24783, where it was decided to have unit tests in a submodule tests rather than test because of exactly the same problem you're describing here. PR is #24931.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Apr 29, 2015
Since rust-lang#24783, the style guidelines recommend that unit tests should live in a submodule `tests` rather than `test` to not clash with the possible use of libtest. This is especially important for benchmark tests as they require libtest. Fixes rust-lang#24923.
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 a pull request may close this issue.

2 participants