Skip to content

rustc hangs when compiling for wasm32 #76281

Closed
@emilk

Description

@emilk

hang.rs

fn main() {
    let mut v: Vec<&()> = Vec::new();
    v.sort_by_key(|&r| r as *const ());
}

Meta

rustc --version --verbose:

rustc --version --verbose
rustc 1.46.0 (04488afe3 2020-08-24)
binary: rustc
commit-hash: 04488afe34512aa4c33566eb16d8c912a3ae04f9
commit-date: 2020-08-24
host: x86_64-apple-darwin
release: 1.46.0
LLVM version: 10.0

Error output

I compile with this:

rustc hang.rs -C opt-level=2 --target wasm32-unknown-unknown

And that hangs rustc.

Details

opt-level must be 2 or higher, and --target must be wasm32-unknown-unknown.

It does NOT hang with rustc 1.48.0-nightly (d006f5734 2020-08-28), so possibly this is a bug that has already been fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions