1
Fork 0

Rollup merge of #96433 - petrochenkov:delim, r=nnethercote

rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`

Compiler cannot reuse `proc_macro::Delimiter` directly due to extra impls, but can at least use the same naming.

After this PR the only difference between these two enums is that `proc_macro::Delimiter::None` is turned into `token::Delimiter::Invisible`.
It's my mistake that the invisible delimiter is called `None` on stable, during the stabilization I audited the naming and wrote the docs, but missed the fact that the `None` naming gives a wrong and confusing impression about what this thing is.

cc https://github.com/rust-lang/rust/pull/96421
r? ``@nnethercote``
This commit is contained in:
Dylan DPC 2022-04-28 20:13:02 +02:00 committed by GitHub
commit 0cbf3b2b30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 433 additions and 426 deletions

View file

@ -1,6 +1,6 @@
use crate::parse::ParseSess;
use crate::session::Session;
use rustc_ast::token::{self, DelimToken, Nonterminal, Token};
use rustc_ast::token::{self, Delimiter, Nonterminal, Token};
use rustc_ast::tokenstream::CanSynthesizeMissingTokens;
use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree};
use rustc_data_structures::profiling::VerboseTimingGuard;
@ -137,7 +137,7 @@ impl<'a> FlattenNonterminals<'a> {
let tts = (self.nt_to_tokenstream)(&nt, self.parse_sess, self.synthesize_tokens);
TokenTree::Delimited(
DelimSpan::from_single(token.span),
DelimToken::NoDelim,
Delimiter::Invisible,
self.process_token_stream(tts),
)
.into()