Skip to content

Commit 3f8528f

Browse files
committed
Merge pull request 1358 from dtolnay/macroexport
2 parents a207d14 + 5db1339 commit 3f8528f

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

src/custom_keyword.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,29 +131,29 @@ macro_rules! impl_parse_for_custom_keyword {
131131
impl $crate::token::CustomToken for $ident {
132132
fn peek(cursor: $crate::buffer::Cursor) -> $crate::__private::bool {
133133
if let $crate::__private::Some((ident, _rest)) = cursor.ident() {
134-
ident == stringify!($ident)
134+
ident == $crate::__private::stringify!($ident)
135135
} else {
136136
false
137137
}
138138
}
139139

140140
fn display() -> &'static $crate::__private::str {
141-
concat!("`", stringify!($ident), "`")
141+
$crate::__private::concat!("`", $crate::__private::stringify!($ident), "`")
142142
}
143143
}
144144

145145
impl $crate::parse::Parse for $ident {
146146
fn parse(input: $crate::parse::ParseStream) -> $crate::parse::Result<$ident> {
147147
input.step(|cursor| {
148148
if let $crate::__private::Some((ident, rest)) = cursor.ident() {
149-
if ident == stringify!($ident) {
149+
if ident == $crate::__private::stringify!($ident) {
150150
return $crate::__private::Ok(($ident { span: ident.span() }, rest));
151151
}
152152
}
153-
$crate::__private::Err(cursor.error(concat!(
153+
$crate::__private::Err(cursor.error($crate::__private::concat!(
154154
"expected `",
155-
stringify!($ident),
156-
"`"
155+
$crate::__private::stringify!($ident),
156+
"`",
157157
)))
158158
})
159159
}
@@ -177,7 +177,7 @@ macro_rules! impl_to_tokens_for_custom_keyword {
177177
($ident:ident) => {
178178
impl $crate::__private::ToTokens for $ident {
179179
fn to_tokens(&self, tokens: &mut $crate::__private::TokenStream2) {
180-
let ident = $crate::Ident::new(stringify!($ident), self.span);
180+
let ident = $crate::Ident::new($crate::__private::stringify!($ident), self.span);
181181
$crate::__private::TokenStreamExt::append(tokens, ident);
182182
}
183183
}
@@ -227,7 +227,11 @@ macro_rules! impl_extra_traits_for_custom_keyword {
227227
fn fmt(&self, f: &mut $crate::__private::Formatter) -> $crate::__private::fmt::Result {
228228
$crate::__private::Formatter::write_str(
229229
f,
230-
concat!("Keyword [", stringify!($ident), "]"),
230+
$crate::__private::concat!(
231+
"Keyword [",
232+
$crate::__private::stringify!($ident),
233+
"]",
234+
),
231235
)
232236
}
233237
}

src/custom_punctuation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ macro_rules! impl_parse_for_custom_punctuation {
119119
}
120120

121121
fn display() -> &'static $crate::__private::str {
122-
concat!("`", $crate::stringify_punct!($($tt)+), "`")
122+
$crate::__private::concat!("`", $crate::stringify_punct!($($tt)+), "`")
123123
}
124124
}
125125

@@ -196,7 +196,7 @@ macro_rules! impl_extra_traits_for_custom_punctuation {
196196
($ident:ident, $($tt:tt)+) => {
197197
impl $crate::__private::Debug for $ident {
198198
fn fmt(&self, f: &mut $crate::__private::Formatter) -> $crate::__private::fmt::Result {
199-
$crate::__private::Formatter::write_str(f, stringify!($ident))
199+
$crate::__private::Formatter::write_str(f, $crate::__private::stringify!($ident))
200200
}
201201
}
202202

@@ -297,6 +297,6 @@ macro_rules! custom_punctuation_unexpected {
297297
#[macro_export]
298298
macro_rules! stringify_punct {
299299
($($tt:tt)+) => {
300-
concat!($(stringify!($tt)),+)
300+
$crate::__private::concat!($($crate::__private::stringify!($tt)),+)
301301
};
302302
}

src/export.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
pub use std::clone::Clone;
22
pub use std::cmp::{Eq, PartialEq};
3+
pub use std::concat;
34
pub use std::default::Default;
45
pub use std::fmt::{self, Debug, Formatter};
56
pub use std::hash::{Hash, Hasher};
67
pub use std::marker::Copy;
78
pub use std::option::Option::{None, Some};
89
pub use std::result::Result::{Err, Ok};
10+
pub use std::stringify;
911

1012
#[cfg(feature = "printing")]
1113
pub use quote;

0 commit comments

Comments
 (0)