Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
3e6a43d
allow `Allocator`s to be used as `#[global_allocator]`s
joboet May 29, 2026
46939fa
std: implement `GlobalAllocator` for `System`
joboet May 29, 2026
6c2e9d5
bless UI tests
joboet May 31, 2026
5042010
core: allow zero-size checks to be optimized out for `GlobalAllocator`
joboet Jun 21, 2026
9e4b398
Enable `static_position_executables` on all gnu and musl targets
Amanieu Jun 28, 2026
4d1093d
Do not inherit `ConstArgHasType` predicates when it is applied to con…
aerooneqq Jul 3, 2026
2d18054
tests: fix enum-match.rs to handle LLVM 23
durin42 Jul 6, 2026
6050294
Split unsafe fn ptr accesses into their own test
teor2345 Jul 1, 2026
0b6190f
Check arg errors then write splatted call info
teor2345 Jul 1, 2026
23eeafc
Avoid an unwrap using a u16 splat index
teor2345 Jul 1, 2026
1e3fca8
Remove a splat check arg only used for debugging
teor2345 Jul 1, 2026
baccb0c
Improve ICE diag for splatted FnPtrs
teor2345 Jul 1, 2026
6a68767
Ban splat on closures and rust-call
teor2345 Jul 1, 2026
9116f7d
Fix `unaligned_volatile_store` by removing `MemFlags::UNALIGNED`
scottmcm Jul 7, 2026
d20d049
Reword splat arg index limit error for clarity
teor2345 Jul 8, 2026
67986af
allow mGCA const arguments to fall back to anon consts
khyperia Jul 8, 2026
1818498
unify `MaxUniverse`s
adwinwhite Jul 6, 2026
fc267a6
Improve generic parameters handling for #[diagnostic::on_const]
rperier Jun 21, 2026
abc324c
Move `std::io::default_write_vectored` to `core::io`
bushrat011899 May 21, 2026
55585ea
Move `std::io::cursor`internals to `core::io`
bushrat011899 May 22, 2026
66f79f1
Move `WriteThroughCursor` internals to `alloc::io`
bushrat011899 Jul 3, 2026
ec0534f
Move `std::io::Write` to `core::io`
bushrat011899 Jul 3, 2026
4ecb0cd
Fix documentation links to `Write`
bushrat011899 May 22, 2026
53727e6
Add documentation to `core::io` internal methods
bushrat011899 Jul 7, 2026
0e61812
Reduce visibility of `core::io::write::default_write_fmt`
bushrat011899 Jul 7, 2026
cb09bff
Add `Vec::try_extend_from_slice_of_bytes`
bushrat011899 Jul 7, 2026
b8d3a4a
Reapply "LLVM 23: Run AssignGUIDPass in some places"
durin42 Jul 8, 2026
07ecc4b
Support `u128`/`i128` c-variadic arguments
folkertdev Apr 17, 2026
bd41781
c-variadic: add assembly test files
folkertdev Apr 25, 2026
c4e3ffd
c-variadic: fix i128 argument being misread on aarch64 msvc
folkertdev Jul 5, 2026
f64973c
c-variadic: fix i128 argument being misread on arm64ec
folkertdev Jul 5, 2026
47e62ee
Add a unit test for `TokenStreamIter`.
nnethercote Jul 8, 2026
fa43a69
Improve `TokenStreamIter`.
nnethercote Jul 8, 2026
7269b96
[compiler] Implement `PartialOrd` via `Ord` for `Span` and newtype_in…
scottmcm Jul 9, 2026
5e4558e
view-types: add a bunch of tests
scrabsha May 3, 2026
9ee193e
view-types: lower view types to HIR
scrabsha May 3, 2026
09b43e4
view-types: error when viewing the same field twice
scrabsha May 4, 2026
55ab4c7
view-types: error when used on non-struct types
scrabsha May 10, 2026
1390f89
view-types: resolve viewed fields
scrabsha May 4, 2026
77d7cf2
Implement feature `char_to_u32`
okaneco Apr 28, 2026
da925ef
Add documentation for the `no_std` attribute
jschillem Jul 9, 2026
79b7231
Use `as_lang_item` instead of repeatedly matching
oli-obk Jul 9, 2026
6c7e0bb
Rollup merge of #158510 - Amanieu:static-pie-gnu, r=saethlin
JonathanBrouwer Jul 9, 2026
e97519f
Rollup merge of #158541 - bushrat011899:core_io_write, r=clarfonthey
JonathanBrouwer Jul 9, 2026
d60d3c3
Rollup merge of #158899 - scottmcm:better-volatile-store, r=saethlin
JonathanBrouwer Jul 9, 2026
f8e52b4
Rollup merge of #155429 - folkertdev:c-variadic-i128, r=workingjubilee
JonathanBrouwer Jul 9, 2026
f476693
Rollup merge of #157153 - joboet:global_allocator, r=nia-e
JonathanBrouwer Jul 9, 2026
2974b2c
Rollup merge of #158617 - khyperia:gca-syntax-flip, r=BoxyUwU
JonathanBrouwer Jul 9, 2026
aa6ea68
Rollup merge of #158645 - teor2345:splat-fn-fixes, r=folkertdev
JonathanBrouwer Jul 9, 2026
6018ae0
Rollup merge of #158988 - nnethercote:redo-TokenStreamIter, r=chenyukang
JonathanBrouwer Jul 9, 2026
eb7ddec
Rollup merge of #158347 - rperier:diagnostic_on_const_format_argument…
JonathanBrouwer Jul 9, 2026
754d96b
Rollup merge of #158722 - aerooneqq:delegation-const-predicates-ice, …
JonathanBrouwer Jul 9, 2026
a06ecb4
Rollup merge of #158739 - scrabsha:view-types/resolve-fields, r=oli-obk
JonathanBrouwer Jul 9, 2026
76f9e12
Rollup merge of #158883 - durin42:llvm-23-instsimplify, r=nikic
JonathanBrouwer Jul 9, 2026
ce7f854
Rollup merge of #158886 - jschillem:docs-no-std-attribute, r=Guillaum…
JonathanBrouwer Jul 9, 2026
52d208b
Rollup merge of #158940 - okaneco:char_to_u32, r=hanna-kruppe
JonathanBrouwer Jul 9, 2026
7399171
Rollup merge of #158951 - adwinwhite:unify-max-universe, r=ShoyuVanilla
JonathanBrouwer Jul 9, 2026
b615c70
Rollup merge of #158961 - durin42:llvm-23-guid-pass-again, r=nikic
JonathanBrouwer Jul 9, 2026
6fd31f9
Rollup merge of #158996 - scottmcm:better-partial-cmp, r=folkertdev
JonathanBrouwer Jul 9, 2026
00be426
Rollup merge of #159005 - oli-obk:push-qsowtzonuyoz, r=lqd
JonathanBrouwer Jul 9, 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
19 changes: 9 additions & 10 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1378,15 +1378,6 @@ pub enum UnsafeSource {
UserProvided,
}

