Skip to content

rustc --target wasm32-unknown-unknown -Zinstrument-coverage fails with "can't find crate for profiler_builtins" #81684

Open
@anp

Description

@anp

I'm trying to add support for code coverage to wasm-bindgen tests with the new -Zinstrument-coverage flag, and hitting an error that I only partly understand.

I'm building this with anp/moxie@20920ca, if it would be helpful I can make a smaller repro. Here's the command I'm running and the output I'm seeing (repeated error messages snipped):

❯ env RUSTFLAGS=-Zinstrument-coverage cargo +nightly build --target wasm32-unknown-unknown --package moxie-dom
   Compiling cfg-if v1.0.0
   Compiling once_cell v1.5.2
   Compiling futures-sink v0.3.8
   Compiling futures-core v0.3.8
   Compiling scopeguard v1.1.0
   Compiling pin-utils v0.1.0
   Compiling slab v0.4.2
   Compiling futures-io v0.3.8
error[E0463]: can't find crate for `profiler_builtins`
  |
  = note: the compiler may have been built without the profiler runtime

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
...
error: could not compile `futures-sink`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
...

I've also tried using the wasm32-wasi target, but that also appears to be missing profiler_builtins. Does anyone have guidance on what code needs to be extended to support the instrument-coverage flag for wasm targets?

Meta

rustc --version --verbose:

❯ rustc +nightly --version --verbose
rustc 1.51.0-nightly (04caa632d 2021-01-30)
binary: rustc
commit-hash: 04caa632dd10c2bf64b69524c7f9c4c30a436877
commit-date: 2021-01-30
host: aarch64-apple-darwin
release: 1.51.0-nightly
LLVM version: 11.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions