How do I test a patch for a new target without installing Rust?

#1

Hi,

I am looking to contribute a new target to rust for an embedded target. I’ve downloaded rust and following the lead of this commit set: https://github.com/rust-lang/rust/commit/06f21a5314b7969bf5ee9ec0819c5ddffbad77f9 I created a new .rs under spec, updated spec/mod.rs and modified src/tools/build-manifest/src/main.rs. I did not modify src/ci/docker/dist-various-1/Dockerfile because I am not sure how to test any change here. Right now I want to test the changes I have made. I have built rustc with ./x.py build. It built three different rustc versions where I assume it is ok to only focus on testing the stage 2 compiler. For testing I simply would like to build and try to run a “hello world” on my target mcu (I have not yet looked into how to test with docker and qemu). So my question is how do I run this new rustc that I built. My hello world needs to be compiled using cargo-xrustc because core needs to be rebuilt. I thought it was as simple as setting build.rustc to the stage 2 rustc binary location or by setting the envirornment variable RUSTC=/my/stage2/rust/location but neither technique is working. Doing the later I get an error:

error: The XARGO_RUST_SRC env variable must be set and point to the Rust source directory when working with the 'dev' channel

but setting the path to the source root directory gives a permission denied error.

Any suggestions?

BTW, I don’t want to install my newly built rust with ./x.py install because I am not sure how I would revert this change, don’t necessarily trust what I built, and don’t want to ruin a rustc/cargo setup that is currently working (minus of course my new target that I want to contribute).

Johnnie

0 Likes