Skip to content

cfg_attr bootstrap does not work correctly when cross-compiling #84057

Closed
@infinity0

Description

@infinity0

https://buildd.debian.org/status/fetch.php?pkg=rustc&arch=amd64&ver=1.50.0%2Bdfsg1-1%7Eexp2&stamp=1618053860&raw=0 (warning, very large several MB)

This build uses 1.50.0 x86-64 linux as stage0 (bootstrap) to compile 1.50.0 again for both x86-64 linux and windows. The windows part of the build fails with:

    < Libdir { compiler: Compiler { stage: 2, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-pc-windows-gnu", file: None } }
running: "/usr/bin/rustc" "--cfg" "bootstrap" "--target" "x86_64-pc-windows-gnu" "--emit=obj" "-o" "/<<PKGBUILDDIR>>/build/x86_64-pc-windows-gnu/native/rtstartup/rsbegin.o" "/<<PKGBUILDDIR>>/library/rtstartup/rsbegin.rs"
error[E0557]: feature has been removed
  --> /<<PKGBUILDDIR>>/library/rtstartup/rsbegin.rs:17:32
   |
17 | #![cfg_attr(bootstrap, feature(optin_builtin_traits))]
   |                                ^^^^^^^^^^^^^^^^^^^^ feature has been removed
   |
   = note: renamed to `auto_traits`

error[E0658]: auto traits are experimental and possibly buggy
  --> /<<PKGBUILDDIR>>/library/rtstartup/rsbegin.rs:26:1
   |
26 | auto trait Sync {}
   | ^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
   = help: add `#![feature(auto_traits)]` to the crate attributes to enable

error[E0658]: auto traits are experimental and possibly buggy
  --> /<<PKGBUILDDIR>>/library/rtstartup/rsbegin.rs:30:1
   |
30 | auto trait Freeze {}
   | ^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
   = help: add `#![feature(auto_traits)]` to the crate attributes to enable

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0557, E0658.
For more information about an error, try `rustc --explain E0557`.

This suggests that cfg_attr(bootstrap is not activating correctly, probably being confused by the cross-compilation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions