Stream: t-compiler/help

Topic: added new intrinsic, can't build libcore


Oliver Giersch (Jul 21 2020 at 06:53, on Zulip):

Hi, I've added code for generating a new atomic intrinsic to librustc_llvm_codegen/intrinsic.rs (or rather a new success/failure ordering combination for cxchg) and added the corresponding intrinsic signature to libcore/intrinsics.rs and usage to libcore/sync/atomic.rs.
However, with changes to both llvm_codegen and libcore the stage-1 build of libstd (and libcore I assume) fails.
From my understanding of the bootstrapping process, this should be caused by the beta compiler used in stage-1 being unable to compile the changes made to libcore because it is lacking the changes to llvm_codegen.
How do I go about this? Do I have to first try to get the changes to codegen merged and only then the changes to core?

bjorn3 (Jul 21 2020 at 08:08, on Zulip):

You can use #[cfg(bootstrap)] and #[cfg(not(bootstrap))] to only enable or disable code in libcore when compiling using the bootstrap compiler.

Oliver Giersch (Jul 21 2020 at 08:37, on Zulip):

bjorn3 said:

You can use #[cfg(bootstrap)] and #[cfg(not(bootstrap))] to only enable or disable code in libcore when compiling using the bootstrap compiler.

Thanks for the hint, I hadn't seen anything in the contribution guide about this attribute. I would assume these tend to get phased out over time?

lcnr (Jul 21 2020 at 08:38, on Zulip):

We compile the stage 1 compiler using the current beta release (mostly i think)

lcnr (Jul 21 2020 at 08:39, on Zulip):

after every new beta release, we use the new beta compiler for bootstrap, which means that we can now remove all previous #[cfg(bootstrap)] annotations

lcnr (Jul 21 2020 at 08:39, on Zulip):

see https://github.com/rust-lang/rust/pull/74395 where this was done the last time

lcnr (Jul 21 2020 at 08:41, on Zulip):

(every new beta is mostly just the nightly compiler of that given day, so it contains all relevant changes)

lcnr (Jul 21 2020 at 08:42, on Zulip):

also see https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html

Oliver Giersch (Jul 21 2020 at 08:48, on Zulip):

I see, sorry for asking, I should have read the guide more carefully

lcnr (Jul 21 2020 at 08:49, on Zulip):

don't mind :thumbs_up:

lcnr (Jul 21 2020 at 08:52, on Zulip):

its often far easier to search things if you know what to search for, so this taking me 5 minutes while waiting for stuff to compile isn't something which should prevent you from asking in the future

lcnr (Jul 21 2020 at 08:53, on Zulip):

i also think that questions like this may often end up being somewhat interesting to other people as well

Last update: Sep 28 2020 at 15:30UTC