Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
32aecb0
Represent live alias arguments as bitsets
Dnreikronos Aug 11, 2026
9d3a26d
Use DenseBitSet<u32> for live alias args
Dnreikronos Aug 12, 2026
c4f07b8
Use filled bitsets for alias liveness restrictions
Dnreikronos Aug 16, 2026
3e5c0fa
std::sys::pal::sgx: fix mismatched alloc/free alignment
phlip9 Aug 27, 2026
be0994f
fix-incorrect-meta-span
bb1yd Sep 3, 2026
aea90f1
Implement `Rng` for `Box`
a1phyr Sep 2, 2026
dc3b394
std: fix typo
xtqqczze Sep 3, 2026
b1e1bc9
bootstrap: use target's LLVM libdir when cross-compiling
heiher Sep 2, 2026
1545557
Introduce `rustc_middle::middel::resolve`
nnethercote Sep 3, 2026
b61efec
type system const items via direct rhs
khyperia Sep 4, 2026
380e552
Extract most of `tool_doc!` into non-macro code
Zalathar Sep 4, 2026
8f1843d
Include feature-gated items in bootstrap tool docs
Zalathar Aug 28, 2026
2a2b4c6
box: fixup map/try_map deallocate calls
nia-e Sep 4, 2026
309c47a
Implementation change for removing RegionExt
Jamesbarford Aug 10, 2026
f3cf30d
update imports and method signature changes
Jamesbarford Aug 10, 2026
b1a9fca
alloc: a bunch of safety comments
nia-e Sep 4, 2026
6cbd82c
Add regression test from 1.98.1
theemathas Sep 4, 2026
1c48bd6
review
nia-e Sep 4, 2026
e578090
typo
nia-e Sep 4, 2026
115200e
Rollup merge of #162170 - heiher:fix-llvm-libdir, r=Kobzol
JonathanBrouwer Sep 4, 2026
8f41ed2
Rollup merge of #161895 - phlip9:phlip9/fix-sgx-alloc-align, r=JohnTitor
JonathanBrouwer Sep 4, 2026
270d0fe
Rollup merge of #161900 - Zalathar:tool-doc, r=Kobzol
JonathanBrouwer Sep 4, 2026
b4e8274
Rollup merge of #162179 - khyperia:direct-rhs-const, r=BoxyUwU
JonathanBrouwer Sep 4, 2026
27152bb
Rollup merge of #162277 - nnethercote:rustc_middle-resolution, r=petr…
JonathanBrouwer Sep 4, 2026
0761508
Rollup merge of #162285 - nia-e:box-map-zst, r=JohnTitor
JonathanBrouwer Sep 4, 2026
bdd3148
Rollup merge of #162289 - nia-e:alloc-safety-comments-part-2, r=Darksonn
JonathanBrouwer Sep 4, 2026
836d4e3
Rollup merge of #160509 - Jamesbarford:chore/shrink-region-ext-triats…
JonathanBrouwer Sep 4, 2026
ebce902
Rollup merge of #160936 - Dnreikronos:traits/live_args_bitset, r=lcnr…
JonathanBrouwer Sep 4, 2026
dfa491a
Rollup merge of #162212 - a1phyr:box_random, r=joboet
JonathanBrouwer Sep 4, 2026
4dfe838
Rollup merge of #162246 - bb1yd:fix-incorrect-meta-span, r=nnethercote
JonathanBrouwer Sep 4, 2026
5959075
Rollup merge of #162266 - xtqqczze:typo-desceriptor, r=JohnTitor
JonathanBrouwer Sep 4, 2026
9190ac1
Rollup merge of #162291 - theemathas:add-1.98.1-test, r=lqd
JonathanBrouwer Sep 4, 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
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4909,6 +4909,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_lint_defs",
"rustc_macros",
Expand Down
19 changes: 0 additions & 19 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use rustc_data_structures::stable_hash::{StableHash, StableHashCtxt, StableHashe
use rustc_data_structures::tagged_ptr::Tag;
use rustc_macros::{Decodable, Encodable, StableHash, Walkable};
pub use rustc_span::AttrId;
use rustc_span::def_id::LocalDefId;
use rustc_span::{
ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, LocalExpnId, Span, Spanned, Symbol, kw, respan,
sym,
Expand Down Expand Up @@ -4445,24 +4444,6 @@ impl TryFrom<ItemKind> for ForeignItemKind {
}

pub type ForeignItem = Item<ForeignItemKind>;

/// Fragment of the AST according to "HIR owner" semantics.
///
/// This is used to map each `LocalDefId` to its content's AST.
#[derive(Debug)]
pub enum AstOwner {
/// This definition does not correspond to a HIR owner.
NonOwner,
/// This definition corresponds to a nested `use` tree.
/// The `LocalDefId` points to its HIR owner.
NestedUseTree(LocalDefId),
Crate(Box<Crate>),
Item(Box<Item>),
TraitItem(Box<AssocItem>),
ImplItem(Box<AssocItem>),
ForeignItem(Box<ForeignItem>),
}

// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(target_pointer_width = "64")]
mod size_asserts {
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ use rustc_hir::{
self as hir, CRATE_OWNER_ID, HirId, ImplItemImplKind, LifetimeSource, PredicateOrigin, Target,
find_attr,
};
use rustc_middle::middle::resolve::ResolverAstLowering;
use rustc_middle::span_bug;
use rustc_middle::ty::TyCtxt;
use rustc_middle::ty::data_structures::IndexMap;
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
use rustc_span::def_id::{DefId, LocalDefId};
use rustc_span::edit_distance::find_best_match_for_name;
use rustc_span::{DUMMY_SP, DesugaringKind, Ident, Span, Symbol, kw, sym};
Expand Down
55 changes: 40 additions & 15 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use rustc_data_structures::unord::ExtendUnord;
use rustc_errors::codes::*;
use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle, ErrorGuaranteed};
use rustc_hir::attrs::lang_items::LangItem;
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
use rustc_hir::def::{DefKind, Namespace, PerNS, Res};
use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId, LocalDefIdMap};
use rustc_hir::definitions::PerParentDisambiguatorState;
use rustc_hir::lints::DelayedLint;
Expand All @@ -65,9 +65,12 @@ use rustc_hir::{
};
use rustc_index::{Idx, IndexVec};
use rustc_macros::extension;
use rustc_middle::middle::resolve::{
AstOwner, LifetimeRes, PartialRes, PerOwnerResolverData, ResolverAstLowering,
};
use rustc_middle::queries::Providers;
use rustc_middle::span_bug;
use rustc_middle::ty::{PerOwnerResolverData, ResolverAstLowering, TyCtxt};
use rustc_middle::ty::TyCtxt;
use rustc_session::diagnostics::add_feature_diagnostics;
use rustc_span::symbol::{Ident, Symbol, kw, sym};
use rustc_span::{DUMMY_SP, DesugaringKind, Span};
Expand Down Expand Up @@ -2672,19 +2675,41 @@ impl<'hir> LoweringContext<'_, 'hir> {
) -> hir::ConstItemRhs<'hir> {
match (body, kind) {
(body, ConstItemKind::Body) => {
hir::ConstItemRhs::Body(self.lower_const_body(span, body.as_deref()))
}
(Some(body), ConstItemKind::TypeConst) => {
hir::ConstItemRhs::TypeConst(self.arena.alloc(
match self.can_lower_expr_to_const_arg_direct(
&body,
DirectConstArgContext::MacrolessMinGenericConstArgs,
) {
Ok(()) => self.lower_expr_to_const_arg_direct(&body, None),
Err(err) => err.emit(self),
},
))
let is_direct = |body| {
if self.tcx.features().macroless_generic_const_args() {
self.can_lower_expr_to_const_arg_direct(
body,
DirectConstArgContext::MacrolessMinGenericConstArgs,
)
.is_ok()
} else {
// do not check can_lower_expr_to_const_arg_direct, but rather just
// ExprKind::DirectConstArg, because we don't want e.g.
// `impl<const N: u8> { const C: u8 = N; }` to be a direct-rhs const
matches!(body, Expr { kind: ExprKind::DirectConstArg(_), .. })
}
};
// N.B.: the feature gate for this is generic_const_args, not min_generic_const_args
if self.tcx.features().generic_const_args()
&& let Some(body) = body
&& is_direct(body)
{
hir::ConstItemRhs::Direct(
self.arena.alloc(self.lower_expr_to_const_arg_direct(&body, None)),
)
} else {
hir::ConstItemRhs::Body(self.lower_const_body(span, body.as_deref()))
}
}
(Some(body), ConstItemKind::TypeConst) => hir::ConstItemRhs::Direct(self.arena.alloc(
match self.can_lower_expr_to_const_arg_direct(
&body,
DirectConstArgContext::MacrolessMinGenericConstArgs,
) {
Ok(()) => self.lower_expr_to_const_arg_direct(&body, None),
Err(err) => err.emit(self),
},
)),
(None, ConstItemKind::TypeConst) => {
let const_arg = ConstArg {
hir_id: self.next_id(),
Expand All @@ -2693,7 +2718,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
),
span: DUMMY_SP,
};
hir::ConstItemRhs::TypeConst(self.arena.alloc(const_arg))
hir::ConstItemRhs::Direct(self.arena.alloc(const_arg))
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ast_lowering/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use std::sync::Arc;

use rustc_ast::{self as ast, *};
use rustc_errors::StashKey;
use rustc_hir::def::{DefKind, PartialRes, PerNS, Res};
use rustc_hir::def::{DefKind, PerNS, Res};
use rustc_hir::def_id::DefId;
use rustc_hir::{self as hir, GenericArg};
use rustc_middle::middle::resolve::PartialRes;
use rustc_middle::{span_bug, ty};
use rustc_session::diagnostics::add_feature_diagnostics;
use rustc_span::{BytePos, DUMMY_SP, DesugaringKind, Ident, Span, Symbol, sym};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rustc_infer::traits::query::{
};
use rustc_middle::ty::error::TypeError;
use rustc_middle::ty::{
self, RePlaceholder, Region, RegionExt, RegionVid, Ty, TyCtxt, TypeFoldable, UniverseIndex,
self, RePlaceholder, Region, RegionVid, Ty, TyCtxt, TypeFoldable, UniverseIndex,
};
use rustc_span::Span;
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use rustc_middle::mir::{
};
use rustc_middle::ty::print::PrintTraitRefExt as _;
use rustc_middle::ty::{
self, PredicateKind, RegionExt, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor, Upcast,
self, PredicateKind, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor, Upcast,
suggest_constraining_type_params,
};
use rustc_mir_dataflow::move_paths::{Init, InitKind, InitLocation, MoveOutIndex, MovePathIndex};
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use rustc_middle::bug;
use rustc_middle::hir::place::PlaceBase;
use rustc_middle::mir::{AnnotationSource, ConstraintCategory, ReturnConstraint};
use rustc_middle::ty::{
self, GenericArgs, Region, RegionExt, RegionVid, Ty, TyCtxt, TypeFoldable, TypeVisitor,
fold_regions,
self, GenericArgs, Region, RegionVid, Ty, TyCtxt, TypeFoldable, TypeVisitor, fold_regions,
};
use rustc_span::{Ident, Span, kw};
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/nll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rustc_index::IndexSlice;
use rustc_middle::mir::pretty::PrettyPrintMirOptions;
use rustc_middle::mir::{Body, MirDumper, PassWhere, Promoted};
use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::{self, RegionExt, TyCtxt};
use rustc_middle::ty::{self, TyCtxt};
use rustc_mir_dataflow::move_paths::MoveData;
use rustc_mir_dataflow::points::DenseLocationMap;
use rustc_session::config::MirIncludeSpans;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/polonius/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
use rustc_index::IndexVec;
use rustc_middle::mir::pretty::{MirDumper, PassWhere, PrettyPrintMirOptions};
use rustc_middle::mir::{Body, Location};
use rustc_middle::ty::{RegionExt, RegionVid, TyCtxt};
use rustc_middle::ty::{RegionVid, TyCtxt};
use rustc_mir_dataflow::points::PointIndex;
use rustc_session::config::MirIncludeSpans;

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/region_infer/graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::io::{self, Write};

use itertools::Itertools;
use rustc_graphviz as dot;
use rustc_middle::ty::{RegionExt, UniverseIndex};
use rustc_middle::ty::UniverseIndex;

use super::*;

Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_borrowck/src/region_infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ use rustc_middle::mir::{
TerminatorKind,
};
use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
use rustc_middle::ty::{
self, RegionExt, RegionVid, Ty, TyCtxt, TypeFoldable, UniverseIndex, fold_regions,
};
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, UniverseIndex, fold_regions};
use rustc_mir_dataflow::points::DenseLocationMap;
use rustc_span::hygiene::DesugaringKind;
use rustc_span::{DUMMY_SP, Span};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_macros::extension;
use rustc_middle::mir::{Body, ConstraintCategory};
use rustc_middle::ty::{
self, DefiningScopeKind, DefinitionSiteHiddenType, FallibleTypeFolder, Flags, GenericArg,
GenericArgsRef, OpaqueTypeKey, ProvisionalHiddenType, Region, RegionExt, RegionVid, Ty, TyCtxt,
GenericArgsRef, OpaqueTypeKey, ProvisionalHiddenType, Region, RegionVid, Ty, TyCtxt,
TypeFoldable, TypeSuperFoldable, TypeVisitableExt, Unnormalized, fold_regions,
};
use rustc_mir_dataflow::points::DenseLocationMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use rustc_infer::infer::outlives::env::RegionBoundPairs;
use rustc_infer::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate};
use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
use rustc_middle::ty::{
self, GenericArgKind, RegionExt, TyCtxt, TypeFoldable, TypeVisitableExt, elaborate,
fold_regions,
self, GenericArgKind, TyCtxt, TypeFoldable, TypeVisitableExt, elaborate, fold_regions,
};
use rustc_span::Span;
use tracing::{debug, instrument};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/universal_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use rustc_middle::mir::RETURN_PLACE;
use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::{
self, BoundVariableKind, GenericArgs, GenericArgsRef, InlineConstArgs, InlineConstArgsParts,
List, RegionExt, RegionVid, Ty, TyCtxt, TypeFoldable, TypeVisitableExt, fold_regions,
List, RegionVid, Ty, TyCtxt, TypeFoldable, TypeVisitableExt, fold_regions,
};
use rustc_middle::{bug, span_bug};
use rustc_span::{ErrorGuaranteed, kw, sym};
Expand Down
11 changes: 9 additions & 2 deletions compiler/rustc_const_eval/src/const_eval/eval_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,15 @@ fn eval_in_interpreter<'tcx, R: InterpretationResult<'tcx>>(
typing_env: ty::TypingEnv<'tcx>,
) -> Result<R, ErrorHandled> {
let def = cid.instance.def.def_id();
// `type const` don't have bodys
debug_assert!(!tcx.is_type_const(def), "CTFE tried to evaluate type-const: {:?}", def);
// directly represented consts don't have bodies
if cfg!(debug_assertions)
&& matches!(tcx.def_kind(def), DefKind::Const { .. } | DefKind::AssocConst { .. })
{
debug_assert!(
tcx.const_of_item(def).is_none(),
"CTFE tried to evaluate directly represented const item: {def:?}"
);
}

let is_static = tcx.is_static(def);
let mut ecx = InterpCx::new(
Expand Down
100 changes: 1 addition & 99 deletions compiler/rustc_hir/src/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ use std::fmt::Debug;

use rustc_ast as ast;
use rustc_ast::NodeId;
use rustc_data_structures::fx::FxIndexMap;
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
use rustc_hir_id::HirId;
use rustc_macros::{Decodable, Encodable, StableHash};
use rustc_span::Symbol;
use rustc_span::def_id::{DefId, LocalDefId};
use rustc_span::def_id::DefId;
use rustc_span::hygiene::MacroKind;

use crate as hir;
Expand Down Expand Up @@ -587,63 +586,6 @@ impl<Id> IntoDiagArg for Res<Id> {
}
}

/// The result of resolving a path before lowering to HIR,
/// with "module" segments resolved and associated item
/// segments deferred to type checking.
/// `base_res` is the resolution of the resolved part of the
/// path, `unresolved_segments` is the number of unresolved
/// segments.
///
/// ```text
/// module::Type::AssocX::AssocY::MethodOrAssocType
/// ^~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// base_res unresolved_segments = 3
///
/// <T as Trait>::AssocX::AssocY::MethodOrAssocType
/// ^~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
/// base_res unresolved_segments = 2
/// ```
#[derive(Copy, Clone, Debug)]
pub struct PartialRes {
base_res: Res<NodeId>,
unresolved_segments: usize,
}

impl PartialRes {
#[inline]
pub fn new(base_res: Res<NodeId>) -> Self {
PartialRes { base_res, unresolved_segments: 0 }
}

#[inline]
pub fn with_unresolved_segments(base_res: Res<NodeId>, mut unresolved_segments: usize) -> Self {
if base_res == Res::Err {
unresolved_segments = 0
}
PartialRes { base_res, unresolved_segments }
}

#[inline]
pub fn base_res(&self) -> Res<NodeId> {
self.base_res
}

#[inline]
pub fn unresolved_segments(&self) -> usize {
self.unresolved_segments
}

#[inline]
pub fn full_res(&self) -> Option<Res<NodeId>> {
(self.unresolved_segments == 0).then_some(self.base_res)
}

#[inline]
pub fn expect_full_res(&self) -> Res<NodeId> {
self.full_res().expect("unexpected unresolved segments")
}
}

/// Different kinds of symbols can coexist even if they share the same textual name.
/// Therefore, they each have a separate universe (known as a "namespace").
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Encodable, Decodable)]
Expand Down Expand Up @@ -933,43 +875,3 @@ impl<Id> Res<Id> {
matches!(self, Res::Def(DefKind::Ctor(_, CtorKind::Const), _) | Res::SelfCtor(..))
}
}

/// Resolution for a lifetime appearing in a type.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum LifetimeRes {
/// Successfully linked the lifetime to a generic parameter.
Param {
/// Id of the generic parameter that introduced it.
param: LocalDefId,
/// Id of the introducing place. That can be:
/// - an item's id, for the item's generic parameters;
/// - a TraitRef's ref_id, identifying the `for<...>` binder;
/// - a FnPtr type's id.
///
/// This information is used for impl-trait lifetime captures, to know when to or not to
/// capture any given lifetime.
binder: NodeId,
},
/// Created a generic parameter for an anonymous lifetime.
Fresh {
/// Id of the generic parameter that introduced it.
///
/// Creating the associated `LocalDefId` is the responsibility of lowering.
param: NodeId,
/// Kind of elided lifetime
kind: hir::MissingLifetimeKind,
},
/// This variant is used for anonymous lifetimes that we did not resolve during
/// late resolution. Those lifetimes will be inferred by typechecking.
Infer,
/// `'static` lifetime.
Static,
/// Resolution failure.
Error(rustc_span::ErrorGuaranteed),
/// HACK: This is used to recover the NodeId of an elided lifetime.
ElidedAnchor { start: NodeId, end: NodeId },
}

// FxIndexMap is necessary because its data ends up in .rmeta files,
// so its iteration order must be consistent. See #159677 for context.
pub type DocLinkResMap = FxIndexMap<(Symbol, Namespace), Option<Res<NodeId>>>;
Loading
Loading