We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Symbol::to_ident_string
1 parent 892cb14 commit 6ce5ab6Copy full SHA for 6ce5ab6
src/librustc_span/symbol.rs
@@ -1023,6 +1023,14 @@ impl Symbol {
1023
pub fn as_u32(self) -> u32 {
1024
self.0.as_u32()
1025
}
1026
+
1027
+ /// This method is supposed to be used in error messages, so it's expected to be
1028
+ /// identical to printing the original identifier token written in source code
1029
+ /// (`token_to_string`, `Ident::to_string`), except that symbols don't keep the rawness flag
1030
+ /// or edition, so we have to guess the rawness using the global edition.
1031
+ pub fn to_ident_string(self) -> String {
1032
+ Ident::with_dummy_span(self).to_string()
1033
+ }
1034
1035
1036
impl fmt::Debug for Symbol {
0 commit comments