Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 878f49f

Browse files
committedSep 7, 2024
Auto merge of #130091 - matthiaskrgr:rollup-kalu1cs, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #126452 (Implement raw lifetimes and labels (`'r#ident`)) - #129555 (stabilize const_float_bits_conv) - #129594 (explain the options bootstrap passes to curl) - #129677 (Don't build by-move body when async closure is tainted) - #129847 (Do not call query to compute coroutine layout for synthetic body of async closure) - #129869 (add a few more crashtests) - #130009 (rustdoc-search: allow trailing `Foo ->` arg search) - #130046 (str: make as_mut_ptr and as_bytes_mut unstably const) - #130047 (Win: Add dbghelp to the list of import libraries) - #130059 (Remove the unused `llvm-skip-rebuild` option from x.py) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 12b26c1 + 4ba483d commit 878f49f

File tree

79 files changed

+886
-350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+886
-350
lines changed
 

‎compiler/rustc_ast/src/mut_visit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ fn visit_lazy_tts<T: MutVisitor>(vis: &mut T, lazy_tts: &mut Option<LazyAttrToke
752752
pub fn visit_token<T: MutVisitor>(vis: &mut T, t: &mut Token) {
753753
let Token { kind, span } = t;
754754
match kind {
755-
token::Ident(name, _ /*raw*/) | token::Lifetime(name) => {
755+
token::Ident(name, _is_raw) | token::Lifetime(name, _is_raw) => {
756756
let mut ident = Ident::new(*name, *span);
757757
vis.visit_ident(&mut ident);
758758
*name = ident.name;
@@ -762,7 +762,7 @@ pub fn visit_token<T: MutVisitor>(vis: &mut T, t: &mut Token) {
762762
token::NtIdent(ident, _is_raw) => {
763763
vis.visit_ident(ident);
764764
}
765-
token::NtLifetime(ident) => {
765+
token::NtLifetime(ident, _is_raw) => {
766766
vis.visit_ident(ident);
767767
}
768768
token::Interpolated(nt) => {

‎compiler/rustc_ast/src/token.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ pub enum TokenKind {
331331
/// Do not forget about `NtLifetime` when you want to match on lifetime identifiers.
332332
/// It's recommended to use `Token::(lifetime,uninterpolate,uninterpolated_span)` to
333333
/// treat regular and interpolated lifetime identifiers in the same way.
334-
Lifetime(Symbol),
334+
Lifetime(Symbol, IdentIsRaw),
335335
/// This identifier (and its span) is the lifetime passed to the
336336
/// declarative macro. The span in the surrounding `Token` is the span of
337337
/// the `lifetime` metavariable in the macro's RHS.
338-
NtLifetime(Ident),
338+
NtLifetime(Ident, IdentIsRaw),
339339

340340
/// An embedded AST node, as produced by a macro. This only exists for
341341
/// historical reasons. We'd like to get rid of it, for multiple reasons.
@@ -458,7 +458,7 @@ impl Token {
458458
/// if they keep spans or perform edition checks.
459459
pub fn uninterpolated_span(&self) -> Span {
460460
match self.kind {
461-
NtIdent(ident, _) | NtLifetime(ident) => ident.span,
461+
NtIdent(ident, _) | NtLifetime(ident, _) => ident.span,
462462
Interpolated(ref nt) => nt.use_span(),
463463
_ => self.span,
464464
}
@@ -661,7 +661,9 @@ impl Token {
661661
pub fn uninterpolate(&self) -> Cow<'_, Token> {
662662
match self.kind {
663663
NtIdent(ident, is_raw) => Cow::Owned(Token::new(Ident(ident.name, is_raw), ident.span)),
664-
NtLifetime(ident) => Cow::Owned(Token::new(Lifetime(ident.name), ident.span)),
664+
NtLifetime(ident, is_raw) => {
665+
Cow::Owned(Token::new(Lifetime(ident.name, is_raw), ident.span))
666+
}
665667
_ => Cow::Borrowed(self),
666668
}
667669
}
@@ -679,11 +681,11 @@ impl Token {
679681

680682
/// Returns a lifetime identifier if this token is a lifetime.
681683
#[inline]
682-
pub fn lifetime(&self) -> Option<Ident> {
684+
pub fn lifetime(&self) -> Option<(Ident, IdentIsRaw)> {
683685
// We avoid using `Token::uninterpolate` here because it's slow.
684686
match self.kind {
685-
Lifetime(name) => Some(Ident::new(name, self.span)),
686-
NtLifetime(ident) => Some(ident),
687+
Lifetime(name, is_raw) => Some((Ident::new(name, self.span), is_raw)),
688+
NtLifetime(ident, is_raw) => Some((ident, is_raw)),
687689
_ => None,
688690
}
689691
}
@@ -865,7 +867,7 @@ impl Token {
865867
_ => return None,
866868
},
867869
SingleQuote => match joint.kind {
868-
Ident(name, IdentIsRaw::No) => Lifetime(Symbol::intern(&format!("'{name}"))),
870+
Ident(name, is_raw) => Lifetime(Symbol::intern(&format!("'{name}")), is_raw),
869871
_ => return None,
870872
},
871873

0 commit comments

Comments
 (0)
Please sign in to comment.