Skip to content

Pass --target to Cargo, if it has been passed by the user #61

@hannobraun

Description

@hannobraun

I'd like to use trybuild for a crate that's designed to run on a microcontroller target (lpc8xx-hal). As cargo run --example ... is one of the most common things we do when developing the crate, we are setting the target in .cargo/config, to save us from typing --target=thumbv6m-none-eabi every time.

The standard library is not available for that target, so the Cargo package generated by trybuild won't compile (see #60). This is fine, as we can just compile our crate for the host platform, which should work well enough for compile-fail tests (we already do this for doc tests). However, when overriding the target (e.g. cargo test --target=x86_64-unknown-linux-gnu), trybuild won't pass this on in its own Cargo invocations. I think it should.

I tried implementing this, but couldn't figure out where I can get the --target that has been passed to Cargo, before I ran out of time. I think I'll leave this for now, as I have some higher-priority tasks. But if someone can give me pointers on how I can figure out which target to use, I might give this another try.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions