about summary refs log tree commit diff
path: root/tests/pretty
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-04-10 11:49:50 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-04-10 14:09:37 +1000
commit3cb9966235a981cfea1bbf2536ebd5021bcbca5e (patch)
tree84fc9d04b6c81f79442a01ffad9b5b448da9f0e9 /tests/pretty
parent51548ce71fe80b5ca7aef00e6f1bf2491df98c79 (diff)
downloadrust-3cb9966235a981cfea1bbf2536ebd5021bcbca5e.tar.gz
rust-3cb9966235a981cfea1bbf2536ebd5021bcbca5e.zip
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.
Diffstat (limited to 'tests/pretty')
-rw-r--r--tests/pretty/hir-delegation.pp23
-rw-r--r--tests/pretty/hir-delegation.rs22
2 files changed, 45 insertions, 0 deletions
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<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); }; }
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<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);
+}