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.
This commit is contained in:
Nicholas Nethercote 2025-04-10 11:49:50 +10:00
parent 51548ce71f
commit 3cb9966235
2 changed files with 45 additions and 0 deletions

View File

@ -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<C>(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); }; }

View File

@ -0,0 +1,22 @@
//@ pretty-compare-only
//@ pretty-mode:hir
//@ pp-exact:hir-delegation.pp
#![allow(incomplete_features)]
#![feature(fn_delegation)]
fn b<C>(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);
}