/// Track whether under `feature(min_generic_const_args)` this anon const
/// was explicitly disambiguated as an anon const or not through the use of
/// `const { ... }` syntax.
#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Copy, Walkable)]
pub enum MgcaDisambiguation {
AnonConst,
Direct,
}

/// A constant (expression) that's not an item or associated item,
/// but needs its own `DefId` for type-checking, const-eval, etc.
/// These are usually found nested inside types (e.g., array lengths)
Expand All @@ -1396,7 +1387,6 @@ pub enum MgcaDisambiguation {
pub struct AnonConst {
pub id: NodeId,
pub value: Box<Expr>,
pub mgca_disambiguation: MgcaDisambiguation,
}

/// An expression.
Expand Down Expand Up @@ -1627,6 +1617,7 @@ impl Expr {
| ExprKind::UnsafeBinderCast(..)
| ExprKind::While(..)
| ExprKind::Yield(YieldKind::Postfix(..))
| ExprKind::DirectConstArg(..)
| ExprKind::Err(_)
| ExprKind::Dummy => prefix_attrs_precedence(&self.attrs),
}
Expand Down Expand Up @@ -1920,6 +1911,9 @@ pub enum ExprKind {

UnsafeBinderCast(UnsafeBinderCastKind, Box<Expr>, Option<Box<Ty>>),

/// An mGCA `direct_const_arg!()` expression.
DirectConstArg(Box<Expr>),

/// Placeholder for an expression that wasn't syntactically well formed in some way.
Err(ErrorGuaranteed),

Expand Down Expand Up @@ -2566,6 +2560,8 @@ pub enum TyKind {
FieldOf(Box<Ty>, Option<Ident>, Ident),
/// A view of a type. `T.{ field_1, field_2 }`.
View(Box<Ty>, #[visitable(ignore)] ThinVec<Ident>),
/// An mGCA `direct_const_arg!()` expression.
DirectConstArg(Box<Expr>),
/// Sometimes we need a dummy value when no error has occurred.
Dummy,
/// Placeholder for a kind that has failed to be defined.
Expand Down Expand Up @@ -3066,6 +3062,9 @@ impl FnDecl {
/// Must have the same value as `FnSigKind::NO_SPLATTED_ARG_INDEX` and `FnDeclFlags::NO_SPLATTED_ARG_INDEX`.
pub const NO_SPLATTED_ARG_INDEX: u8 = u8::MAX;

/// The maximum valid splatted argument index.
pub const MAX_VALID_SPLATTED_ARG_INDEX: u8 = Self::NO_SPLATTED_ARG_INDEX - 1;

/// Returns a splatted argument index, if any are present.
pub fn splatted(&self) -> Option<u8> {
self.inputs.iter().enumerate().find_map(|(index, arg)| {
Expand Down
21 changes: 11 additions & 10 deletions compiler/rustc_ast/src/tokenstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ use crate::ast_traits::{HasAttrs, HasTokens};
use crate::token::{self, Delimiter, Token, TokenKind};
use crate::{AttrVec, Attribute};

#[cfg(test)]
mod tests;

/// Part of a `TokenStream`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Encodable, Decodable, StableHash)]
pub enum TokenTree {
Expand Down Expand Up @@ -833,32 +836,30 @@ impl StableHash for TokenStream {
}

#[derive(Clone)]
pub struct TokenStreamIter<'t> {
stream: &'t TokenStream,
index: usize,
}
pub struct TokenStreamIter<'t>(std::slice::Iter<'t, TokenTree>);

impl<'t> TokenStreamIter<'t> {
fn new(stream: &'t TokenStream) -> Self {
TokenStreamIter { stream, index: 0 }
TokenStreamIter(stream.0.as_slice().iter())
}

// Peeking could be done via `Peekable`, but most iterators need peeking,
// and this is simple and avoids the need to use `peekable` and `Peekable`
// at all the use sites.
pub fn peek(&self) -> Option<&'t TokenTree> {
self.stream.0.get(self.index)
self.0.as_slice().first()
}
}

impl<'t> Iterator for TokenStreamIter<'t> {
type Item = &'t TokenTree;

fn next(&mut self) -> Option<&'t TokenTree> {
self.stream.0.get(self.index).map(|tree| {
self.index += 1;
tree
})
self.0.next()
}

fn size_hint(&self) -> (usize, Option<usize>) {
self.0.size_hint()
}
}

Expand Down
13 changes: 13 additions & 0 deletions compiler/rustc_ast/src/tokenstream/tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use rustc_span::DUMMY_SP;

use crate::token::TokenKind;
use crate::tokenstream::TokenStream;

#[test]
fn test_token_stream_iter() {
let ts = TokenStream::token_alone(TokenKind::Eq, DUMMY_SP);
assert_eq!(ts.len(), 1);

let iter = ts.iter();
assert_eq!(iter.size_hint(), (1, Some(1)));
}
7 changes: 5 additions & 2 deletions compiler/rustc_ast/src/util/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ pub fn leading_labeled_expr(mut expr: &ast::Expr) -> bool {
| Yeet(..)
| Yield(..)
| UnsafeBinderCast(..)
| DirectConstArg(..)
| Err(..)
| Dummy => return false,
}
Expand Down Expand Up @@ -240,6 +241,7 @@ pub fn expr_trailing_brace(mut expr: &ast::Expr) -> Option<TrailingBrace<'_>> {
| Try(_)
| Yeet(None)
| UnsafeBinderCast(..)
| DirectConstArg(..)
| Err(_)
| Dummy => {
break None;
Expand Down Expand Up @@ -301,9 +303,10 @@ fn type_trailing_braced_mac_call(mut ty: &ast::Ty) -> Option<&ast::MacCall> {
| ast::TyKind::CVarArgs
| ast::TyKind::Pat(..)
| ast::TyKind::FieldOf(..)
| ast::TyKind::View(..)
| ast::TyKind::DirectConstArg(..)
| ast::TyKind::Dummy
| ast::TyKind::Err(..)
| ast::TyKind::View(..) => break None,
| ast::TyKind::Err(..) => break None,
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ macro_rules! common_visitor_and_walkers {
UnsafeBinderCastKind,
BinOpKind,
BlockCheckMode,
MgcaDisambiguation,
BorrowKind,
BoundAsyncness,
BoundConstness,
Expand Down Expand Up @@ -1074,6 +1073,8 @@ macro_rules! common_visitor_and_walkers {
visit_visitable!($($mut)? vis, bytes),
ExprKind::UnsafeBinderCast(kind, expr, ty) =>
visit_visitable!($($mut)? vis, kind, expr, ty),
ExprKind::DirectConstArg(expr) =>
visit_visitable!($($mut)? vis, expr),
ExprKind::Err(_guar) => {}
ExprKind::Dummy => {}
}
Expand Down
18 changes: 13 additions & 5 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,18 @@ impl<'hir> LoweringContext<'_, 'hir> {
}

ExprKind::MacCall(_) => panic!("{:?} shouldn't exist here", e.span),

ExprKind::DirectConstArg(_) => {
let e = self
.tcx
.dcx()
.struct_span_err(
e.span,
"expected expression, found `direct_const_arg!()` constant",
)
.emit();
hir::ExprKind::Err(e)
}
};

hir::Expr { hir_id: expr_hir_id, kind, span }
Expand Down Expand Up @@ -599,11 +611,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
arg
};

let anon_const = AnonConst {
id: node_id,
value: const_value,
mgca_disambiguation: MgcaDisambiguation::AnonConst,
};
let anon_const = AnonConst { id: node_id, value: const_value };
generic_args.push(AngleBracketedArg::Arg(GenericArg::Const(anon_const)));
} else {
real_args.push(arg);
Expand Down
Loading
Loading