I get that __data_end and __heap_base are probably needed by the Rust runtime, and as soon as I bring in a crate, they will likely be used somehow. But as it stands, I'm not ever going to use __data_end or __heap_base in this example. Can I tell Rust to omit them? (It seems buggy that unused variables would end up in the final program.)
wasm-opt can't remove exports, since those don't count as unused. That's why they weren't removed by rustc either.
The old wasi preview1 ABI spec says this:
Environments shall not access exports named __heap_base or __data_end. Toolchains are encouraged to avoid providing these exports.
("Environments" being host runtimes like the browser, or wasmtime, or what have you)
Strange that Rust woulde export these, or even include them in non-wasi builds. I wonder why they're mentioned at all, I've never been able to figure out what they're for.