Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3e034b3
rustc: Tweak the effect of `--jobs` on frontend parallelism
petrochenkov Aug 7, 2026
2f9fea1
Constify more Iterator functions
Randl Jun 20, 2026
7b633cc
implement const Iterator for Range
Randl Jun 20, 2026
0ce5394
Revert some const hacks
Randl Jun 20, 2026
8179204
Fix tests
Randl Jun 20, 2026
1b8478a
yeet DeepRegionResolver
jdonszelmann Sep 14, 2026
521c4eb
Improve `build_reduced_graph_for_use_tree` arguments
nnethercote Sep 2, 2026
605149c
Remove an out-of-date comment
nnethercote Sep 2, 2026
ac9666f
Add regression test for malformed RPITIT bound ICE with the new solver
zakrad Sep 15, 2026
e251a4b
wasm: return early on f128/i128
folkertdev Sep 15, 2026
9d60f86
rename `unwrap_trivial_aggregate` -> `is_aggregate_for_abi`
folkertdev Sep 15, 2026
2c9ec83
Stop building unused libompdevice code
ZuseZ4 Aug 19, 2026
d5a0a16
Remove LLVM_CONFIG_REAL variables
ZuseZ4 Aug 22, 2026
9dcbee9
add `RegKind::from_primitive`
folkertdev Sep 15, 2026
2b72820
add `TyAbiInterface::is_enum`
folkertdev Sep 15, 2026
8aff3e6
wasm: fix ABI of `repr(int)` enums with ZST fields
folkertdev Sep 15, 2026
8420bbd
[rustc_pub] Expand PassMode::Cast with CastTarget
celinval Sep 15, 2026
5a1bf7f
Replace Opaque with ArgAttributes in PassMode
celinval Sep 15, 2026
bd13c1d
Rename ValueAbi to ValueRepr and fix abi docs
celinval Sep 15, 2026
0be3388
Avoid an intermediate vec when ref-decoding to `&'tcx [T]`
Zalathar Sep 16, 2026
3c74470
Remove some unused Decodable and RefDecodable impls
Zalathar Sep 16, 2026
8838b56
Migrate some RefDecodable impls to `impl_ref_decodable_into_arena!`
Zalathar Sep 16, 2026
82a24f2
Move RefDecodable and related impls into a submodule
Zalathar Sep 16, 2026
b993427
Miscellaneous tidying in `ref_decodable`
Zalathar Sep 16, 2026
a87b213
Consolidate the via-RefDecodable impls in `on_disk_cache`
Zalathar Sep 16, 2026
8dd9b9a
Remove an unused via-RefDecodable impl in rmeta decoding
Zalathar Sep 16, 2026
e8c03ab
Add a `#[diagnostic::on_unimplemented(..)]` hint to RefDecodable
Zalathar Sep 16, 2026
a3db66c
Remove the decoder type-param from RefDecodable
Zalathar Sep 16, 2026
0c12d6f
Remove redundant test
Randl Sep 16, 2026
4bfe145
Introduce `ast::UseTreeAndId`
nnethercote Sep 16, 2026
3f8e2bf
Enable LLVM Thin LTO for LoongArch64
heiher Sep 8, 2026
a705949
Rollup merge of #156216 - Randl:const-for-impl, r=clarfonthey
Zalathar Sep 16, 2026
75721d1
Rollup merge of #160697 - petrochenkov:jobtweak, r=bjorn3
Zalathar Sep 16, 2026
85e6f30
Rollup merge of #162748 - heiher:loong64-llvm-clang-thin-lto, r=jieyouxu
Zalathar Sep 16, 2026
7717522
Rollup merge of #162769 - jdonszelmann:yeet-opportunistic-region-reso…
Zalathar Sep 16, 2026
9d7b74c
Rollup merge of #162794 - nnethercote:simplify-UseTreeKind, r=petroch…
Zalathar Sep 16, 2026
edb6c7b
Rollup merge of #162800 - Zalathar:ref-decodable, r=nnethercote
Zalathar Sep 16, 2026
f6b5137
Rollup merge of #162826 - folkertdev:wasm-int-enum-abi, r=alexcrichton
Zalathar Sep 16, 2026
124a208
Rollup merge of #159359 - celinval:feat/cast-passmode, r=makai410
Zalathar Sep 16, 2026
9fbeaa4
Rollup merge of #162196 - ZuseZ4:offload-cmake-cleanups, r=Kobzol
Zalathar Sep 16, 2026
6f81ec1
Rollup merge of #162818 - zakrad:regr-test-156100, r=petrochenkov
Zalathar Sep 16, 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
9 changes: 9 additions & 0 deletions compiler/rustc_abi/src/callconv/reg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ pub enum RegKind {
},
}

