diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-05 19:03:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-05 19:03:15 +0100 |
| commit | 8e6cf861e5e1b558b6a03dd0eaabc15b37570063 (patch) | |
| tree | e445f9e8705333bba11b133a94b1c077c89536db /src/libsyntax_pos | |
| parent | 9a72b42a6d8a2d587a9db4f0073829de118e9997 (diff) | |
| parent | 0103308ad3745109600541e139af5571838b8791 (diff) | |
| download | rust-8e6cf861e5e1b558b6a03dd0eaabc15b37570063.tar.gz rust-8e6cf861e5e1b558b6a03dd0eaabc15b37570063.zip | |
Rollup merge of #67010 - estebank:raw-idents, r=Centril
Accurately portray raw identifiers in error messages When refering to or suggesting raw identifiers, refer to them with `r#`. Fix #65634.
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/symbol.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 2af66711d3c..c68e03be88c 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -869,12 +869,18 @@ impl Hash for Ident { impl fmt::Debug for Ident { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + if self.is_raw_guess() { + write!(f, "r#")?; + } write!(f, "{}{:?}", self.name, self.span.ctxt()) } } impl fmt::Display for Ident { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + if self.is_raw_guess() { + write!(f, "r#")?; + } fmt::Display::fmt(&self.name, f) } } |
