pretty-print: Do not lose the $crate
printing flag in print_tt
This commit is contained in:
parent
69070058cd
commit
da50d59881
@ -689,7 +689,7 @@ pub trait PrintState<'a>: std::ops::Deref<Target=pp::Printer> + std::ops::DerefM
|
||||
TokenTree::Delimited(_, delim, tts) => {
|
||||
self.word(token_kind_to_string(&token::OpenDelim(delim)));
|
||||
self.space();
|
||||
self.print_tts(tts);
|
||||
self.print_tts(tts, convert_dollar_crate);
|
||||
self.space();
|
||||
self.word(token_kind_to_string(&token::CloseDelim(delim)))
|
||||
},
|
||||
|
10
src/test/ui/macros/auxiliary/dollar-crate-nested-encoding.rs
Normal file
10
src/test/ui/macros/auxiliary/dollar-crate-nested-encoding.rs
Normal file
@ -0,0 +1,10 @@
|
||||
pub type S = u8;
|
||||
|
||||
macro_rules! generate_exported { () => {
|
||||
#[macro_export]
|
||||
macro_rules! exported {
|
||||
() => ($crate::S)
|
||||
}
|
||||
}}
|
||||
|
||||
generate_exported!();
|
8
src/test/ui/macros/dollar-crate-nested-encoding.rs
Normal file
8
src/test/ui/macros/dollar-crate-nested-encoding.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// check-pass
|
||||
// aux-build:dollar-crate-nested-encoding.rs
|
||||
|
||||
extern crate dollar_crate_nested_encoding;
|
||||
|
||||
type A = dollar_crate_nested_encoding::exported!();
|
||||
|
||||
fn main() {}
|
@ -1,4 +1,4 @@
|
||||
PRINT-BANG INPUT (DISPLAY): struct M ( crate :: S ) ;
|
||||
PRINT-BANG INPUT (DISPLAY): struct M ( $crate :: S ) ;
|
||||
PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
@ -39,7 +39,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): struct A(crate::S);
|
||||
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( crate :: S ) ;
|
||||
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( $crate :: S ) ;
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
|
@ -1,5 +1,5 @@
|
||||
PRINT-ATTR INPUT (DISPLAY): struct A(identity!(crate :: S));
|
||||
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( identity ! ( crate :: S ) ) ;
|
||||
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( identity ! ( $crate :: S ) ) ;
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
@ -55,7 +55,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): struct B(identity!(::dollar_crate_external :: S));
|
||||
PRINT-ATTR RE-COLLECTED (DISPLAY): struct B ( identity ! ( ::dollar_crate_external :: S ) ) ;
|
||||
PRINT-ATTR RE-COLLECTED (DISPLAY): struct B ( identity ! ( $crate :: S ) ) ;
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
|
@ -1,4 +1,4 @@
|
||||
PRINT-BANG INPUT (DISPLAY): struct M ( crate :: S ) ;
|
||||
PRINT-BANG INPUT (DISPLAY): struct M ( $crate :: S ) ;
|
||||
PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
@ -39,7 +39,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): struct A(crate::S);
|
||||
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( crate :: S ) ;
|
||||
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( $crate :: S ) ;
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
@ -80,7 +80,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
},
|
||||
]
|
||||
PRINT-DERIVE INPUT (DISPLAY): struct D(crate::S);
|
||||
PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ( crate :: S ) ;
|
||||
PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ( $crate :: S ) ;
|
||||
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
@ -120,7 +120,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||
span: #2 bytes(LO..HI),
|
||||
},
|
||||
]
|
||||
PRINT-BANG INPUT (DISPLAY): struct M ( ::dollar_crate_external :: S ) ;
|
||||
PRINT-BANG INPUT (DISPLAY): struct M ( $crate :: S ) ;
|
||||
PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
@ -161,7 +161,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): struct A(::dollar_crate_external::S);
|
||||
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( ::dollar_crate_external :: S ) ;
|
||||
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( $crate :: S ) ;
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
@ -202,7 +202,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
},
|
||||
]
|
||||
PRINT-DERIVE INPUT (DISPLAY): struct D(::dollar_crate_external::S);
|
||||
PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ( ::dollar_crate_external :: S ) ;
|
||||
PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ( $crate :: S ) ;
|
||||
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
|
Loading…
x
Reference in New Issue
Block a user