Rust:Test run on Project-1 failed.
playasim opened this issue · 3 comments
cargo test failed.
Your first few errors probably look like:
error[E0433]: failed to resolve: use of undeclared type or module `assert_cmd`
--> tests/tests.rs:1:5
|
1 | use assert_cmd::prelude::*;
| ^^^^^^^^^^ use of undeclared type or module `assert_cmd`
error[E0432]: unresolved import
--> tests/tests.rs:3:5
|
3 | use predicates::str::contains;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
didnt see the error shown in tutorial, but meet the error below.
Martin Ma@DESKTOP-2POQO2H MINGW64 ~/Documents/rustproj/talent_plan/talent-plan/rust/projects/project-1 (master)
$ cargo test
Compiling kvs v0.1.0 (C:\Users\Martin Ma\Documents\rustproj\talent_plan\talent-plan\rust\projects\project-1)
Compiling serde_json v1.0.39
error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
--> src\lib.rs:4:9
|
4 | pub use kv::KvStore;
| ^^
5 |
6 | mod kv;
| ------- not an extern crate passed with `--extern`
|
note: this import refers to the module defined here
--> src\lib.rs:6:1
|
6 | mod kv;
| ^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.
error: Could not compile `kvs`.
warning: build failed, waiting for other jobs to finish...
error: build failed
seems like better change
pub use kv::KvStore;
to
pub use self::kv::KvStore;
hi @playasim
I'm also working on the rust project and I've finished project-1 but didn't meet the problem you met.
If you run cargo test
in the given code wrote by PingCap, you shouldn't meet any error and it shall simply pass all tests without modifying a single line (at least on Linux, I'm not sure if things behave differently on Windows).
If you are starting from scratch, as supposed by the purpose of this project, then I suggest you try run cargo test
from the code PingCap has provided (the code you forked), and see if that bug still exists, if it does, I suggest that you update rust and cargo with rustup update
(by the way, I don't know how to update Rust on Windows, this works for MacOS and Linux) and see if the bug still exists. Because I have seen similar bug reports from people running previous version of Rust.
If you still have problems, don't hesitate to ask, but with more information like, did the original code compile and works fine, what modification did you make and how are the files arranged (directory organization).
Hi I validated that this is not an issue on the current stable and nightly versions of Rust, it seems to not be an issue. Please reopen if you're still struggling and we can try harder to reproduce!