Rollup merge of #125158 - Nilstrieb:block-indent, r=compiler-errors
hir pretty: fix block indent before: ```rust fn main() { { { ::std::io::_print(format_arguments::new_const(&["Hello, world!\n"])); }; } } ``` after: ```rust fn main() { { { ::std::io::_print(format_arguments::new_const(&["Hello, world!\n"])); }; } } ``` AST pretty does the same.
This commit is contained in:
commit
4b26045b92
9 changed files with 53 additions and 53 deletions
|
@ -1454,7 +1454,7 @@ impl<'a> State<'a> {
|
||||||
self.word_space(":");
|
self.word_space(":");
|
||||||
}
|
}
|
||||||
// containing cbox, will be closed by print-block at `}`
|
// containing cbox, will be closed by print-block at `}`
|
||||||
self.cbox(INDENT_UNIT);
|
self.cbox(0);
|
||||||
// head-box, will be closed by print-block after `{`
|
// head-box, will be closed by print-block after `{`
|
||||||
self.ibox(0);
|
self.ibox(0);
|
||||||
self.print_block(blk);
|
self.print_block(blk);
|
||||||
|
|
|
@ -17,9 +17,9 @@ fn bar() ({
|
||||||
let _: [(); (1 as usize)] = ([(() as ())] as [(); 1]);
|
let _: [(); (1 as usize)] = ([(() as ())] as [(); 1]);
|
||||||
|
|
||||||
let _ =
|
let _ =
|
||||||
(((&([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3]) as
|
(((&([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3]) as &[i32; 3])
|
||||||
&[i32; 3]) as *const _ as *const [i32; 3]) as
|
as *const _ as *const [i32; 3]) as *const [i32; (3 as usize)]
|
||||||
*const [i32; (3 as usize)] as *const [i32; 3]);
|
as *const [i32; 3]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ fn bar() ({
|
||||||
as String);
|
as String);
|
||||||
(res as String)
|
(res as String)
|
||||||
} as String);
|
} as String);
|
||||||
} as ())
|
} as ())
|
||||||
type Foo = [i32; (3 as usize)];
|
type Foo = [i32; (3 as usize)];
|
||||||
struct Bar {
|
struct Bar {
|
||||||
x: [i32; (3 as usize)],
|
x: [i32; (3 as usize)],
|
||||||
|
@ -52,5 +52,5 @@ fn use_id() ({
|
||||||
((id::<[i32; (3 as usize)]> as
|
((id::<[i32; (3 as usize)]> as
|
||||||
fn([i32; 3]) -> [i32; 3] {id::<[i32; 3]>})(([(1 as i32),
|
fn([i32; 3]) -> [i32; 3] {id::<[i32; 3]>})(([(1 as i32),
|
||||||
(2 as i32), (3 as i32)] as [i32; 3])) as [i32; 3]);
|
(2 as i32), (3 as i32)] as [i32; 3])) as [i32; 3]);
|
||||||
} as ())
|
} as ())
|
||||||
fn main() ({ } as ())
|
fn main() ({ } as ())
|
||||||
|
|
|
@ -11,4 +11,4 @@ trait Animal { }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
type ServeFut = /*impl Trait*/;
|
type ServeFut = /*impl Trait*/;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,4 +8,4 @@ extern crate std;
|
||||||
// In #100948 this caused an ICE with -Zunpretty=hir.
|
// In #100948 this caused an ICE with -Zunpretty=hir.
|
||||||
fn main() {
|
fn main() {
|
||||||
<bad-literal>;
|
<bad-literal>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,4 @@ fn main() {
|
||||||
let _ =
|
let _ =
|
||||||
#[rustc_box]
|
#[rustc_box]
|
||||||
Box::new(1);
|
Box::new(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ fn main() {
|
||||||
let x = 1;
|
let x = 1;
|
||||||
// Should flatten to println!("a 123 b {x} xyz\n"):
|
// Should flatten to println!("a 123 b {x} xyz\n"):
|
||||||
{
|
{
|
||||||
::std::io::_print(format_arguments::new_v1(&["a 123 b ",
|
::std::io::_print(format_arguments::new_v1(&["a 123 b ", " xyz\n"],
|
||||||
" xyz\n"], &[format_argument::new_display(&x)]));
|
&[format_argument::new_display(&x)]));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,5 +14,5 @@ fn foo(x:
|
||||||
|
|
||||||
{ ::std::rt::begin_panic("explicit panic") }
|
{ ::std::rt::begin_panic("explicit panic") }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue