Skip to content

Macros exported by compiler_builtins should not be in the prelude #113533

Closed
@Amanieu

Description

@Amanieu

compiler_builtins exports some macros for use by its tests, but rustc seems to make these available to any code as if they were part of the prelude. While compiler_builtins should be fixed to not export these, it is also strange that the prelude includes these macros.

// Compile with: rustc foo.rs --target aarch64-unknown-linux-gnu --crate-type lib
#![no_std]

foreach_cas16!();
error: unexpected end of macro invocation
 --> src/lib.rs:3:1
  |
3 | foreach_cas16!();
  | ^^^^^^^^^^^^^^^^ missing tokens in macro arguments
  |
note: while trying to match meta-variable `$r#macro:path`
 --> /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/obj/build/x86_64-unknown-linux-gnu/stage1-std/aarch64-unknown-linux-gnu/release/build/compiler_builtins-0862f16702efa101/out/outlined_atomics.rs:103:51

error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions