jbms/wasm-split-prototype

No indirect range

Closed this issue · 3 comments

gbj commented

Continuing to play around with examples built on this, and I ran into a compile-time panic while running build.py

thread 'main' panicked at crates/wasm_split_cli/src/emit.rs:710:13:
No indirect range

My example is here https://github.com/gbj/wasm-split-prototype

Specifically, this triggers the panic

#[cfg_attr(feature = "split", wasm_split::wasm_split(deserialize_comments))]
fn deserialize_comments(data: &str) -> Vec<Comment> {
    serde_json::from_str(data).unwrap()
}

whereas this does not

#[cfg_attr(feature = "split", wasm_split::wasm_split(deserialize_comments))]
fn deserialize_comments(data: &str) -> Vec<Comment> {
    //serde_json::from_str(data).unwrap()
    vec![]
}

If I comment out the panic!() in emit.rs and just return Ok(()):

        if indirect_range.is_empty() {
            panic!("No indirect range");
            return Ok(());
        }

then of course it builds but panics at runtime

Failed to load http://localhost:8080/pkg/view_c.wasm RuntimeError: WebAssembly.instantiate(): table index is out of bounds

Any help appreciated!

jbms commented

I tried to take a look at your example but it seems to reference a local leptos checkout. When I changed those references to refer to my own local checkout of the leptos_0.7 branch I ran into multiple compile errors from leptos, e.g.:

error[E0277]: the trait bound `f32: From<f64>` is not satisfied
leptos/router/src/components.rs:415:34
    |
415 |                 set_progress.set(100.0);
    |                              --- ^^^^^ the trait `From<f64>` is not implemented for `f32`, which is required by `{float}: Into<f32>`
    |                              |
    |                              required by a bound introduced by this call
    |

Can you create a self-contained example?

gbj commented

Apologies! I have also stopped experiencing the error so it may have been something strange in what I had set up. I'll reopen with an MRE if it comes up again.

jbms commented

Note that the panic is a sanity check to avoid creating an empty module, and means that something went wrong previously in determining the split.