-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: opt-level > 1 breaks some wasm-bindgen with rust 1.48 but not 1.47 #79282
Comments
Assigning |
I have a similar issue but I'm using a completely different toolchain (stdweb instead of wasm-bindgen). In 1.48 everything works fine, I can compile my code to wasm and execute it in a browser. In 1.49 I can compile it, but when running it says "unreachable executed". Compiling in debug mode fixes the error. I tried to debug it and it looks like a panic while serializing something into a It would be great if someone can confirm that this use of Note that my issue may not be the same as OP's issue. I tried to reproduce OP's issue but was unable, to me it works fine both in 1.48 and 1.49. Also, I had to rename So my theory is that If someone manages to reproduce this issue, try to run the bisect using this command:
|
It looks like SerializedValue is a struct: #[repr(u8)]
pub enum Tag {
Undefined = 0,
Null = 1,
I32 = 2,
F64 = 3,
Str = 4,
False = 5,
True = 6,
Array = 7,
Object = 8,
Reference = 9,
Function = 10,
FunctionMut = 12,
FunctionOnce = 13,
UnsafeTypedArray = 14,
Symbol = 15
}
#[repr(C)]
pub struct SerializedValue< 'a > {
data_1: u64,
data_2: u32,
tag: Tag,
phantom: PhantomData< &'a () >
} I am not sure what our rules for repr(u8) enums are in terms of initialization, but I suspect that we consider them still not valid to be uninit. cc @RalfJung |
I figured out partially what the cause of the problem is, I had I don't know if I should close the issue? |
|
Closing as working as expected / won't fix, in that case. |
Note: I believe this is the warning that RalfJung was referring to:
|
Correct, there is a warning "the type |
Edit: environment variable
RUSTFLAGS="-C target-cpu=native"
caused issue, which when I used 1.47 didn't get applied.When a program is compiled with opt-level > 1 ({'z', 's', 2 ,3}),
wasm-bindgen
fails with an error on the produced binary. This seems like an unexpected regression especially since opt-level <= 1 ({'0','1'}) are unaffected. Rust 1.47 does not have this issue.See rustwasm/wasm-bindgen#2366
How to Reproduce
src/main.rs
cargo.toml
Then with rust 1.48 on linux
Version it worked on
It most recently worked on: Rust 1.47
Version with regression
rustc --version --verbose
:@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged
The text was updated successfully, but these errors were encountered: