phil-opp / blog_os

Writing an OS in Rust

Home Page:http://os.phil-opp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running `cargo test` gives error after following instructions of `post-04`

tathyagarg opened this issue · comments

I've followed all the instructions so far, however, when I run cargo test I get the following error:

error[E0152]: duplicate lang item in crate `core` (which `rustc_std_workspace_core` depends on): `sized`.
  |
  = note: the lang item is first defined in crate `core` (which `volatile` depends on)
  = note: first definition in `core` loaded from my_directory\debug\deps\libcore-da969d849535039e.rmeta
  = note: second definition in `core` loaded from my_directory\debug\deps\libcore-b3bc9f2b6937c461.rmeta

error[E0152]: duplicate lang item in crate `core` (which `rustc_std_workspace_core` depends on): `unsize`.
  |
  = note: the lang item is first defined in crate `core` (which `volatile` depends on)
  = note: first definition in `core` loaded from my_directory\debug\deps\libcore-da969d849535039e.rmeta
  = note: second definition in `core` loaded from my_directory\debug\deps\libcore-b3bc9f2b6937c461.rmeta
...

error: could not compile 'bootloader' (lib) due to 128 previous errors
error: could not compile 'spin' (lib) due to 128 previous errors

Any ideas on what I may be doing wrong?

Are you following the note in Custom Test Frameworks section?
Note: There is currently a bug in cargo that leads to “duplicate lang item” errors on cargo test in some cases. It occurs when you have set panic = "abort" for a profile in your Cargo.toml. Try removing it, then cargo test should work. See the cargo issue for more information on this.

That worked, thanks!