Skip to content

Improve test coverage of HIR pretty printing. #140430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions tests/ui/unpretty/exhaustive-asm.expanded.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#![feature(prelude_import)]
#[prelude_import]
use std::prelude::rust_2024::*;
#[macro_use]
extern crate std;
//@ revisions: expanded hir
//@[expanded]compile-flags: -Zunpretty=expanded
//@[expanded]check-pass
//@[hir]compile-flags: -Zunpretty=hir
//@[hir]check-pass
//@ edition:2024
//@ only-x86_64
//
// asm parts of exhaustive.rs. Separate because we only run this on x86_64.

mod expressions {
/// ExprKind::InlineAsm
fn expr_inline_asm() {
let x;
asm!("mov {1}, {0}\nshl {1}, 1\nshl {0}, 2\nadd {0}, {1}",
inout(reg)
x,
out(reg)
_);
}
}

mod items {
/// ItemKind::GlobalAsm
mod item_global_asm {
global_asm! (".globl my_asm_func");
}
}
31 changes: 31 additions & 0 deletions tests/ui/unpretty/exhaustive-asm.hir.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#[prelude_import]
use std::prelude::rust_2024::*;
#[macro_use]
extern crate std;
//@ revisions: expanded hir
//@[expanded]compile-flags: -Zunpretty=expanded
//@[expanded]check-pass
//@[hir]compile-flags: -Zunpretty=hir
//@[hir]check-pass
//@ edition:2024
//@ only-x86_64
//
// asm parts of exhaustive.rs. Separate because we only run this on x86_64.

mod expressions {
/// ExprKind::InlineAsm
fn expr_inline_asm() {
let x;
asm!("mov {1}, {0}\nshl {1}, 1\nshl {0}, 2\nadd {0}, {1}",
inout(reg)
x,
out(reg)
_);
}
}

mod items {
/// ItemKind::GlobalAsm
mod item_global_asm {/// ItemKind::GlobalAsm
global_asm! (".globl my_asm_func") }
}
31 changes: 31 additions & 0 deletions tests/ui/unpretty/exhaustive-asm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//@ revisions: expanded hir
//@[expanded]compile-flags: -Zunpretty=expanded
//@[expanded]check-pass
//@[hir]compile-flags: -Zunpretty=hir
//@[hir]check-pass
//@ edition:2024
//@ only-x86_64
//
// asm parts of exhaustive.rs. Separate because we only run this on x86_64.

mod expressions {
/// ExprKind::InlineAsm
fn expr_inline_asm() {
let x;
core::arch::asm!(
"mov {tmp}, {x}",
"shl {tmp}, 1",
"shl {x}, 2",
"add {x}, {tmp}",
x = inout(reg) x,
tmp = out(reg) _,
);
}
}

mod items {
/// ItemKind::GlobalAsm
mod item_global_asm {
core::arch::global_asm!(".globl my_asm_func");
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#![feature(prelude_import)]
//@ compile-flags: -Zunpretty=expanded
//@ revisions: expanded hir
//@[expanded]compile-flags: -Zunpretty=expanded
//@[expanded]check-pass
//@[hir]compile-flags: -Zunpretty=hir
//@[hir]check-fail
//@ edition:2024
//@ check-pass

// Note: the HIR revision includes a `.stderr` file because there are some
// errors that only occur once we get past the AST.

#![feature(auto_traits)]
#![feature(box_patterns)]
Expand Down Expand Up @@ -211,7 +217,10 @@ mod expressions {
}

/// ExprKind::Await
fn expr_await() { let fut; fut.await; }
fn expr_await() {
let fut;
fut.await;
}

/// ExprKind::TryBlock
fn expr_try_block() { try {} try { return; } }
Expand Down Expand Up @@ -242,7 +251,9 @@ mod expressions {
}

/// ExprKind::Underscore
fn expr_underscore() { _; }
fn expr_underscore() {
_;
}

/// ExprKind::Path
fn expr_path() {
Expand Down Expand Up @@ -275,16 +286,8 @@ mod expressions {
/// ExprKind::Ret
fn expr_ret() { return; return true; }

/// ExprKind::InlineAsm
fn expr_inline_asm() {
let x;
asm!("mov {1}, {0}\nshl {1}, 1\nshl {0}, 2\nadd {0}, {1}",
inout(reg)
x,
out(reg)
_);
}

/// ExprKind::InlineAsm: see exhaustive-asm.rs
/// ExprKind::OffsetOf
fn expr_offset_of() {

Expand All @@ -300,65 +303,12 @@ mod expressions {









// ...




















































// concat_idents is deprecated


Expand Down Expand Up @@ -450,10 +400,7 @@ mod items {
unsafe extern "C++" {}
unsafe extern "C" {}
}
/// ItemKind::GlobalAsm
mod item_global_asm {
global_asm! (".globl my_asm_func");
}
/// ItemKind::GlobalAsm: see exhaustive-asm.rs
/// ItemKind::TyAlias
mod item_ty_alias {
pub type Type<'a> where T: 'a = T;
Expand Down
Loading
Loading