impl RegKind {
pub fn from_primitive(primitive: Primitive) -> Self {
match primitive {
Primitive::Int(..) | Primitive::Pointer(_) => RegKind::Integer,
Primitive::Float(_) => RegKind::Float,
}
}
}

#[cfg_attr(feature = "nightly", derive(StableHash))]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct Reg {
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_abi/src/layout/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pub trait TyAbiInterface<'a, C>: Sized + std::fmt::Debug + std::fmt::Display {
offset: Size,
) -> Option<PointeeInfo>;
fn is_adt(this: TyAndLayout<'a, Self>) -> bool;
fn is_enum(this: TyAndLayout<'a, Self>) -> bool;
fn is_never(this: TyAndLayout<'a, Self>) -> bool;
fn is_tuple(this: TyAndLayout<'a, Self>) -> bool;
fn is_unit(this: TyAndLayout<'a, Self>) -> bool;
Expand Down Expand Up @@ -200,6 +201,13 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
Ty::is_adt(self)
}

pub fn is_enum<C>(self) -> bool
where
Ty: TyAbiInterface<'a, C>,
{
Ty::is_enum(self)
}

pub fn is_never<C>(self) -> bool
where
Ty: TyAbiInterface<'a, C>,
Expand Down
10 changes: 8 additions & 2 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3336,13 +3336,12 @@ pub enum UseTreeKind {
/// use foo::{bar, baz};
/// ^^^^^^^^^^
/// ```
Nested { items: ThinVec<(UseTree, NodeId)>, span: Span },
Nested { items: ThinVec<UseTreeAndId>, span: Span },
/// `use prefix::*`
Glob(Span),
}

/// A tree of paths sharing common prefixes.
/// Used in `use` items both at top-level and inside of braces in import groups.
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub struct UseTree {
pub prefix: Path,
Expand Down Expand Up @@ -3384,6 +3383,13 @@ impl UseTree {
}
}

/// Used in nested `use` trees.
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub struct UseTreeAndId {
pub inner: UseTree,
pub id: NodeId,
}

/// Distinguishes between `Attribute`s that decorate items and Attributes that
/// are contained as statements within items. These two cases need to be
/// distinguished for pretty-printing.
Expand Down
18 changes: 2 additions & 16 deletions compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ macro_rules! for_each_ast_visit_hook {
visit_mac_call(MacCall) => walk_mac;
visit_macro_def(MacroDef) => walk_macro_def;
visit_mut_restriction(MutRestriction) => walk_mut_restriction;
//visit_nested_use_tree((UseTree, NodeId)) => walk_nested_use_tree;
visit_param(Param) => walk_param;
visit_param_bound(GenericBound, _ctxt: BoundKind) => walk_param_bound;
visit_pat(Pat) => walk_pat;
Expand All @@ -368,6 +367,7 @@ macro_rules! for_each_ast_visit_hook {
visit_ty(Ty) => walk_ty;
visit_ty_pat(TyPat) => walk_ty_pat;
visit_use_tree(UseTree) => walk_use_tree;
visit_use_tree_and_id(UseTreeAndId) => walk_use_tree_and_id;
visit_variant(Variant) => walk_variant;
visit_variant_data(VariantData) => walk_variant_data;
visit_vis(Visibility) => walk_vis;
Expand Down Expand Up @@ -477,6 +477,7 @@ macro_rules! common_visitor_and_walkers {
ThinVec<TestBinderExists>,
ThinVec<TestBinderForall>,
ThinVec<TyPat>,
ThinVec<UseTreeAndId>,
// tidy-alphabetical-end
}

Expand Down Expand Up @@ -681,13 +682,6 @@ macro_rules! common_visitor_and_walkers {
fn visit_stmt(&mut self, s: &$lt Stmt) -> Self::Result {
walk_stmt(self, s)
}

fn visit_nested_use_tree(&mut self, use_tree: &$lt UseTree, id: NodeId)
-> Self::Result
{
try_visit!(self.visit_id(id));
self.visit_use_tree(use_tree)
}
)?

// `MutVisitor`-only methods
Expand Down Expand Up @@ -812,14 +806,6 @@ macro_rules! common_visitor_and_walkers {
) -> V::Result;
}

$(impl_visitable!(|&$lt self: ThinVec<(UseTree, NodeId)>, vis: &mut V| {
for (nested_tree, nested_id) in self {
try_visit!(vis.visit_nested_use_tree(nested_tree, *nested_id));
}
V::Result::output()
});)?
$(${ignore($mut)} impl_visitable_list!(ThinVec<(UseTree, NodeId)>,);)?

fn walk_item_inner<$($lt,)? K: WalkItemKind, V: $Visitor$(<$lt>)?>(
visitor: &mut V,
item: &$($lt)? $($mut)? Item<K>,
Expand Down
8 changes: 5 additions & 3 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
let prefix = Path { segments, span };

// Add all the nested `PathListItem`s to the HIR.
for &(ref use_tree, id) in trees {
for use_tree in trees {
let id = use_tree.id;
let owner_id = self.owner_id(id);

// Each `use` import is an item and thus are owners of the
Expand All @@ -691,7 +692,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
// `prefix` is lowered multiple times, but in different HIR owners.
// So each segment gets renewed `HirId` with the same
// `ItemLocalId` and the new owner. (See `lower_node_id`)
let kind = this.lower_use_tree(use_tree, &prefix, id, vis_span, attrs);
let kind =
this.lower_use_tree(&use_tree.inner, &prefix, id, vis_span, attrs);
if !attrs.is_empty() {
this.curr_owner.attrs.insert(hir::ItemLocalId::ZERO, attrs);
}
Expand All @@ -700,7 +702,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
owner_id,
kind,
vis_span,
span: this.lower_span(use_tree.span()),
span: this.lower_span(use_tree.inner.span()),
eii: find_attr!(attrs, EiiImpl(..) | EiiDeclaration(..)),
};
hir::OwnerNode::Item(this.arena.alloc(item))
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,12 +673,13 @@ fn index_ast<'tcx>(
match tree.kind {
UseTreeKind::Glob(_) | UseTreeKind::Simple(_) => {}
UseTreeKind::Nested { items: ref nested_vec, span } => {
for &(ref nested, id) in nested_vec {
for nested in nested_vec {
let id = nested.id;
self.insert(id, AstOwner::NestedUseTree(parent));
items.push(self.make_dummy(id, span, ItemKind::MacCall));

let def_id = self.owners[&id].def_id;
self.visit_item_id_use_tree(nested, def_id, items);
self.visit_item_id_use_tree(&nested.inner, def_id, items);
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions compiler/rustc_ast_pretty/src/pprust/state/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,25 +911,26 @@ impl<'a> State<'a> {
}
if items.is_empty() {
self.word("{}");
} else if let [(item, _)] = items.as_slice()
} else if let [item] = items.as_slice()
&& !item
.inner
.prefix
.segments
.first()
.is_some_and(|seg| seg.ident.name == rustc_span::symbol::kw::SelfLower)
{
self.print_use_tree(item);
self.print_use_tree(&item.inner);
} else {
let cb = self.cbox(INDENT_UNIT);
self.word("{");
self.zerobreak();
let ib = self.ibox(0);
for (idx, use_tree) in items.iter().enumerate() {
let is_last = idx == items.len() - 1;
self.print_use_tree(&use_tree.0);
self.print_use_tree(&use_tree.inner);
if !is_last {
self.word(",");
if let ast::UseTreeKind::Nested { .. } = use_tree.0.kind {
if let ast::UseTreeKind::Nested { .. } = use_tree.inner.kind {
self.hardbreak();
} else {
self.space();
Expand Down
16 changes: 7 additions & 9 deletions compiler/rustc_builtin_macros/src/assert/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rustc_ast::token::{self, Delimiter, IdentIsRaw};
use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree};
use rustc_ast::{
BinOpKind, BorrowKind, DUMMY_NODE_ID, DelimArgs, Expr, ExprKind, ItemKind, MacCall, MethodCall,
Mutability, Path, PathSegment, Stmt, StructRest, UnOp, UseTree, UseTreeKind,
Mutability, Path, PathSegment, Stmt, StructRest, UnOp, UseTree, UseTreeAndId, UseTreeKind,
};
use rustc_ast_pretty::pprust;
use rustc_data_structures::fx::FxHashSet;
Expand Down Expand Up @@ -97,14 +97,12 @@ impl<'cx, 'a> Context<'cx, 'a> {
///
/// use ::core::asserting::{ ... };
fn build_initial_imports(&self) -> Stmt {
let nested_tree = |this: &Self, sym| {
(
UseTree {
prefix: this.cx.path(this.span, vec![Ident::with_dummy_span(sym)]),
kind: UseTreeKind::Simple(None),
},
DUMMY_NODE_ID,
)
let nested_tree = |this: &Self, sym| UseTreeAndId {
inner: UseTree {
prefix: this.cx.path(this.span, vec![Ident::with_dummy_span(sym)]),
kind: UseTreeKind::Simple(None),
},
id: DUMMY_NODE_ID,
};
self.cx.stmt_item(
self.span,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,8 +1463,8 @@ impl DeclaredIdents for Box<ast::Item> {
ast::UseTreeKind::Glob(_) => {}
ast::UseTreeKind::Simple(_) => idents.push(ut.ident()),
ast::UseTreeKind::Nested { items, .. } => {
for (ut, _) in items {
collect_use_tree_leaves(ut, idents);
for tree in items {
collect_use_tree_leaves(&tree.inner, idents);
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,20 @@ impl<'tcx> InferCtxt<'tcx> {
value.fold_with(&mut r)
}

/// Where possible, replaces type/const/region variables in `value` with their final value.
/// If a type/const/region variable has not (yet) been unified, it is left as is.
///
/// This is an idempotent operation that does not affect inference state in any way,
/// which means it's safe to call this function at will.
pub fn deeply_resolve_via_unification_table<T>(&self, value: T) -> T
where
T: TypeFoldable<TyCtxt<'tcx>>,
{
use rustc_middle::ty::InferCtxtLike;
#[allow(rustc::usage_of_type_ir_traits)]
InferCtxtLike::deeply_resolve_via_unification_table(self, value)
}

pub fn resolve_numeric_literals_with_default<T>(&self, value: T) -> T
where
T: TypeFoldable<TyCtxt<'tcx>>,
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_infer/src/infer/outlives/obligations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ impl<'tcx> InferCtxt<'tcx> {
/// right before lexical region resolution.
#[instrument(level = "debug", skip(self, outlives_env))]
pub fn process_registered_region_obligations(&self, outlives_env: &OutlivesEnvironment<'tcx>) {
use rustc_type_ir::InferCtxtLike;
assert!(!self.in_snapshot(), "cannot process registered region obligations in a snapshot");

if self.tcx.assumptions_on_binders() {
Expand Down
51 changes: 0 additions & 51 deletions compiler/rustc_infer/src/infer/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,57 +67,6 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for DeepResolverIgnoringRegions<'a, 'tcx
}
}

/// The region resolver resolves region variables to the variable with the
/// least variable id. It is used when normalizing projections to avoid
/// hitting the recursion limit by creating many versions of a predicate
/// for types that in the end have to unify.
///
/// If you want to resolve type and const variables as well, call
/// [InferCtxt::deeply_resolve_ignoring_regions] first.
pub struct DeepRegionResolver<'a, 'tcx> {
infcx: &'a InferCtxt<'tcx>,
}

impl<'a, 'tcx> DeepRegionResolver<'a, 'tcx> {
pub fn new(infcx: &'a InferCtxt<'tcx>) -> Self {
DeepRegionResolver { infcx }
}
}

impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for DeepRegionResolver<'a, 'tcx> {
fn cx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
if !t.has_infer_regions() {
t // micro-optimize -- if there is nothing in this type that this fold affects...
} else {
t.super_fold_with(self)
}
}

fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
match r.kind() {
ty::ReVar(vid) => self
.infcx
.inner
.borrow_mut()
.unwrap_region_constraints()
.shallow_resolve_region_var(TypeFolder::cx(self), vid),
_ => r,
}
}

fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
if !ct.has_infer_regions() {
ct // micro-optimize -- if there is nothing in this const that this fold affects...
} else {
ct.super_fold_with(self)
}
}
}

///////////////////////////////////////////////////////////////////////////
// FULL TYPE RESOLUTION

Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_lint/src/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1318,17 +1318,17 @@ impl UnusedImportBraces {
fn check_use_tree(&self, cx: &EarlyContext<'_>, use_tree: &ast::UseTree, item: &ast::Item) {
if let ast::UseTreeKind::Nested { ref items, .. } = use_tree.kind {
// Recursively check nested UseTrees
for (tree, _) in items {
self.check_use_tree(cx, tree, item);
for tree in items {
self.check_use_tree(cx, &tree.inner, item);
}

// Trigger the lint only if there is one nested item
let [(tree, _)] = items.as_slice() else { return };
let [tree] = items.as_slice() else { return };

// Trigger the lint if the nested item is a non-self single item
let node_name = match tree.kind {
let node_name = match tree.inner.kind {
ast::UseTreeKind::Simple(rename) => {
let orig_ident = tree.prefix.segments.last().unwrap().ident;
let orig_ident = tree.inner.prefix.segments.last().unwrap().ident;
if orig_ident.name == kw::SelfLower {
return;
}
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_metadata/src/rmeta/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,12 +667,6 @@ impl<'a, 'tcx> Decodable<MetadataDecodeContext<'a, 'tcx>> for SpanData {
}
}

impl<'a, 'tcx> Decodable<MetadataDecodeContext<'a, 'tcx>> for &'tcx [(ty::Clause<'tcx>, Span)] {
fn decode(d: &mut MetadataDecodeContext<'a, 'tcx>) -> Self {
ty::codec::RefDecodable::decode(d)
}
}

impl<D: LazyDecoder, T> Decodable<D> for LazyValue<T> {
fn decode(decoder: &mut D) -> Self {
decoder.read_lazy()
Expand Down
Loading
Loading