1
Fork 0

Hide ToString implementations that specialize the default ones

The status quo is highly confusing, since the overlap is not apparent,
and specialization is not a feature of Rust. This addresses #87545;
I'm not certain if it closes it, since that issue might also be trackign
a *general* solution for hiding specializing impls automatically.
This commit is contained in:
Frank Steffahn 2023-07-24 23:37:35 +09:00
parent f475098ffd
commit 3911a63b77
2 changed files with 15 additions and 2 deletions

View file

@ -177,6 +177,7 @@ impl FromStr for TokenStream {
// N.B., the bridge only provides `to_string`, implement `fmt::Display`
// based on it (the reverse of the usual relationship between the two).
#[doc(hidden)]
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
impl ToString for TokenStream {
fn to_string(&self) -> String {
@ -738,6 +739,7 @@ impl From<Literal> for TokenTree {
// N.B., the bridge only provides `to_string`, implement `fmt::Display`
// based on it (the reverse of the usual relationship between the two).
#[doc(hidden)]
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
impl ToString for TokenTree {
fn to_string(&self) -> String {
@ -872,6 +874,7 @@ impl Group {
// N.B., the bridge only provides `to_string`, implement `fmt::Display`
// based on it (the reverse of the usual relationship between the two).
#[doc(hidden)]
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
impl ToString for Group {
fn to_string(&self) -> String {
@ -981,6 +984,7 @@ impl Punct {
}
}
#[doc(hidden)]
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
impl ToString for Punct {
fn to_string(&self) -> String {
@ -1083,8 +1087,7 @@ impl Ident {
}
}
/// Converts the identifier to a string that should be losslessly convertible
/// back into the same identifier.
#[doc(hidden)]
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
impl ToString for Ident {
fn to_string(&self) -> String {
@ -1423,6 +1426,7 @@ impl FromStr for Literal {
}
}
#[doc(hidden)]
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
impl ToString for Literal {
fn to_string(&self) -> String {