mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-30 20:17:50 +00:00

`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
12 lines
418 B
Rust
12 lines
418 B
Rust
// Test that using a macro to replace the entire crate tree with a non-'mod' item errors out nicely.
|
|
// `issue_59191::no_main` replaces whatever's passed in with `fn main() {}`.
|
|
|
|
//@ edition:2018
|
|
//@ proc-macro: issue-59191.rs
|
|
//@ needs-unwind (affects error output)
|
|
//@ error-pattern: error: `#[panic_handler]` function required
|
|
|
|
#![feature(custom_inner_attributes)]
|
|
#![issue_59191::no_main]
|
|
#![issue_59191::no_main]
|