A shebang is displaced in HIR & expanded outputs #134643
Open
Description
opened on Dec 22, 2024
I tried this code:
#!/usr/bin/env rust
fn test() {}
After running rustc -Zunpretty=hir test.rs
, I expected to see this happen:
#!/usr/bin/env rust
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
fn test() { }
Instead, this happened:
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
#!/usr/bin/env rust
fn test() { }
A shebang should remain at the beginning of an output but instead is placed in-between. The same happens with rustc -Zunpretty=expanded test.rs
.
Meta
rustc --version --verbose
:
rustc 1.85.0-nightly (5f23ef7d3 2024-12-20)
binary: rustc
commit-hash: 5f23ef7d3f7a8c3e0ca5c4e1978829c0448a3686
commit-date: 2024-12-20
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.6
Activity