-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #137423 - Urgau:imprv-pretty-hir, r=compiler-errors
Improve a bit HIR pretty printer This PR improve (a bit) the HIR pretty printer. It does so by: - Not printing elided lifetimes (those are not expressible in surface Rust anyway) - And by rendering implicit self with the shorthand syntax I also tried fixing some indentation and other things but gave up for now. Best reviewed commit by commit.
- Loading branch information
Showing
6 changed files
with
152 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//@ compile-flags: -Zunpretty=hir | ||
//@ check-pass | ||
|
||
use std::fmt; | ||
|
||
pub struct Bar { | ||
a: String, | ||
b: u8, | ||
} | ||
|
||
impl fmt::Debug for Bar { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
debug_struct_field2_finish(f, "Bar", "a", &self.a, "b", &&self.b) | ||
} | ||
} | ||
|
||
fn debug_struct_field2_finish<'a>( | ||
name: &str, | ||
name1: &str, | ||
value1: &'a dyn fmt::Debug, | ||
name2: &str, | ||
value2: &'a dyn fmt::Debug, | ||
) -> fmt::Result | ||
{ | ||
loop {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#[prelude_import] | ||
use ::std::prelude::rust_2015::*; | ||
#[macro_use] | ||
extern crate std; | ||
//@ compile-flags: -Zunpretty=hir | ||
//@ check-pass | ||
|
||
use std::fmt; | ||
|
||
struct Bar { | ||
a: String, | ||
b: u8, | ||
} | ||
|
||
impl fmt::Debug for Bar { | ||
fn fmt(&self, f: &'_ mut fmt::Formatter<'_>) | ||
-> | ||
fmt::Result { | ||
debug_struct_field2_finish(f, "Bar", "a", &self.a, "b", &&self.b) | ||
} | ||
} | ||
|
||
fn debug_struct_field2_finish<'a>(name: &'_ str, name1: &'_ str, | ||
value1: &'a dyn fmt::Debug, name2: &'_ str, value2: &'a dyn fmt::Debug) | ||
-> fmt::Result { loop { } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//@ compile-flags: -Zunpretty=hir | ||
//@ check-pass | ||
|
||
pub struct Bar { | ||
a: String, | ||
b: u8, | ||
} | ||
|
||
impl Bar { | ||
fn imm_self(self) {} | ||
fn mut_self(mut self) {} | ||
fn refimm_self(&self) {} | ||
fn refmut_self(&mut self) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#[prelude_import] | ||
use ::std::prelude::rust_2015::*; | ||
#[macro_use] | ||
extern crate std; | ||
//@ compile-flags: -Zunpretty=hir | ||
//@ check-pass | ||
|
||
struct Bar { | ||
a: String, | ||
b: u8, | ||
} | ||
|
||
impl Bar { | ||
fn imm_self(self) { } | ||
fn mut_self(mut self) { } | ||
fn refimm_self(&self) { } | ||
fn refmut_self(&mut self) { } | ||
} |