Skip to content

Commit 8e9106c

Browse files
committed
tests: fix fallout in pretty-printing output exact-match tests.
1 parent 9ce1044 commit 8e9106c

File tree

2 files changed

+80
-66
lines changed

2 files changed

+80
-66
lines changed

src/test/pretty/issue-4264.pp

+66-58
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818

1919
// #4264 fixed-length vector types
2020

21-
pub fn foo(_: [i32; (3 as usize)]) { }
21+
pub fn foo(_: [i32; (3 as usize)]) ({ } as ())
2222

23-
pub fn bar() {
24-
const FOO: usize = ((5 as usize) - (4 as usize) as usize);
25-
let _: [(); (FOO as usize)] = ([(() as ())] as [(); 1]);
23+
pub fn bar() ({
24+
const FOO: usize = ((5 as usize) - (4 as usize) as usize);
25+
let _: [(); (FOO as usize)] = ([(() as ())] as [(); 1]);
2626

27-
let _: [(); (1 as usize)] = ([(() as ())] as [(); 1]);
27+
let _: [(); (1 as usize)] = ([(() as ())] as [(); 1]);
2828

29-
let _ =
30-
(((&([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3]) as &[i32; 3])
31-
as *const _ as *const [i32; 3]) as *const [i32; (3 as usize)] as
32-
*const [i32; 3]);
29+
let _ =
30+
(((&([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3])
31+
as &[i32; 3]) as *const _ as *const [i32; 3]) as
32+
*const [i32; (3 as usize)] as *const [i32; 3]);
3333

3434

3535

@@ -38,58 +38,66 @@
3838

3939

4040

41-
(($crate::fmt::format as
42-
fn(std::fmt::Arguments<'_>) -> std::string::String {std::fmt::format})(((::std::fmt::Arguments::new_v1
43-
as
44-
fn(&[&str], &[std::fmt::ArgumentV1<'_>]) -> std::fmt::Arguments<'_> {std::fmt::Arguments<'_>::new_v1})(({
45-
static __STATIC_FMTSTR:
46-
&'static [&'static str]
47-
=
48-
(&([("test"
49-
as
50-
&'static str)]
51-
as
52-
[&'static str; 1])
53-
as
54-
&'static [&'static str; 1]);
55-
(__STATIC_FMTSTR
56-
as
57-
&'static [&'static str])
58-
}
59-
as
60-
&[&str]),
61-
(&(match (()
62-
as
63-
())
64-
{
65-
()
66-
=>
67-
([]
68-
as
69-
[std::fmt::ArgumentV1<'_>; 0]),
70-
}
71-
as
72-
[std::fmt::ArgumentV1<'_>; 0])
73-
as
74-
&[std::fmt::ArgumentV1<'_>; 0]))
75-
as
76-
std::fmt::Arguments<'_>))
77-
as std::string::String);
78-
}
41+
42+
(($crate::fmt::format as
43+
fn(std::fmt::Arguments<'_>) -> std::string::String {std::fmt::format})(((::std::fmt::Arguments::new_v1
44+
as
45+
fn(&[&str], &[std::fmt::ArgumentV1<'_>]) -> std::fmt::Arguments<'_> {std::fmt::Arguments<'_>::new_v1})(({
46+
static __STATIC_FMTSTR:
47+
&'static [&'static str]
48+
=
49+
(&([("test"
50+
as
51+
&'static str)]
52+
as
53+
[&'static str; 1])
54+
as
55+
&'static [&'static str; 1]);
56+
(__STATIC_FMTSTR
57+
as
58+
&'static [&'static str])
59+
}
60+
as
61+
&[&str]),
62+
(&(match (()
63+
as
64+
())
65+
{
66+
()
67+
=>
68+
([]
69+
as
70+
[std::fmt::ArgumentV1<'_>; 0]),
71+
}
72+
as
73+
[std::fmt::ArgumentV1<'_>; 0])
74+
as
75+
&[std::fmt::ArgumentV1<'_>; 0]))
76+
as
77+
std::fmt::Arguments<'_>))
78+
as std::string::String);
79+
} as ())
7980
pub type Foo = [i32; (3 as usize)];
8081
pub struct Bar {
8182
pub x: [i32; (3 as usize)],
8283
}
8384
pub struct TupleBar([i32; (4 as usize)]);
8485
pub enum Baz { BazVariant([i32; (5 as usize)]), }
85-
pub fn id<T>(x: T) -> T { (x as T) }
86-
pub fn use_id() {
87-
let _ =
88-
((id::<[i32; (3 as usize)]> as
89-
fn([i32; 3]) -> [i32; 3] {id::<[i32; 3]>})(([(1 as i32),
90-
(2 as i32),
91-
(3 as i32)] as
92-
[i32; 3])) as
93-
[i32; 3]);
94-
}
95-
fn main() { }
86+
pub fn id<T>(x: T) -> T ({ (x as T) } as T)
87+
pub fn use_id() ({
88+
let _ =
89+
((id::<[i32; (3 as usize)]> as
90+
fn([i32; 3]) -> [i32; 3] {id::<[i32; 3]>})(([(1
91+
as
92+
i32),
93+
(2
94+
as
95+
i32),
96+
(3
97+
as
98+
i32)]
99+
as
100+
[i32; 3]))
101+
as [i32; 3]);
102+
} as ())
103+
fn main() ({ } as ())

src/test/pretty/stmt_expr_attributes.rs

+14-8
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,20 @@ fn _11() {
198198
};
199199
let _ = #[attr] || #[attr] ();
200200
let _ = #[attr] move || #[attr] ();
201-
let _ = #[attr] || {
202-
#![attr]
203-
#[attr]
204-
() };
205-
let _ = #[attr] move || {
206-
#![attr]
207-
#[attr]
208-
() };
201+
let _ =
202+
#[attr] ||
203+
{
204+
#![attr]
205+
#[attr]
206+
()
207+
};
208+
let _ =
209+
#[attr] move ||
210+
{
211+
#![attr]
212+
#[attr]
213+
()
214+
};
209215
let _ =
210216
#[attr] {
211217
#![attr]

0 commit comments

Comments
 (0)