rust/tests/ui/extern-flag
Trevor Gross 1412cfc987 Inject compiler_builtins during postprocessing rather than via AST
`compiler_builtins` is currently injected as `extern crate
compiler_builtins as _`. This has made gating via diagnostics difficult
because it appears in the crate graph as a non-private dependency, and
there isn't an easy way to differentiate between the injected AST and
user-specified `extern crate compiler_builtins`.

Resolve this by injecting `compiler_builtins` during postprocessing
rather than early in the AST. Most of the time this isn't even needed
because it shows up in `std` or `core`'s crate graph, but injection is
still needed to ensure `#![no_core]` works correctly.

A similar change was attempted at [1] but this encountered errors
building `proc_macro` and `rustc-std-workspace-std`. Similar failures
showed up while working on this patch, which were traced back to
`compiler_builtins` showing up in the graph twice (once via dependency
and once via injection). This is resolved by not injecting if a
`#![compiler_builtins]` crate already exists.

[1]: https://github.com/rust-lang/rust/pull/113634
2025-02-21 17:37:03 +00:00
..
auxiliary Include the "unwind" crate to link with libunwind instead of the "libc" crate. 2024-11-14 10:51:28 -05:00
empty-extern-arg.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
empty-extern-arg.stderr Inject compiler_builtins during postprocessing rather than via AST 2025-02-21 17:37:03 +00:00
force-extern.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
invalid-crate-name-dashed.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
invalid-crate-name-dashed.stderr
invalid-crate-name-non-ascii.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
invalid-crate-name-non-ascii.stderr
invalid-crate-name.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
invalid-crate-name.stderr
multiple-opts.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
multiple-opts.stderr Reword "crate not found" resolve message 2025-01-24 01:19:50 +00:00
no-force-extern.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
no-nounused.rs Spruce up the diagnostics of some early lints 2024-06-03 07:25:32 +02:00
no-nounused.stderr Spruce up the diagnostics of some early lints 2024-06-03 07:25:32 +02:00
noprelude-and-prelude.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
noprelude-resolves.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
noprelude.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
noprelude.stderr Reword "crate not found" resolve message 2025-01-24 01:19:50 +00:00
nounused.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
public-and-private.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
public-and-private.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
redundant-force-extern.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00