In the example, hs reexport HashSet from std. But it compiles without error or warning. Why?
#![no_std]
pub use hs::HashSet;
pub fn new() -> HashSet<usize> {
HashSet::new()
}
pub fn insert(a: &mut HashSet<usize>, v: usize) {
a.insert(v);
}
Well
#![no_std]
just means that you don't includestd
by default. It doesn't mean you can't explicitly or implicitly (i.e. through other crates) still includestd
. In other words#![no_std]
does not prohibit usingstd
but it disables using it by default.For example this works, too: