Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
2afd4ed
Manually set initial TCP socket readiness
WhySoBad Aug 31, 2026
c967fc3
Merge pull request #5299 from WhySoBad/default-tcp-socket-readiness
RalfJung Sep 5, 2026
786d634
Prepare for merging from rust-lang/rust
Sep 6, 2026
f6da7ba
Merge ref 'f248f4038796' from rust-lang/rust
Sep 6, 2026
3af1d65
Merge pull request #5309 from rust-lang/rustup-2026-09-06
RalfJung Sep 6, 2026
9311482
Prepare for merging from rust-lang/rust
Sep 10, 2026
bd0c526
Merge ref '315ecf4a939d' from rust-lang/rust
Sep 10, 2026
34deffb
fmt
Sep 10, 2026
2b85c28
adjust CI: 32bit windows hosts are no more
RalfJung Sep 10, 2026
cbb4ec4
Merge pull request #5313 from rust-lang/rustup-2026-09-10
RalfJung Sep 10, 2026
c301619
use proper c_void for '*_' shim signatures
RalfJung Sep 11, 2026
83e06d3
Merge pull request #5315 from RalfJung/sig-ptr-types
RalfJung Sep 11, 2026
a451894
add case mapping fast paths for Latin-1
ywxt Sep 14, 2026
68963d8
stop unleaking `&mut`s
maxdexh Sep 14, 2026
8545395
Merge pull request #5316 from maxdexh/unleak-considered-harmful
RalfJung Sep 14, 2026
a243cf4
Prepare for merging from rust-lang/rust
Sep 15, 2026
5c57c46
Merge ref 'c26ce708de5d' from rust-lang/rust
Sep 15, 2026
2e1a970
Merge pull request #5317 from rust-lang/rustup-2026-09-15
RalfJung Sep 15, 2026
01da50f
Account for split text events in bare urls lint
notriddle Sep 16, 2026
8e4f287
Account for nested parens in bare urls lint
notriddle Sep 16, 2026
0b34b6e
Prepare for merging from rust-lang/rust
Sep 17, 2026
39fc047
Merge ref '923c95cdf5ba' from rust-lang/rust
Sep 17, 2026
39a2977
Merge pull request #5318 from rust-lang/rustup-2026-09-17
RalfJung Sep 17, 2026
459ba37
Account for the separator between host and path
notriddle Sep 17, 2026
a83dd65
Account for URLs with accidental formatting
notriddle Sep 17, 2026
172ae8c
Declare multi-kind constants for MacroKinds
Zalathar Sep 18, 2026
27ed2ed
Introduce LockedDir type
bjorn3 Sep 18, 2026
6e7ebbe
Depend on lockfiles to prevent GC of the current session
bjorn3 Sep 18, 2026
c39609d
Revert "./miri toolchain: no need to run 'cargo metadata'"
RalfJung Sep 18, 2026
0d17901
add issue reference for work-around
RalfJung Sep 18, 2026
11458eb
Merge pull request #5322 from RalfJung/toolchain-metadata
RalfJung Sep 18, 2026
c91c25f
Prepare for merging from rust-lang/rust
Sep 19, 2026
4d11a44
Merge ref '971903d9aee2' from rust-lang/rust
Sep 19, 2026
715287a
Merge pull request #5324 from rust-lang/rustup-2026-09-19
oli-obk Sep 19, 2026
ae2ecf5
Avoid integer underflow in CStr::count_bytes()
Darksonn Sep 19, 2026
f4579a6
use errno_check a few more times
RalfJung Sep 19, 2026
80c0261
add dirfd support
RalfJung Sep 19, 2026
ae80614
prepare statx for metadata relative to dirfd... but we cannot impleme…
RalfJung Sep 19, 2026
001a866
statx: complain about invalid flags
RalfJung Sep 19, 2026
d708bca
Merge pull request #5325 from RalfJung/dirfd
RalfJung Sep 19, 2026
bc5fd06
Dir: fix fallback impl for remove_dir
RalfJung Sep 19, 2026
88a1bbe
statx: proper error code on empty path without flag
RalfJung Sep 19, 2026
900f61b
closedir: also close underlying FD
RalfJung Sep 19, 2026
4d65c6e
Merge pull request #5329 from RalfJung/dirfd-close
RalfJung Sep 19, 2026
ad44475
Merge pull request #5328 from RalfJung/statx-empty
RalfJung Sep 19, 2026
ea2fa3e
Add regression tests for runtime range pattern endpoints
chenyukang Sep 13, 2026
64695f1
Diagnose runtime range endpoints before reporting unsupported types
chenyukang Sep 13, 2026
70854cd
Use verbose suggestion for `mut binding` instead of `&mut binding`
estebank Sep 20, 2026
54f9e87
Be more explicit on suggestion type without changing how they are ren…
estebank Sep 19, 2026
f1e9e5e
When error from local macro, include macro def span
estebank Aug 13, 2026
3cfab90
Prepare for merging from rust-lang/rust
Sep 20, 2026
788a945
Merge ref 'feaadeeaca7d' from rust-lang/rust
Sep 20, 2026
95f476c
Merge pull request #5330 from rust-lang/rustup-2026-09-20
RalfJung Sep 20, 2026
35ec478
Use x30 register name with LLVM 23+
malezjaa Sep 20, 2026
3de0624
Use r14 register name with LLVM 23+
malezjaa Sep 20, 2026
a94b19e
simplify FileMetadata handling a bit
RalfJung Sep 20, 2026
ba4aca6
stat test: ensure it does follow symlinks
RalfJung Sep 20, 2026
d20eef4
statx: test that dirfd is ignored when path is absolute
RalfJung Sep 20, 2026
a568e05
Merge pull request #5331 from RalfJung/stat
RalfJung Sep 20, 2026
dded7e6
windows: reject some FILE_FLAG_OPEN_REPARSE_POINT uses we do not support
RalfJung Sep 20, 2026
0dc8df9
Merge pull request #5332 from RalfJung/win-reparse
RalfJung Sep 20, 2026
81d8904
Fix ArgAttributes mismatches in ABI UI tests for LoongArch64 and RiscV64
heiher Sep 20, 2026
21d6920
Test windows `access_mode` override
ChrisDenton Sep 20, 2026
ac5ff45
Windows: don't error if `access_mode` is set
ChrisDenton Sep 20, 2026
39f76c9
Refactor access_mode case out of match
ChrisDenton Sep 20, 2026
aceae2d
Replace `IdentIsRaw` with `IdentKind`
fmease Aug 25, 2026
3caa23d
Introduce helper `Token::non_raw_ident`
fmease Aug 25, 2026
68f7047
move sched_get/setaffinity shims into separate functions
RalfJung Sep 20, 2026
2d8731d
this ESRCH should not be reachable
RalfJung Sep 20, 2026
ac90169
Merge pull request #5334 from RalfJung/cpu-affinity
RalfJung Sep 20, 2026
04ef62c
make some more tests run-native
RalfJung Sep 20, 2026
1d763d3
turns put pthread_set/getname_np can segfault when given the wrong pt…
RalfJung Sep 20, 2026
3e96d2d
macos seems to return pthread_setname_np errors via errno...?
RalfJung Sep 20, 2026
b6a42cc
consistently use utils::prepare for temporary files
RalfJung Sep 20, 2026
38bbfa3
windows fs test: check CREATE_NEW semantics
RalfJung Sep 20, 2026
b9ce922
Merge pull request #5333 from RalfJung/native
RalfJung Sep 20, 2026
ebf08b9
enable `f128` from `u64`/`i64` test
folkertdev Sep 20, 2026
93c8966
Remove `TypeChecker::root_cx`
nnethercote Sep 7, 2026
28fe133
Do not continue past `rustc_resolve` when encountering duplicated types
estebank Sep 15, 2026
7fac56c
Fix graphviz label
nnethercote Aug 18, 2026
259bee6
Remove duplicated trait bound
nnethercote Aug 18, 2026
90dd142
Remove two unnecessary `try` blocks
nnethercote Aug 18, 2026
266da35
Remove `regex!` macro
nnethercote Aug 18, 2026
dfd1a7d
Streamline `write_node_label`
nnethercote Aug 18, 2026
ee2e94e
better debugging for which env var we carry over from build-time to r…
RalfJung Sep 6, 2026
1df9314
only preserve env vars cargo actually changes from build-time to run-…
RalfJung Sep 6, 2026
eeb2889
Merge pull request #5337 from RalfJung/env
RalfJung Sep 21, 2026
848ef40
Rollup merge of #161051 - estebank:macro_backtrace, r=adwinwhite
JonathanBrouwer Sep 21, 2026
87451e7
Rollup merge of #161629 - nnethercote:StateDiffCollector, r=cjgillot
JonathanBrouwer Sep 21, 2026
622b557
Rollup merge of #162750 - ywxt:ascii_char_to_uppercase, r=Amanieu
JonathanBrouwer Sep 21, 2026
faec976
Rollup merge of #162831 - estebank:duplicated-items, r=petrochenkov
JonathanBrouwer Sep 21, 2026
ff6bd7b
Rollup merge of #162835 - notriddle:notriddle/parens-bare-url, r=lolb…
JonathanBrouwer Sep 21, 2026
04ebe2a
Rollup merge of #162952 - bjorn3:incr_comp_locking_change, r=khyperia
JonathanBrouwer Sep 21, 2026
67baf83
Rollup merge of #163044 - chenyukang:yukang-fix-131327-runtime-range-…
JonathanBrouwer Sep 21, 2026
0e00d84
Rollup merge of #163062 - malezjaa:remove-aarch64-x30-asm-workaround,…
JonathanBrouwer Sep 21, 2026
2e7d29b
Rollup merge of #163091 - RalfJung:miri, r=RalfJung
JonathanBrouwer Sep 21, 2026
7c61e9b
Rollup merge of #162939 - Zalathar:combo-macro-kinds, r=khyperia
JonathanBrouwer Sep 21, 2026
042e9bc
Rollup merge of #162984 - ChrisDenton:access-allowed, r=clarfonthey
JonathanBrouwer Sep 21, 2026
67974b6
Rollup merge of #163005 - Darksonn:cstr-count-bytes, r=Mark-Simulacrum
JonathanBrouwer Sep 21, 2026
ae94029
Rollup merge of #163019 - fmease:prepare-kay-hash, r=petrochenkov
JonathanBrouwer Sep 21, 2026
7708dcb
Rollup merge of #163020 - RalfJung:dir-remove-dir-fallback, r=Mark-Si…
JonathanBrouwer Sep 21, 2026
896f920
Rollup merge of #163041 - estebank:explicit-suggestions, r=TaKO8Ki
JonathanBrouwer Sep 21, 2026
ffcbfd7
Rollup merge of #163047 - estebank:mut-binding, r=adwinwhite
JonathanBrouwer Sep 21, 2026
5905d73
Rollup merge of #163075 - heiher:fix-argattrs, r=folkertdev
JonathanBrouwer Sep 21, 2026
04a9fb4
Rollup merge of #163079 - folkertdev:f128-from-int-tests, r=tgross35
JonathanBrouwer Sep 21, 2026
43ad959
Rollup merge of #163082 - nnethercote:rm-TypeChecker-root_cx, r=cheny…
JonathanBrouwer Sep 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
113 changes: 55 additions & 58 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ impl Lit {
/// `Parser::eat_token_lit` (excluding unary negation).
pub fn from_token(token: &Token) -> Option<Lit> {
match token.uninterpolate().kind {
Ident(name, IdentIsRaw::No) if name.is_bool_lit() => Some(Lit::new(Bool, name, None)),
Ident(name, IdentKind::Normal) if name.is_bool_lit() => {
Some(Lit::new(Bool, name, None))
}
Literal(token_lit) => Some(token_lit),
OpenInvisible(InvisibleOrigin::MetaVar(
MetaVarKind::Literal | MetaVarKind::Expr { .. },
Expand Down Expand Up @@ -307,11 +309,11 @@ impl LitKind {
}
}

pub fn ident_can_begin_expr(name: Symbol, span: Span, is_raw: IdentIsRaw) -> bool {
pub fn ident_can_begin_expr(name: Symbol, span: Span, kind: IdentKind) -> bool {
// WARNING: Take care when modifying this function! It will change the stable(!) set of
// tokens that are allowed to match an `expr` nonterminal which is user observable.

let ident_token = Token::new(Ident(name, is_raw), span);
let ident_token = Token::new(Ident(name, kind), span);

// FIXME: Remove `box` from this list given we officially no longer support box expressions
// (#108471) (needs lang FCP as it affects stable macro matching behavior).
Expand Down Expand Up @@ -344,11 +346,11 @@ pub fn ident_can_begin_expr(name: Symbol, span: Span, is_raw: IdentIsRaw) -> boo
.contains(&name)
}

fn ident_can_begin_type(name: Symbol, span: Span, is_raw: IdentIsRaw) -> bool {
fn ident_can_begin_type(name: Symbol, span: Span, kind: IdentKind) -> bool {
// WARNING: Take care when modifying this function! It will change the stable(!) set of
// tokens that are allowed to match an `ty` nonterminal which is user observable.

let ident_token = Token::new(Ident(name, is_raw), span);
let ident_token = Token::new(Ident(name, kind), span);

!ident_token.is_reserved_ident()
|| ident_token.is_path_segment_keyword()
Expand All @@ -357,32 +359,26 @@ fn ident_can_begin_type(name: Symbol, span: Span, is_raw: IdentIsRaw) -> bool {
}

#[derive(PartialEq, Eq, Encodable, Decodable, Hash, Debug, Copy, Clone, StableHash)]
pub enum IdentIsRaw {
No,
Yes,
pub enum IdentKind {
Normal,
Raw,
}

impl IdentIsRaw {
impl IdentKind {
pub fn to_print_mode_ident(self) -> IdentPrintMode {
match self {
IdentIsRaw::No => IdentPrintMode::Normal,
IdentIsRaw::Yes => IdentPrintMode::RawIdent,
IdentKind::Normal => IdentPrintMode::Normal,
IdentKind::Raw => IdentPrintMode::RawIdent,
}
}
pub fn to_print_mode_lifetime(self) -> IdentPrintMode {
match self {
IdentIsRaw::No => IdentPrintMode::Normal,
IdentIsRaw::Yes => IdentPrintMode::RawLifetime,
IdentKind::Normal => IdentPrintMode::Normal,
IdentKind::Raw => IdentPrintMode::RawLifetime,
}
}
}

impl From<bool> for IdentIsRaw {
fn from(b: bool) -> Self {
if b { Self::Yes } else { Self::No }
}
}

#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, StableHash)]
pub enum TokenKind {
/* Expression-operator symbols. */
Expand Down Expand Up @@ -507,22 +503,22 @@ pub enum TokenKind {
/// It's recommended to use `Token::{ident,uninterpolate}` and
/// `Parser::token_uninterpolated_span` to treat regular and interpolated
/// identifiers in the same way.
Ident(Symbol, IdentIsRaw),
Ident(Symbol, IdentKind),
/// This identifier (and its span) is the identifier passed to the
/// declarative macro. The span in the surrounding `Token` is the span of
/// the `ident` metavariable in the macro's RHS.
NtIdent(sp::Ident, IdentIsRaw),
NtIdent(sp::Ident, IdentKind),

/// Lifetime identifier token.
/// Do not forget about `NtLifetime` when you want to match on lifetime identifiers.
/// It's recommended to use `Token::{ident,uninterpolate}` and
/// `Parser::token_uninterpolated_span` to treat regular and interpolated
/// identifiers in the same way.
Lifetime(Symbol, IdentIsRaw),
Lifetime(Symbol, IdentKind),
/// This identifier (and its span) is the lifetime passed to the
/// declarative macro. The span in the surrounding `Token` is the span of
/// the `lifetime` metavariable in the macro's RHS.
NtLifetime(sp::Ident, IdentIsRaw),
NtLifetime(sp::Ident, IdentKind),

/// A doc comment token.
/// `Symbol` is the doc comment's data excluding its "quotes" (`///`, `/**`, etc)
Expand Down Expand Up @@ -643,7 +639,8 @@ impl Token {

/// Recovers a `Token` from an `Ident`. This creates a raw identifier if necessary.
pub fn from_ast_ident(ident: sp::Ident) -> Self {
Token::new(Ident(ident.name, ident.is_raw_guess().into()), ident.span)
let kind = if ident.is_raw_guess() { IdentKind::Raw } else { IdentKind::Normal };
Token::new(Ident(ident.name, kind), ident.span)
}

pub fn is_range_separator(&self) -> bool {
Expand Down Expand Up @@ -674,8 +671,8 @@ impl Token {
// tokens that are allowed to match an `expr` nonterminal which is user observable.

match self.uninterpolate().kind {
Ident(name, is_raw) =>
ident_can_begin_expr(name, self.span, is_raw), // value name or keyword
Ident(name, kind) =>
ident_can_begin_expr(name, self.span, kind), // value name or keyword
OpenParen | // tuple
OpenBrace | // block
OpenBracket | // array
Expand Down Expand Up @@ -743,8 +740,8 @@ impl Token {
// object types (consider `use<>+` and `use<T> + Trait` for example).

match self.uninterpolate().kind {
Ident(name, is_raw) =>
ident_can_begin_type(name, self.span, is_raw), // type name or keyword
Ident(name, kind) =>
ident_can_begin_type(name, self.span, kind), // type name or keyword
OpenParen // tuple
| OpenBracket // array
| Bang // never
Expand All @@ -766,7 +763,7 @@ impl Token {
pub fn can_begin_const_arg(&self) -> bool {
match self.kind {
OpenBrace | Literal(..) | Minus => true,
Ident(name, IdentIsRaw::No) if name.is_bool_lit() => true,
Ident(name, IdentKind::Normal) if name.is_bool_lit() => true,
OpenInvisible(InvisibleOrigin::MetaVar(
MetaVarKind::Expr { .. } | MetaVarKind::Block | MetaVarKind::Literal,
)) => true,
Expand Down Expand Up @@ -815,7 +812,7 @@ impl Token {
pub fn can_begin_literal_maybe_minus(&self) -> bool {
match self.uninterpolate().kind {
Literal(..) | Minus => true,
Ident(name, IdentIsRaw::No) if name.is_bool_lit() => true,
Ident(name, IdentKind::Normal) if name.is_bool_lit() => true,
OpenInvisible(InvisibleOrigin::MetaVar(mv_kind)) => match mv_kind {
MetaVarKind::Literal => true,
MetaVarKind::Expr { can_begin_literal_maybe_minus, .. } => {
Expand Down Expand Up @@ -845,32 +842,32 @@ impl Token {
/// otherwise returns the original token.
pub fn uninterpolate(&self) -> Cow<'_, Token> {
match self.kind {
NtIdent(ident, is_raw) => Cow::Owned(Token::new(Ident(ident.name, is_raw), ident.span)),
NtLifetime(ident, is_raw) => {
Cow::Owned(Token::new(Lifetime(ident.name, is_raw), ident.span))
NtIdent(ident, kind) => Cow::Owned(Token::new(Ident(ident.name, kind), ident.span)),
NtLifetime(ident, kind) => {
Cow::Owned(Token::new(Lifetime(ident.name, kind), ident.span))
}
_ => Cow::Borrowed(self),
}
}

/// Returns an identifier if this token is an identifier.
#[inline]
pub fn ident(&self) -> Option<(sp::Ident, IdentIsRaw)> {
pub fn ident(&self) -> Option<(sp::Ident, IdentKind)> {
// We avoid using `Token::uninterpolate` here because it's slow.
match self.kind {
Ident(name, is_raw) => Some((sp::Ident::new(name, self.span), is_raw)),
NtIdent(ident, is_raw) => Some((ident, is_raw)),
Ident(name, kind) => Some((sp::Ident::new(name, self.span), kind)),
NtIdent(ident, kind) => Some((ident, kind)),
_ => None,
}
}

/// Returns a lifetime identifier if this token is a lifetime.
#[inline]
pub fn lifetime(&self) -> Option<(sp::Ident, IdentIsRaw)> {
pub fn lifetime(&self) -> Option<(sp::Ident, IdentKind)> {
// We avoid using `Token::uninterpolate` here because it's slow.
match self.kind {
Lifetime(name, is_raw) => Some((sp::Ident::new(name, self.span), is_raw)),
NtLifetime(ident, is_raw) => Some((ident, is_raw)),
Lifetime(name, kind) => Some((sp::Ident::new(name, self.span), kind)),
NtLifetime(ident, kind) => Some((ident, kind)),
_ => None,
}
}
Expand Down Expand Up @@ -929,43 +926,43 @@ impl Token {

/// Returns `true` if the token is a given keyword, `kw`.
pub fn is_keyword(&self, kw: Symbol) -> bool {
self.is_non_raw_ident_where(|id| id.name == kw)
self.non_raw_ident().is_some_and(|id| id.name == kw)
}

/// Returns `true` if the token is a given keyword, `kw` or if `case` is `Insensitive` and this
/// token is an identifier equal to `kw` ignoring the case.
pub fn is_keyword_case(&self, kw: Symbol, case: Case) -> bool {
self.is_keyword(kw)
|| (case == Case::Insensitive
&& self.is_non_raw_ident_where(|id| {
&& self.non_raw_ident().is_some_and(|id| {
// Do an ASCII case-insensitive match, because all keywords are ASCII.
id.name.as_str().eq_ignore_ascii_case(kw.as_str())
}))
}

pub fn is_path_segment_keyword(&self) -> bool {
self.is_non_raw_ident_where(sp::Ident::is_path_segment_keyword)
self.non_raw_ident().is_some_and(sp::Ident::is_path_segment_keyword)
}

/// Returns true for reserved identifiers used internally for elided lifetimes,
/// unnamed method parameters, crate root module, error recovery etc.
pub fn is_special_ident(&self) -> bool {
self.is_non_raw_ident_where(sp::Ident::is_special)
self.non_raw_ident().is_some_and(sp::Ident::is_special)
}

/// Returns `true` if the token is a keyword used in the language.
pub fn is_used_keyword(&self) -> bool {
self.is_non_raw_ident_where(sp::Ident::is_used_keyword)
self.non_raw_ident().is_some_and(sp::Ident::is_used_keyword)
}

/// Returns `true` if the token is a keyword reserved for possible future use.
pub fn is_unused_keyword(&self) -> bool {
self.is_non_raw_ident_where(sp::Ident::is_unused_keyword)
self.non_raw_ident().is_some_and(sp::Ident::is_unused_keyword)
}

/// Returns `true` if the token is either a special identifier or a keyword.
pub fn is_reserved_ident(&self) -> bool {
self.is_non_raw_ident_where(sp::Ident::is_reserved)
self.non_raw_ident().is_some_and(sp::Ident::is_reserved)
}

pub fn is_non_reserved_ident(&self) -> bool {
Expand All @@ -974,13 +971,21 @@ impl Token {

pub fn non_reserved_ident(&self) -> Option<sp::Ident> {
self.ident()
.filter(|&(id, raw)| raw == IdentIsRaw::Yes || !sp::Ident::is_reserved(id))
.filter(|&(id, kind)| kind == IdentKind::Raw || !id.is_reserved())
.map(|(id, _)| id)
}

/// If this token is a non-raw identifier, return the identifier in question.
pub fn non_raw_ident(&self) -> Option<sp::Ident> {
match self.ident() {
Some((id, IdentKind::Normal)) => Some(id),
_ => None,
}
}

/// Returns `true` if the token is the identifier `true` or `false`.
pub fn is_bool_lit(&self) -> bool {
self.is_non_raw_ident_where(|id| id.name.is_bool_lit())
self.non_raw_ident().is_some_and(|id| id.name.is_bool_lit())
}

pub fn is_numeric_lit(&self) -> bool {
Expand All @@ -995,14 +1000,6 @@ impl Token {
matches!(self.kind, Literal(Lit { kind: LitKind::Integer, .. }))
}

/// Returns `true` if the token is a non-raw identifier for which `pred` holds.
pub fn is_non_raw_ident_where(&self, pred: impl FnOnce(sp::Ident) -> bool) -> bool {
match self.ident() {
Some((id, IdentIsRaw::No)) => pred(id),
_ => false,
}
}

/// Is this an invisible open delimiter at the start of a token sequence
/// from an expanded metavar?
pub fn is_metavar_seq(&self) -> Option<MetaVarKind> {
Expand Down Expand Up @@ -1076,8 +1073,8 @@ impl Token {
(Colon, Colon) => PathSep,
(Colon, _) => return None,

(SingleQuote, Ident(name, is_raw)) => {
Lifetime(Symbol::intern(&format!("'{name}")), *is_raw)
(SingleQuote, Ident(name, kind)) => {
Lifetime(Symbol::intern(&format!("'{name}")), *kind)
}
(SingleQuote, _) => return None,

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/tokenstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ impl TokenStream {
DelimSpacing::new(Spacing::JointHidden, Spacing::Alone),
Delimiter::Bracket,
[
TokenTree::token_alone(token::Ident(sym::doc, token::IdentIsRaw::No), span),
TokenTree::token_alone(token::Ident(sym::doc, token::IdentKind::Normal), span),
TokenTree::token_alone(token::Eq, span),
TokenTree::token_alone(
TokenKind::lit(token::StrRaw(num_of_hashes), data, None),
Expand Down
22 changes: 10 additions & 12 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,20 +364,18 @@ fn space_between(tt1: &TokenTree, tt2: &TokenTree) -> bool {

// IDENT + `!`: `println!()`, but `if !x { ... }` needs a space after the `if`
(
Tok(tk::Token { kind: tk::Ident(sym, is_raw), span }, _),
Tok(tk::Token { kind: tk::Ident(sym, kind), span }, _),
Tok(tk::Token { kind: tk::Bang, .. }, _),
) if !Ident::new(*sym, *span).is_reserved() || matches!(is_raw, tk::IdentIsRaw::Yes) => {
false
}
) if !Ident::new(*sym, *span).is_reserved() || matches!(kind, tk::IdentKind::Raw) => false,

// IDENT|`fn`|`Self`|`pub` + `(`: `f(3)`, `fn(x: u8)`, `Self()`, `pub(crate)`,
// but `let (a, b) = (1, 2)` needs a space after the `let`
(Tok(tk::Token { kind: tk::Ident(sym, is_raw), span }, _), Del(_, _, Parenthesis, _))
(Tok(tk::Token { kind: tk::Ident(sym, kind), span }, _), Del(_, _, Parenthesis, _))
if !Ident::new(*sym, *span).is_reserved()
|| *sym == kw::Fn
|| *sym == kw::SelfUpper
|| *sym == kw::Pub
|| matches!(is_raw, tk::IdentIsRaw::Yes) =>
|| matches!(kind, tk::IdentKind::Raw) =>
{
false
}
Expand Down Expand Up @@ -1076,17 +1074,17 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
tk::Literal(lit) => literal_to_string(lit).into(),

/* Name components */
tk::Ident(name, is_raw) => {
IdentPrinter::new(name, is_raw.to_print_mode_ident(), convert_dollar_crate)
tk::Ident(name, kind) => {
IdentPrinter::new(name, kind.to_print_mode_ident(), convert_dollar_crate)
.to_string()
.into()
}
tk::NtIdent(ident, is_raw) => {
IdentPrinter::for_ast_ident(ident, is_raw.to_print_mode_ident()).to_string().into()
tk::NtIdent(ident, kind) => {
IdentPrinter::for_ast_ident(ident, kind.to_print_mode_ident()).to_string().into()
}

tk::Lifetime(name, is_raw) | tk::NtLifetime(Ident { name, .. }, is_raw) => {
IdentPrinter::new(name, is_raw.to_print_mode_lifetime(), None).to_string().into()
tk::Lifetime(name, kind) | tk::NtLifetime(Ident { name, .. }, kind) => {
IdentPrinter::new(name, kind.to_print_mode_lifetime(), None).to_string().into()
}

/* Other */
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,7 @@ impl<'a, G> Diagnostic<'a, G> for AttributeParseError<'_> {
match &self.reason {
AttributeParseErrorReason::ExpectedStringLiteral { byte_string } => {
if let Some(start_point_span) = byte_string {
diag.span_suggestion(
diag.span_suggestion_short(
*start_point_span,
"consider removing the prefix",
"",
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ fn borrowck_collect_region_constraints<'tcx>(
deferred_closure_requirements,
polonius_context,
} = type_check::type_check(
root_cx,
&infcx,
body,
&promoted,
Expand Down
Loading
Loading