Skip to content

Benchmark example is broken in the book #24923

Closed
@gsingh93

Description

@gsingh93

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions