Open
Description
$ cargo create --lib foo
$ cd foo
$ cat >> Cargo.toml <<EOF
[lib]
crate-type = ["rlib", "staticlib"]
[profile.dev]
panic="abort"
EOF
$ cat > src/lib.rs <<EOF
#![cfg_attr(not(test), no_std)]
#![feature(lang_items)]
#[cfg(not(test))]
#[lang = "panic_fmt"]
#[no_mangle]
pub fn panic_fmt(_: core::fmt::Arguments, _: &'static str, _: u32, _: u32) -> ! {
loop {}
}
EOF
$ cargo +nightly build
Compiling foo v0.1.0 (file:///tmp/foo)
Finished dev [unoptimized + debuginfo] target(s) in 0.13 secs
$ cargo +nightly test
Compiling foo v0.1.0 (file:///tmp/foo)
error: language item required, but not found: `eh_personality`
error: aborting due to previous error
That is an error that is expected with no_std
, but the code is supposed to be essentially empty in the test
configuration.
It works when crate-type
contains only one value (either one).