Rollup merge of #51073 - dtolnay:empty, r=alexcrichton
Rename TokenStream::empty to TokenStream::new There is no precedent for the `empty` name -- we do not have `Vec::empty` or `HashMap::empty` etc. I would propose landing this but reflecting it in a non-breaking release of proc-macro2 that provides both `new` and a deprecated `empty` constructor. Tracking issue: #38356 r? @alexcrichton
This commit is contained in:
commit
84b2e14b9d
5 changed files with 7 additions and 7 deletions
|
|
@ -26,7 +26,7 @@ pub fn assert1(_a: TokenStream, b: TokenStream) -> TokenStream {
|
|||
#[proc_macro_derive(Foo, attributes(foo))]
|
||||
pub fn assert2(a: TokenStream) -> TokenStream {
|
||||
assert_eq(a, "pub struct MyStructc { _a: i32, }".parse().unwrap());
|
||||
TokenStream::empty()
|
||||
TokenStream::new()
|
||||
}
|
||||
|
||||
fn assert_eq(a: TokenStream, b: TokenStream) {
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ use proc_macro::*;
|
|||
#[proc_macro]
|
||||
pub fn tokens(input: TokenStream) -> TokenStream {
|
||||
assert_nothing_joint(input);
|
||||
TokenStream::empty()
|
||||
TokenStream::new()
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn nothing(_: TokenStream, input: TokenStream) -> TokenStream {
|
||||
assert_nothing_joint(input);
|
||||
TokenStream::empty()
|
||||
TokenStream::new()
|
||||
}
|
||||
|
||||
fn assert_nothing_joint(s: TokenStream) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ fn parse(input: TokenStream) -> Result<(), Diagnostic> {
|
|||
pub fn three_equals(input: TokenStream) -> TokenStream {
|
||||
if let Err(diag) = parse(input) {
|
||||
diag.emit();
|
||||
return TokenStream::empty();
|
||||
return TokenStream::new();
|
||||
}
|
||||
|
||||
"3".parse().unwrap()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue