I have two files:
module.rs
#[main]
fn main() {
println!("{}", std::str::from_utf8_lossy(b"Hello, world!"));
}
lib.rs
#![crate_id = "testcrate"]
#![crate_type = "bin"]
mod module;
rustc module.rs compiles without any problems. rustc lib.rs yields the error message:
module.rs:3:17: 3:42 error: unresolved name `std::str::from_utf8_lossy`.
module.rs:3 println!("{}", std::str::from_utf8_lossy(b"Hello, world!"));