Skip to content

Commit 56a8502

Browse files
committed
Pre-commit unpretty HIR test
1 parent 4229b80 commit 56a8502

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

tests/ui/unpretty/debug-fmt-hir.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//@ compile-flags: -Zunpretty=hir
2+
//@ check-pass
3+
4+
use std::fmt;
5+
6+
pub struct Bar {
7+
a: String,
8+
b: u8,
9+
}
10+
11+
impl fmt::Debug for Bar {
12+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13+
debug_struct_field2_finish(f, "Bar", "a", &self.a, "b", &&self.b)
14+
}
15+
}
16+
17+
fn debug_struct_field2_finish<'a>(
18+
name: &str,
19+
name1: &str,
20+
value1: &'a dyn fmt::Debug,
21+
name2: &str,
22+
value2: &'a dyn fmt::Debug,
23+
) -> fmt::Result
24+
{
25+
loop {}
26+
}
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#[prelude_import]
2+
use ::std::prelude::rust_2015::*;
3+
#[macro_use]
4+
extern crate std;
5+
//@ compile-flags: -Zunpretty=hir
6+
//@ check-pass
7+
8+
use std::fmt;
9+
10+
struct Bar {
11+
a: String,
12+
b: u8,
13+
}
14+
15+
impl fmt::Debug for Bar {
16+
fn fmt<'_, '_, '_>(self: &'_ Self, f: &'_ mut fmt::Formatter<'_>)
17+
->
18+
fmt::Result {
19+
debug_struct_field2_finish(f, "Bar", "a", &self.a, "b", &&self.b)
20+
}
21+
}
22+
23+
fn debug_struct_field2_finish<'a, '_, '_,
24+
'_>(name: &'_ str, name1: &'_ str, value1: &'a dyn fmt::Debug,
25+
name2: &'_ str, value2: &'a dyn fmt::Debug) -> fmt::Result { loop { } }

0 commit comments

Comments
 (0)