Description
I'm working on a non-trivial project building with rustc 1.33.0-nightly (93c2f055b 2018-12-15)
with a thumbv7em-none-eabi
target, and I've run into an issue where something in the code breaks the compiler output (in both -v
and regular modes) such that it emits neither the location/line number of some errors nor the context in which the error occurred, but only for some errors:
mqudsi@Blitzkrieg /m/d/G/remoterelay> make
env -u RUSTFLAGS -u CC -u CXX -u CFLAGS -u CXXFLAGS -u CPPFLAGS cargo build --release --target thumbv7em-none-eabi
Compiling resetplug v0.1.0 (/mnt/d/GIT/remoterelay)
warning: unused imports: `SleepMode`, `sleep`
--> src/rfm69.rs:2:21
|
2 | use crate::cortex::{sleep, SleepMode};
| ^^^^^ ^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
warning: unused import: `cortex_m::Peripherals`
--> src/timer.rs:11:5
|
11 | use cortex_m::Peripherals;
| ^^^^^^^^^^^^^^^^^^^^^
warning: unused import: `cortex_m::peripheral::SYST`
--> src/timer.rs:12:5
|
12 | use cortex_m::peripheral::SYST;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: unused import: `self::cortex::*`
--> src/main.rs:31:5
|
31 | use self::cortex::*;
| ^^^^^^^^^^^^^^^
warning: unused import: `panic_semihosting`
--> src/main.rs:40:5
|
40 | use panic_semihosting;
| ^^^^^^^^^^^^^^^^^
warning: unnecessary parentheses around assigned value
|
= note: #[warn(unused_parens)] on by default
warning: unnecessary parentheses around assigned value
error[E0308]: mismatched types
|
= note: expected type `()`
found type `core::result::Result<(), stm32f103xx_hal::spi::Error>`
warning: unreachable statement
--> src/rfm69.rs:615:13
|
615 | / for _ in 0..3 {
616 | | // debug!("ms: {}", Self::milliseconds());
617 | | let status = self.get_status()?;
618 | | let mode = self.get_mode()?;
... |
632 | | }
633 | | }
| |_____________^
|
= note: #[warn(unreachable_code)] on by default
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
error: Could not compile `resetplug`.
To learn more, run the command again with --verbose.
Makefile:7: recipe for target 'all' failed
make: *** [all] Error 101
As you can see, while some of the warnings correctly show where they occurred, I have both warnings and error messages that are devoid of any context to help pin them down, e.g.
warning: unnecessary parentheses around assigned value
|
= note: #[warn(unused_parens)] on by default
warning: unnecessary parentheses around assigned value
and more worryingly
error[E0308]: mismatched types
|
= note: expected type `()`
found type `core::result::Result<(), stm32f103xx_hal::spi::Error>`
I'm not able to reproduce this behavior in an MVP.
For reference, rustc
is ultimately invoked as follows:
rustc --edition=2018 --crate-name resetplug src/main.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 -C debuginfo=2 -C metadata=1e2eb267bde647f6 -C extra-filename=-1e2eb267bde647f6 --out-dir /mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps --target thumbv7em-none-eabi -L dependency=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps -L dependency=/mnt/d/GIT/remoterelay/target/release/deps --extern arrayvec=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps/libarrayvec-26146b813587c3c2.rlib --extern bitfield=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps/libbitfield-997032c56c0315d9.rlib --extern bitflags=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps/libbitflags-d86d85ee8fa2114a.rlib --extern cortex_m=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps/libcortex_m-40f83b831cae7928.rlib --extern cortex_m_rt=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps/libcortex_m_rt-e20c4e09525d2181.rlib --extern cortex_m_semihosting=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps/libcortex_m_semihosting-9650c89d0a9a08a6.rlib --extern embedded_hal=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps/libembedded_hal-e7949b13f3dd68af.rlib --extern generic_array=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps/libgeneric_array-6efd9bb5e3345cca.rlib --extern panic_semihosting=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps/libpanic_semihosting-6e573ccd50b870ae.rlib --extern stm32f103xx_hal=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps/libstm32f103xx_hal-c88e35dd2872e6d7.rlib --extern typenum=/mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/deps/libtypenum-9af09db0d0907f97.rlib -Z external-macro-backtrace -C link-arg=-Tlink.x -L /mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/build/cortex-m-rt-703d7c131cf138a6/out -L /mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/build/cortex-m-semihosting-c616a089e2dd4d11/out -L /mnt/d/GIT/remoterelay/target/thumbv7em-none-eabi/release/build/stm32f103xx-hal-62c503a0a996e381/out