mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2024-11-23 07:50:04 +00:00
Fix printing of variadic extern fn with trailing comma
This commit is contained in:
parent
42e9942cc6
commit
9b589ba216
14
src/item.rs
14
src/item.rs
@ -2765,7 +2765,6 @@ mod printing {
|
||||
use super::*;
|
||||
use crate::attr::FilterAttrs;
|
||||
use crate::print::TokensOrDefault;
|
||||
use crate::punctuated::Pair;
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::{ToTokens, TokenStreamExt};
|
||||
|
||||
@ -3283,16 +3282,9 @@ mod printing {
|
||||
self.generics.to_tokens(tokens);
|
||||
self.paren_token.surround(tokens, |tokens| {
|
||||
let mut last_is_variadic = false;
|
||||
for input in self.inputs.pairs() {
|
||||
match input {
|
||||
Pair::Punctuated(input, comma) => {
|
||||
maybe_variadic_to_tokens(input, tokens);
|
||||
comma.to_tokens(tokens);
|
||||
}
|
||||
Pair::End(input) => {
|
||||
last_is_variadic = maybe_variadic_to_tokens(input, tokens);
|
||||
}
|
||||
}
|
||||
for pair in self.inputs.pairs() {
|
||||
last_is_variadic = maybe_variadic_to_tokens(pair.value(), tokens);
|
||||
pair.punct().to_tokens(tokens);
|
||||
}
|
||||
if self.variadic.is_some() && !last_is_variadic {
|
||||
if !self.inputs.empty_or_trailing() {
|
||||
|
@ -14,9 +14,6 @@ const REVISION: &str = "98ad6a5519651af36e246c0335c964dd52c554ba";
|
||||
|
||||
#[rustfmt::skip]
|
||||
static EXCLUDE_FILES: &[&str] = &[
|
||||
// TODO: trailing comma after variadic in extern fn signature
|
||||
"src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0063_variadic_fun.rs",
|
||||
|
||||
// TODO: impl ~const T {}
|
||||
// https://github.com/dtolnay/syn/issues/1051
|
||||
"src/test/ui/rfc-2632-const-trait-impl/syntax.rs",
|
||||
|
Loading…
Reference in New Issue
Block a user