-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-prettyArea: Pretty printing (including `-Z unpretty`)Area: Pretty printing (including `-Z unpretty`)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
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
Metadata
Metadata
Assignees
Labels
A-prettyArea: Pretty printing (including `-Z unpretty`)Area: Pretty printing (including `-Z unpretty`)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.