Closed
Description
The playground on nightly in debug mode fails to compile the below code to WASM with following error:
error: expected function name count (598) <= function count (441)
00257ca: error: OnFunctionNamesCount callback failed
It compiles fine in release mode.
I should also mention that there is a bug in the resulting wasm code when opt-level=0
, see rust-lang/rust#47776.
fn main() {}
extern {
fn log_i32(val: i32);
}
#[no_mangle]
pub fn run() {
let s = "Tre".as_bytes();
let len = s.len();
unsafe {
log_i32(len as i32);
}
}
Activity
shepmaster commentedon Jan 26, 2018
That error is pretty ugly which makes me think it's not coming from Rust.
You can see the steps we perform after compilation:
https://github.com/integer32llc/rust-playground/blob/964fff159d7925c8121244b4db3fa29d2f5bcdad/compiler/base/cargo-wasm#L38-L51
Perhaps you could try those with your code and see if either tool fails? It might help pinpoint details with your correctness issue as well.
shepmaster commentedon Apr 20, 2018
This works now, so assuming it was an upstream issue.