@@ -191,6 +191,14 @@ impl ToString for TokenStream {
191191/// Prints the token stream as a string that is supposed to be losslessly convertible back 
192192/// into the same token stream (modulo spans), except for possibly `TokenTree::Group`s 
193193/// with `Delimiter::None` delimiters and negative numeric literals. 
194+ /// 
195+ /// Note: the exact form of the output is subject to change, e.g. there might 
196+ /// be changes in the whitespace used between tokens. Therefore, you should 
197+ /// *not* do any kind of simple substring matching on the output string (as 
198+ /// produced by `to_string`) to implement a proc macro, because that matching 
199+ /// might stop working if such changes happen. Instead, you should work at the 
200+ /// `TokenTree` level, e.g. matching against `TokenTree::Ident`, 
201+ /// `TokenTree::Punct`, or `TokenTree::Literal`. 
194202#[ stable( feature = "proc_macro_lib" ,  since = "1.15.0" ) ]  
195203impl  fmt:: Display  for  TokenStream  { 
196204    fn  fmt ( & self ,  f :  & mut  fmt:: Formatter < ' _ > )  -> fmt:: Result  { 
@@ -758,6 +766,14 @@ impl ToString for TokenTree {
758766/// Prints the token tree as a string that is supposed to be losslessly convertible back 
759767/// into the same token tree (modulo spans), except for possibly `TokenTree::Group`s 
760768/// with `Delimiter::None` delimiters and negative numeric literals. 
769+ /// 
770+ /// Note: the exact form of the output is subject to change, e.g. there might 
771+ /// be changes in the whitespace used between tokens. Therefore, you should 
772+ /// *not* do any kind of simple substring matching on the output string (as 
773+ /// produced by `to_string`) to implement a proc macro, because that matching 
774+ /// might stop working if such changes happen. Instead, you should work at the 
775+ /// `TokenTree` level, e.g. matching against `TokenTree::Ident`, 
776+ /// `TokenTree::Punct`, or `TokenTree::Literal`. 
761777#[ stable( feature = "proc_macro_lib2" ,  since = "1.29.0" ) ]  
762778impl  fmt:: Display  for  TokenTree  { 
763779    fn  fmt ( & self ,  f :  & mut  fmt:: Formatter < ' _ > )  -> fmt:: Result  { 
0 commit comments