Skip to content

Improve error when compiling a derive macro with -Z sanitizer #63986

Open
@software-opal

Description

@software-opal

I'm trying to build some code with the address sanitiser on; and I run into this error:

Compiling failure_derive v0.1.5
error: Only executables, staticlibs, cdylibs, dylibs and rlibs can be compiled with `-Z sanitizer`
error: aborting due to previous error
error: Could not compile `failure_derive`.
error: build failed

After some googling the solution appears to be(from #48199) to use --target=.... I was wondering if the message could be improved to something like:

Compiling failure_derive v0.1.5
error: Only executables, staticlibs, cdylibs, dylibs and rlibs can be compiled with `-Z sanitizer`
hint: Try running the command again, and specifying a target triple; e.g. `--target=x86_64-unknown-linux-gnu`
error: aborting due to previous error
error: Could not compile `failure_derive`.
error: build failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-driverArea: rustc_driver that ties everything together into the `rustc` compilerA-sanitizersArea: Sanitizers for correctness and code qualityC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions