Skip to content

Commit f41b1bf

Browse files
authored
Rollup merge of #103656 - camsteffen:symbol-to-string, r=compiler-errors
Specialize ToString for Symbol
2 parents 790a716 + 298253a commit f41b1bf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/rustc_span/src/symbol.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1901,6 +1901,13 @@ impl fmt::Display for Symbol {
19011901
}
19021902
}
19031903

1904+
// takes advantage of `str::to_string` specialization
1905+
impl ToString for Symbol {
1906+
fn to_string(&self) -> String {
1907+
self.as_str().to_string()
1908+
}
1909+
}
1910+
19041911
impl<S: Encoder> Encodable<S> for Symbol {
19051912
default fn encode(&self, s: &mut S) {
19061913
s.emit_str(self.as_str());

0 commit comments

Comments
 (0)