Closed
Description
STR
Cargo.toml
[package]
name = "foo"
version = "0.1.0"
authors = ["Jorge Aparicio <jorge@japaric.io>"]
[dependencies]
[dev-dependencies]
stm32f30x = "=0.8.0"
src/lib.rs
//! ```
//! // crate: stm32f30x-hal
//! //! An implementation of the `embedded-hal` traits for STM32F30x microcontrollers
//!
//! // device crate
//! extern crate stm32f30x;
//!
//! use stm32f30x::USART1;
//!
//! # fn main() {}
//! ```
$ cargo test
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running target/debug/deps/foo-794f65deaf39282e
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Doc-tests foo
running 1 test
test src/lib.rs - (line 1) ... FAILED
failures:
---- src/lib.rs - (line 1) stdout ----
error[E0432]: unresolved import `stm32f30x`
--> src/lib.rs:8:5
|
9 | use stm32f30x::USART1;
| ^^^^^^^^^ maybe a missing `extern crate stm32f30x;`?
thread 'src/lib.rs - (line 1)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:327:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failures:
src/lib.rs - (line 1)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
error: test failed, to rerun pass '--doc'
$ rustc -V
rustc 1.32.0-nightly (4a45578bc 2018-12-07)
Ways to "fix" the error:
- Add
edition = "2018"
to Cargo.toml, OR - Remove the doc comment (
//!
), OR - Switch to an older nightly (e.g. nightly-2018-11-01)