From 3cb9966235a981cfea1bbf2536ebd5021bcbca5e Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 10 Apr 2025 11:49:50 +1000 Subject: [PATCH] Add a HIR pretty printing test for delegation. Note that some of the output is currently bogus, with missing params and args: ``` fn add(: _, : _) -> _ { m::add(, ) } ``` The next commit will fix this. --- tests/pretty/hir-delegation.pp | 23 +++++++++++++++++++++++ tests/pretty/hir-delegation.rs | 22 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 tests/pretty/hir-delegation.pp create mode 100644 tests/pretty/hir-delegation.rs diff --git a/tests/pretty/hir-delegation.pp b/tests/pretty/hir-delegation.pp new file mode 100644 index 00000000000..1dc83ed635c --- /dev/null +++ b/tests/pretty/hir-delegation.pp @@ -0,0 +1,23 @@ +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:hir-delegation.pp + +#![allow(incomplete_features)]#![feature(fn_delegation)] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; + +fn b(e: C) { } + +trait G { + fn b(: _) -> _ { b({ }) } +} + +mod m { + fn add(a: u32, b: u32) -> u32 { a + b } +} + +fn add(: _, : _) -> _ { m::add(, ) } + +fn main() { { let _ = add(1, 2); }; } diff --git a/tests/pretty/hir-delegation.rs b/tests/pretty/hir-delegation.rs new file mode 100644 index 00000000000..9e351a1e32f --- /dev/null +++ b/tests/pretty/hir-delegation.rs @@ -0,0 +1,22 @@ +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:hir-delegation.pp + +#![allow(incomplete_features)] +#![feature(fn_delegation)] + +fn b(e: C) {} + +trait G { + reuse b {} +} + +mod m { + pub fn add(a: u32, b: u32) -> u32 { a + b } +} + +reuse m::add; + +fn main() { + _ = add(1, 2); +}