Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2cc26bf
Remove rustc_legacy_const_generics from LoongArch64 SIMD
heiher Sep 9, 2026
9da2dbd
Stabilize LoongArch64 SIMD intrinsics
heiher Sep 9, 2026
a4aac2f
Use "latest" symlink for icx path
adamgemmell Oct 19, 2026
1077a78
Remove use of is_powerpc64_feature_detected
adamgemmell Oct 22, 2026
8bee029
Don't let riscv32gc-unknown-linux-gnu (tier 3) block CI on failure
adamgemmell Oct 22, 2026
2a66a81
Merge pull request #2259 from adamgemmell/dev/adagem01/icx-ver-bump
folkertdev Oct 22, 2026
3c5eefd
Merge pull request #2221 from heiher/stabilize-loong64-simd
folkertdev Oct 22, 2026
192c29c
perf: emit field names as a concatenated string in derive(Debug) for …
panstromek Oct 22, 2026
bea7af9
Add test for debug output for big struct
panstromek Oct 22, 2026
194a9a5
Use string contatenation strategy for fieldN helpers as well
panstromek Oct 22, 2026
db15c6a
Concat struct name together with field names
panstromek Oct 22, 2026
b540852
doc: cleanup comment
panstromek Oct 23, 2026
f3f485e
doc: cleanup comment
panstromek Oct 23, 2026
635700c
perf: shrink unnecessary capacity
panstromek Oct 23, 2026
9e5308c
ref: use thin_vec! macro avoid managing the capacity manually
panstromek Oct 23, 2026
9e32779
perf: avoid allocating more capacity for tuples
panstromek Oct 23, 2026
88f395a
perf: reduce unnecessary capacity
panstromek Oct 23, 2026
4526f83
cln: remove args_per_field, it's now always 1 in place where it gets …
panstromek Oct 23, 2026
9dcaa68
ref: rename
panstromek Oct 23, 2026
b99c49b
perf: avoid allocating expression for name for cases where it's not used
panstromek Oct 23, 2026
3cd9cd0
test: bless macro stats test
panstromek Oct 26, 2026
4719ede
ref: put names before field values in debug helpers
panstromek Oct 25, 2026
5221654
Move lang item collection to the resolver
oli-obk Jul 9, 2026
e360750
Instantiate a response in pieces
nnethercote Oct 9, 2026
78a5d5e
Optimize `unify_query_var_values`
nnethercote Oct 9, 2026
8eb0c38
Special-case canonical bound vars in `unify_query_var_values`
nnethercote Oct 9, 2026
eb07e9d
Introduce `IsIdentity` type
nnethercote Oct 12, 2026
7242cbe
Add an early return to `instantiate_and_apply_query_response`
nnethercote Oct 12, 2026
474c761
Introduce `Canonicalized` and other clarifications
nnethercote Oct 14, 2026
a95082d
Prepare for merging from rust-lang/rust
invalid-email-address Oct 27, 2026
cf5da2b
Merge ref '16d1ffac17ad' from rust-lang/rust
invalid-email-address Oct 27, 2026
ed7d26d
Run `cargo fmt`
invalid-email-address Oct 27, 2026
6574cf3
Merge pull request #2246 from rust-lang/rustc-pull
tgross35 Oct 27, 2026
ac07049
Avoid stdlib's `impl Hash for Discriminant` for stable hashing
Zalathar Oct 26, 2026
5550f2b
remove unneeded `feature(stdarch_loongarch)`
folkertdev Oct 27, 2026
983a8a0
Remove `AttrTokenStream` and `AttrTokenTree`
nnethercote Oct 26, 2026
5f9acfd
Rename `LazyAttrTokenStream{,Inner}`
nnethercote Oct 27, 2026
bdb70c6
Avoid unnecessary numeric type vars
nnethercote Oct 26, 2026
31906cc
Rollup merge of #165032 - folkertdev:stdarch-sync-2026-10-27, r=folke…
JonathanBrouwer Oct 28, 2026
bf72343
Rollup merge of #163525 - oli-obk:resolver_lang_items, r=petrochenkov
JonathanBrouwer Oct 28, 2026
bf4548f
Rollup merge of #164234 - nnethercote:diesel-opts-2, r=lcnr
JonathanBrouwer Oct 28, 2026
9071c78
Rollup merge of #164726 - panstromek:debug-concat-more, r=nnethercote
JonathanBrouwer Oct 28, 2026
b1bc6b3
Rollup merge of #164953 - Zalathar:discriminant, r=oli-obk
JonathanBrouwer Oct 28, 2026
b115357
Rollup merge of #164965 - nnethercote:avoid-unnecessary-num-type-vars…
JonathanBrouwer Oct 28, 2026
6aa974d
Rollup merge of #165022 - nnethercote:rm-AttrTokenStream, r=petrochenkov
JonathanBrouwer Oct 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4662,7 +4662,6 @@ dependencies = [
"rustc_ast_lowering",
"rustc_attr_ir",
"rustc_attr_parsing",
"rustc_crate_store",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
Expand Down Expand Up @@ -4787,6 +4786,7 @@ dependencies = [
"rustc_ast_pretty",
"rustc_attr_ir",
"rustc_attr_parsing",
"rustc_crate_store",
"rustc_data_structures",
"rustc_errors",
"rustc_expand",
Expand Down Expand Up @@ -4906,6 +4906,7 @@ dependencies = [
"rustc_data_structures",
"rustc_hashes",
"rustc_hir",
"rustc_macros",
"rustc_middle",
"rustc_session",
"rustc_span",
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use thin_vec::{ThinVec, thin_vec};
use crate::attr::data_structures::CfgEntry;
pub use crate::format::*;
use crate::token::{self, CommentKind, Delimiter};
use crate::tokenstream::{DelimSpan, LazyAttrTokenStream, TokenStream, TokenTree};
use crate::tokenstream::{DelimSpan, LazyTokenStream, TokenStream, TokenTree};
use crate::util::parser::{ExprPrecedence, Fixity};
use crate::visit::{AssocCtxt, BoundKind, LifetimeCtxt};

Expand Down Expand Up @@ -1221,7 +1221,7 @@ impl Stmt {
/// a trailing semicolon.
///
/// This only modifies the parsed AST struct, not the attached
/// `LazyAttrTokenStream`. The parser is responsible for calling
/// `LazyTokenStream`. The parser is responsible for calling
/// `ToAttrTokenStream::add_trailing_semi` when there is actually
/// a semicolon in the tokenstream.
pub fn add_trailing_semicolon(mut self) -> Self {
Expand Down Expand Up @@ -1281,7 +1281,7 @@ pub struct MacCallStmt {
pub mac: Box<MacCall>,
pub style: MacStmtStyle,
pub attrs: AttrVec,
pub tokens: Option<LazyAttrTokenStream>,
pub tokens: Option<LazyTokenStream>,
}

#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, Walkable)]
Expand All @@ -1308,7 +1308,7 @@ pub struct Local {
pub span: Span,
pub colon_sp: Option<Span>,
pub attrs: AttrVec,
pub tokens: Option<LazyAttrTokenStream>,
pub tokens: Option<LazyTokenStream>,
}

#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
Expand Down Expand Up @@ -1409,7 +1409,7 @@ pub struct Expr {
pub kind: ExprKind,
pub span: Span,
pub attrs: AttrVec,
pub tokens: Option<LazyAttrTokenStream>,
pub tokens: Option<LazyTokenStream>,
}

impl Expr {
Expand Down Expand Up @@ -3605,7 +3605,7 @@ impl GeneratedAttr {
}
}

pub fn token_trees(&self) -> Vec<TokenTree> {
pub fn append_token_trees_to(&self, _res: &mut Vec<TokenTree>) {
unimplemented!(
"generated attribute `{}` cannot re-enter the parser at this time",
self.descr()
Expand All @@ -3618,7 +3618,7 @@ pub struct NormalAttr {
pub item: AttrItem,
// Tokens for the full attribute, e.g. `#[foo]`, `#![bar]`. (Compare this with
// `ParseNtResult::Meta`; `expand_cfg_attr_item` is where the two cases interact.)
pub tokens: Option<LazyAttrTokenStream>,
pub tokens: Option<LazyTokenStream>,
}

impl NormalAttr {
Expand Down Expand Up @@ -3889,7 +3889,7 @@ pub struct Item<K = ItemKind> {
///
/// Note that the tokens here do not include the outer attributes, but will
/// include inner attributes.
pub tokens: Option<LazyAttrTokenStream>,
pub tokens: Option<LazyTokenStream>,
}

impl Item {
Expand Down
38 changes: 19 additions & 19 deletions compiler/rustc_ast/src/ast_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::fmt;
use std::marker::PhantomData;

use crate::tokenstream::{LazyAttrTokenStream, WithTokens};
use crate::tokenstream::{LazyTokenStream, WithTokens};
use crate::{
Arm, AssocItem, AttrItem, AttrKind, AttrVec, Attribute, Block, Crate, Expr, ExprField,
FieldDef, ForeignItem, GenericParam, Item, NodeId, Param, Pat, PatField, Path, Stmt, StmtKind,
Expand Down Expand Up @@ -63,18 +63,18 @@ impl<T: HasNodeId> HasNodeId for Box<T> {

/// A trait for AST nodes having (or not having) collected tokens.
pub trait HasTokens: HasAttrs {
fn tokens(&self) -> Option<&LazyAttrTokenStream>;
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>>;
fn tokens(&self) -> Option<&LazyTokenStream>;
fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>>;
}

macro_rules! impl_has_tokens {
($($T:ty),+ $(,)?) => {
$(
impl HasTokens for $T {
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
fn tokens(&self) -> Option<&LazyTokenStream> {
self.tokens.as_ref()
}
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>> {
Some(&mut self.tokens)
}
}
Expand All @@ -86,10 +86,10 @@ macro_rules! impl_has_tokens_none {
($($T:ty),+ $(,)?) => {
$(
impl HasTokens for $T {
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
fn tokens(&self) -> Option<&LazyTokenStream> {
None
}
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>> {
None
}
}
Expand All @@ -110,34 +110,34 @@ impl_has_tokens_none!(
);

impl<T: HasAttrs> HasTokens for WithTokens<T> {
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
fn tokens(&self) -> Option<&LazyTokenStream> {
self.tokens.as_ref()
}
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>> {
Some(&mut self.tokens)
}
}

impl<T: HasTokens> HasTokens for Option<T> {
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
fn tokens(&self) -> Option<&LazyTokenStream> {
self.as_ref().and_then(|inner| inner.tokens())
}
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>> {
self.as_mut().and_then(|inner| inner.tokens_mut())
}
}

impl<T: HasTokens> HasTokens for Box<T> {
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
fn tokens(&self) -> Option<&LazyTokenStream> {
(**self).tokens()
}
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>> {
(**self).tokens_mut()
}
}

impl HasTokens for StmtKind {
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
fn tokens(&self) -> Option<&LazyTokenStream> {
match self {
StmtKind::Let(local) => local.tokens.as_ref(),
StmtKind::Item(item) => item.tokens(),
Expand All @@ -146,7 +146,7 @@ impl HasTokens for StmtKind {
StmtKind::MacCall(mac) => mac.tokens.as_ref(),
}
}
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>> {
match self {
StmtKind::Let(local) => Some(&mut local.tokens),
StmtKind::Item(item) => item.tokens_mut(),
Expand All @@ -158,24 +158,24 @@ impl HasTokens for StmtKind {
}

impl HasTokens for Stmt {
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
fn tokens(&self) -> Option<&LazyTokenStream> {
self.kind.tokens()
}
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>> {
self.kind.tokens_mut()
}
}

impl HasTokens for Attribute {
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
fn tokens(&self) -> Option<&LazyTokenStream> {
match &self.kind {
AttrKind::Normal(normal) => normal.tokens.as_ref(),
AttrKind::Synthetic(..) | AttrKind::DocComment(..) | AttrKind::Generated(..) => {
unreachable!()
}
}
}
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>> {
Some(match &mut self.kind {
AttrKind::Normal(normal) => &mut normal.tokens,
AttrKind::Synthetic(..) | AttrKind::DocComment(..) | AttrKind::Generated(..) => {
Expand Down
54 changes: 24 additions & 30 deletions compiler/rustc_ast/src/attr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use crate::token::{
self, CommentKind, Delimiter, DocFragmentKind, InvisibleOrigin, MetaVarKind, Token,
};
use crate::tokenstream::{
AttrTokenStream, AttrTokenTree, DelimSpacing, DelimSpan, LazyAttrTokenStream, Spacing,
TokenStream, TokenStreamIter, TokenTree,
DelimSpacing, DelimSpan, LazyTokenStream, Spacing, TokenStream, TokenStreamIter, TokenTree,
};
use crate::util::comments;
use crate::util::literal::escape_string_symbol;
Expand Down Expand Up @@ -306,21 +305,20 @@ impl Attribute {
}
}

pub fn token_trees(&self) -> Vec<TokenTree> {
pub fn append_token_trees_to(&self, res: &mut Vec<TokenTree>) {
match &self.kind {
AttrKind::Normal(normal) => normal
.tokens
.as_ref()
.unwrap_or_else(|| panic!("attribute is missing tokens: {self:?}"))
.to_attr_token_stream()
.to_token_trees(),
.append_token_trees_to(res),
// Empty tokens here ensures synthetic attributes are invisible to proc macros.
AttrKind::Synthetic(..) => vec![],
AttrKind::Generated(generated) => generated.token_trees(),
AttrKind::DocComment(comment_kind, data) => vec![TokenTree::token_alone(
AttrKind::Synthetic(..) => {}
AttrKind::Generated(generated) => generated.append_token_trees_to(res),
AttrKind::DocComment(comment_kind, data) => res.push(TokenTree::token_alone(
token::DocComment(*comment_kind, self.style, *data),
self.span,
)],
)),
}
}

Expand Down Expand Up @@ -539,7 +537,7 @@ impl MetaItem {
unreachable!()
}
Some(TokenTree::Token(Token { kind, .. }, _)) if kind.is_delim() => {
panic!("Should be `AttrTokenTree::Delimited`, not delim tokens: {:?}", tt);
panic!("Should be `TokenTree::Delimited`, not delim tokens: {:?}", tt);
}
_ => return None,
};
Expand Down Expand Up @@ -750,7 +748,7 @@ pub fn mk_doc_comment(
pub fn mk_attr_from_item(
g: &AttrIdGenerator,
item: AttrItem,
tokens: Option<LazyAttrTokenStream>,
tokens: Option<LazyTokenStream>,
style: AttrStyle,
span: Span,
) -> Attribute {
Expand All @@ -762,28 +760,24 @@ pub fn mk_attr_from_item(
}
}

fn mk_attr_tokens(
style: AttrStyle,
item_tokens: AttrTokenStream,
span: Span,
) -> LazyAttrTokenStream {
fn mk_attr_tokens(style: AttrStyle, item_tokens: TokenStream, span: Span) -> LazyTokenStream {
let mut tokens = match style {
AttrStyle::Outer => {
vec![AttrTokenTree::Token(Token::new(token::Pound, span), Spacing::JointHidden)]
vec![TokenTree::Token(Token::new(token::Pound, span), Spacing::JointHidden)]
}
AttrStyle::Inner => vec![
AttrTokenTree::Token(Token::new(token::Pound, span), Spacing::Joint),
AttrTokenTree::Token(Token::new(token::Bang, span), Spacing::JointHidden),
TokenTree::Token(Token::new(token::Pound, span), Spacing::Joint),
TokenTree::Token(Token::new(token::Bang, span), Spacing::JointHidden),
],
};
tokens.push(AttrTokenTree::Delimited(
tokens.push(TokenTree::Delimited(
DelimSpan::from_single(span),
DelimSpacing::new(Spacing::JointHidden, Spacing::Alone),
Delimiter::Bracket,
item_tokens,
));

LazyAttrTokenStream::new_direct(AttrTokenStream::new(tokens))
LazyTokenStream::new_direct(TokenStream::new(tokens))
}

// `span` is used for the `Attribute` and everything within it (except for any span within
Expand All @@ -794,7 +788,7 @@ pub fn mk_attr_word(g: &AttrIdGenerator, style: AttrStyle, name: Symbol, span: S

let tokens = Some(mk_attr_tokens(
style,
AttrTokenStream::new(vec![AttrTokenTree::Token(
TokenStream::new(vec![TokenTree::Token(
Token::from_ast_ident(Ident::new(name, span)),
Spacing::Alone,
)]),
Expand Down Expand Up @@ -833,13 +827,13 @@ pub fn mk_attr_nested_word(

let tokens = Some(mk_attr_tokens(
style,
AttrTokenStream::new(vec![
AttrTokenTree::Token(Token::from_ast_ident(Ident::new(outer, span)), Spacing::Alone),
AttrTokenTree::Delimited(
TokenStream::new(vec![
TokenTree::Token(Token::from_ast_ident(Ident::new(outer, span)), Spacing::Alone),
TokenTree::Delimited(
DelimSpan::from_single(span),
DelimSpacing::new(Spacing::JointHidden, Spacing::Alone),
Delimiter::Parenthesis,
AttrTokenStream::new(vec![AttrTokenTree::Token(
TokenStream::new(vec![TokenTree::Token(
Token::from_ast_ident(Ident::new(inner, span)),
Spacing::Alone,
)]),
Expand Down Expand Up @@ -879,10 +873,10 @@ pub fn mk_attr_name_value_str(

let tokens = Some(mk_attr_tokens(
style,
AttrTokenStream::new(vec![
AttrTokenTree::Token(Token::from_ast_ident(Ident::new(name, span)), Spacing::Alone),
AttrTokenTree::Token(Token::new(token::Eq, span), Spacing::Alone),
AttrTokenTree::Token(
TokenStream::new(vec![
TokenTree::Token(Token::from_ast_ident(Ident::new(name, span)), Spacing::Alone),
TokenTree::Token(Token::new(token::Eq, span), Spacing::Alone),
TokenTree::Token(
Token::new(token::TokenKind::lit(lit.kind, lit.symbol, lit.suffix), span),
Spacing::Alone,
),
Expand Down
Loading
Loading