Skip to content

Commit 298253a

Browse files
committed
Specialize ToString for Symbol
1 parent 0da281b commit 298253a

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)