Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9ce47de
explicitly check for fresh vars in canonicalize
lcnr Oct 6, 2026
7c69454
Don't add rustc to env in nix dev shell
maxdexh Oct 6, 2026
381a3bd
Add a test case
saethlin Oct 6, 2026
f5733a7
Fix by checking offset is a multiple of align
saethlin Oct 6, 2026
cb35723
Remove `NonOwner` variant from `AstOwner`
aerooneqq Oct 6, 2026
ee7e153
trait object query cycles
lcnr Oct 6, 2026
4bec234
ui test to known bug
lcnr Oct 6, 2026
87c6fef
don't rely on incomplete inference
lcnr Oct 6, 2026
4046cff
`fn_delegation` opaque type bug
lcnr Oct 6, 2026
79adcc6
opaque type test
lcnr Oct 6, 2026
3e97c85
transmutability tests
lcnr Oct 6, 2026
374fe14
recursive-impl-trait-ui
lcnr Oct 6, 2026
d853acc
we're breaking the gluon_salsa test
lcnr Oct 6, 2026
439a37a
known-bug test
lcnr Oct 6, 2026
5c6596e
opaque types known bug
lcnr Oct 6, 2026
308801e
Panic on `StableHash` of a `Path` with `GenericArgs`
joshtriplett Oct 6, 2026
b99b64d
revisions for TAIT in env bug
lcnr Oct 6, 2026
3d0abf0
Remove needless closure in bootstrap
Jules-Bertholet Oct 6, 2026
9f07bff
require debug assertions
lcnr Oct 6, 2026
879c65a
Clean up Reference annotations that drifted
traviscross Aug 28, 2026
9a6d547
Update Enzyme submodule
ZuseZ4 Oct 6, 2026
e5ebfd8
[PAC] Stop hard coding key and discriminator, consult schema instead
jchlanda Oct 2, 2026
5040ebc
abby DSL: implement ambiguity
khyperia Oct 7, 2026
23be578
Submodule update of rustc-perf
Kobzol Oct 7, 2026
4d4ca08
abby DSL: change `where` syntax to `predicates`
khyperia Oct 7, 2026
2f1e174
Rollup merge of #163887 - aerooneqq:remove-ast-non-owner, r=joshtriplett
JonathanBrouwer Oct 7, 2026
8c6921b
Rollup merge of #163892 - lcnr:ui-test-fun, r=lqd
JonathanBrouwer Oct 7, 2026
e9002dc
Rollup merge of #163925 - Kobzol:rustc-perf-update, r=lqd
JonathanBrouwer Oct 7, 2026
6b5faae
Rollup merge of #163658 - jchlanda:jakub/key_disc_fix, r=nnethercote
JonathanBrouwer Oct 7, 2026
c41bb0a
Rollup merge of #163854 - saethlin:gvn-intern-alignment, r=oli-obk
JonathanBrouwer Oct 7, 2026
12aab8d
Rollup merge of #163874 - lcnr:ice-on-fresh-vars, r=oli-obk
JonathanBrouwer Oct 7, 2026
d2d05af
Rollup merge of #163880 - maxdexh:dont-pollute-path, r=clubby789
JonathanBrouwer Oct 7, 2026
bde92dd
Rollup merge of #163893 - joshtriplett:ast-path-hash-args, r=nnethercote
JonathanBrouwer Oct 7, 2026
a146794
Rollup merge of #163894 - lcnr:tait-in-env-bug, r=lqd
JonathanBrouwer Oct 7, 2026
5809dd8
Rollup merge of #163902 - traviscross:TC/add-reference-annotations_cl…
JonathanBrouwer Oct 7, 2026
74fdbf9
Rollup merge of #163905 - Jules-Bertholet:bootstrap-tweak, r=Kobzol
JonathanBrouwer Oct 7, 2026
c385eeb
Rollup merge of #163908 - ZuseZ4:update-enzyme-oct-06-2026, r=ZuseZ4
JonathanBrouwer Oct 7, 2026
b987138
Rollup merge of #163921 - khyperia:abby-dsl-ambiguity, r=BoxyUwU
JonathanBrouwer Oct 7, 2026
182c8ef
Rollup merge of #163927 - khyperia:abby-dsl-predicates-syntax, r=BoxyUwU
JonathanBrouwer Oct 7, 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
10 changes: 9 additions & 1 deletion compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ impl StableHash for Path {
self.segments.len().stable_hash(hcx, hasher);
for segment in &self.segments {
segment.ident.stable_hash(hcx, hasher);
if segment.args.is_some() {
// This should never happen, because Path::stable_hash is only used for attributes,
// which never have generic args. Check that to make sure, though.
panic!("Paths with generic args should not appear in incremental state");
}
}
}
}
Expand Down Expand Up @@ -4072,7 +4077,7 @@ pub struct TestBinderBody {
pub exists: ThinVec<TestBinderExists>,
pub constraints: Vec<TestBinderConstraint>,
/// These are not where clauses, but rather predicates within the body to be proven
pub predicates: Vec<WhereClause>,
pub predicates: Vec<WherePredicate>,
}

#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
Expand Down Expand Up @@ -4100,6 +4105,9 @@ pub enum TestBinderConstraint {
Or {
items: ThinVec<TestBinderConstraint>,
},
Ambiguity {
span: Span,
},
Lifetime {
#[visitable(extra = LifetimeCtxt::Bound)]
lhs: Lifetime,
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_ast_lowering/src/delegation/resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use ast::visit::Visitor;
use hir::def::DefKind;
use rustc_ast::{self as ast, AssocItemKind, Delegation, DelegationSource, Item, ItemKind, NodeId};
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
use rustc_data_structures::steal::Steal;
use rustc_hir as hir;
use rustc_middle::middle::resolve::{
self as mid_res, AstOwner, DelegationInherentFnKind, TypeRelativeDelegationRes,
Expand Down Expand Up @@ -53,9 +52,10 @@ pub(crate) fn resolve_type_relative_delegations(
// Also record resolutions for cases when signature is resolved but call path is not.
mid_res::DelegationResolution::Partial
| mid_res::DelegationResolution::PartialCall(_) => {
let Some(r_and_owner) = ast_index.get(def_id).map(Steal::borrow) else {
unreachable!("ast index must contain delegations");
};
let r_and_owner = ast_index[def_id]
.as_ref()
.expect("ast index must contain delegations")
.borrow();

let (r, owner) = &*r_and_owner;

Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2003,7 +2003,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
let predicates = self.arena.alloc_from_iter(
body.predicates
.iter()
.flat_map(|w| &w.predicates)
.map(|predicate| self.lower_where_predicate(predicate, &[], &mut dedup_map)),
);
hir::TestBinderBody { foralls, exists, constraints, predicates }
Expand Down Expand Up @@ -2083,6 +2082,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
items.iter().map(|item| self.lower_test_binder_constraint(item)),
),
},
TestBinderConstraint::Ambiguity { span } => {
hir::TestBinderConstraint::Ambiguity { span: self.lower_span(*span) }
}
TestBinderConstraint::Lifetime { lhs, rhs } => {
let lhs = self.lower_lifetime(lhs, LifetimeSource::Other, lhs.ident.into());
let rhs = self.lower_lifetime(rhs, LifetimeSource::OutlivesBound, rhs.ident.into());
Expand Down
21 changes: 11 additions & 10 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ enum TryBlockScope {
fn index_ast<'tcx>(
tcx: TyCtxt<'tcx>,
(): (),
) -> &'tcx IndexSlice<LocalDefId, Steal<(Arc<ResolverAstLowering<'tcx>>, AstOwner)>> {
) -> &'tcx IndexSlice<LocalDefId, Option<Steal<(Arc<ResolverAstLowering<'tcx>>, AstOwner)>>> {
// Queries that borrow `resolver_for_lowering`.
tcx.ensure_done().output_filenames(());
tcx.ensure_done().early_lint_checks(());
Expand All @@ -610,20 +610,19 @@ fn index_ast<'tcx>(
let index = indexer.index;
let resolver = Arc::new(resolver);
return tcx.arena.alloc_index_slice_from_iter::<LocalDefId, _, _>(
index.into_iter().map(|owner| Steal::new((Arc::clone(&resolver), owner))),
index.into_iter().map(|owner| owner.map(|o| Steal::new((Arc::clone(&resolver), o)))),
);

struct Indexer<'s, 'hir> {
owners: &'s NodeMap<PerOwnerResolverData<'hir>>,
index: IndexVec<LocalDefId, AstOwner>,
index: IndexVec<LocalDefId, Option<AstOwner>>,
next_node_id: NodeId,
}

impl Indexer<'_, '_> {
fn insert(&mut self, id: NodeId, node: AstOwner) {
let def_id = self.owners[&id].def_id;
self.index.ensure_contains_elem(def_id, || AstOwner::NonOwner);
self.index[def_id] = node;
self.index.insert(def_id, node);
}

fn make_dummy<K>(
Expand Down Expand Up @@ -705,7 +704,7 @@ fn lower_to_hir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::MaybeOwner<'_> {
tcx.ensure_done().resolve_type_relative_delegations(());

let ast_index = tcx.index_ast(());
let resolver_and_node = ast_index.get(def_id).map(Steal::steal);
let resolver_and_node = ast_index.get(def_id);

let fallback_to_ancestor = || {
// The item did not exist in the AST, it was created while lowering another item.
Expand All @@ -732,10 +731,13 @@ fn lower_to_hir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::MaybeOwner<'_> {
})
};

let Some((resolver, node)) = resolver_and_node else {
let Some(Some(r_and_node)) = resolver_and_node else {
// `ast_index` does not contain all definitions, only up-to the highest
// `LocalDefId` which has a non-trivial `AstOwner`. Gracefully handle
// other definitions, in particular those nested inside this highest definition.
// OR
// The item existed in the AST, but is not a HIR owner.
// Fetch the correct information from its parent.
return fallback_to_ancestor();
};

Expand All @@ -750,6 +752,8 @@ fn lower_to_hir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::MaybeOwner<'_> {
hir::MaybeOwner::Owner(lctx.curr_owner.into_owner_info(tcx, item))
}

let (resolver, node) = r_and_node.steal();

let item = match &node {
// The item existed in the AST.
AstOwner::Crate(c) => with_lctx(tcx, &*resolver, CRATE_NODE_ID, |lctx| {
Expand All @@ -770,9 +774,6 @@ fn lower_to_hir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::MaybeOwner<'_> {
AstOwner::ForeignItem(item) => with_lctx(tcx, &*resolver, item.id, |lctx| {
hir::OwnerNode::ForeignItem(lctx.lower_foreign_item(item))
}),
// The item existed in the AST, but is not a HIR owner.
// Fetch the correct information from its parent.
AstOwner::NonOwner => fallback_to_ancestor(),
};

tcx.sess.time("drop_ast", || mem::drop(node));
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_llvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2187,9 +2187,8 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
llfn: &'ll Value,
fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>,
) -> Option<llvm::OperandBundleBox<'ll>> {
if self.sess().pointer_authentication_functions().is_none() {
return None;
}
let schema = self.sess().pointer_authentication_functions()?;

// Pointer authentication support is currently limited to extern "C" calls; filter out other
// ABIs.
if fn_abi?.conv != CanonAbi::C {
Expand All @@ -2207,11 +2206,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
// bundles.
// Once this is resolved, we should analyze each call and skip direct calls. See the
// discussion in the rust-lang issue: <https://github.com/rust-lang/rust/issues/152532>
let key: u32 = 0;
let discriminator: u64 = 0;
Some(llvm::OperandBundleBox::new(
"ptrauth",
&[self.const_u32(key), self.const_u64(discriminator)],
&[
self.const_u32(schema.key as u32),
self.const_u64(schema.constant_discriminator as u64),
],
))
}

Expand Down
13 changes: 8 additions & 5 deletions compiler/rustc_codegen_llvm/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ fn check_and_apply_linkage<'ll, 'tcx>(
let fn_sig = sig.with(*header);
let fn_abi = cx.fn_abi_of_fn_ptr(fn_sig, ty::List::empty());
// Decide if the initializer needs to be signed
if cx.sess().pointer_authentication()
if cx.sess().pointer_authentication_functions().is_some()
&& matches!(fn_sig.abi(), ExternAbi::C { .. } | ExternAbi::System { .. })
{
should_sign = true;
Expand Down Expand Up @@ -249,13 +249,16 @@ fn check_and_apply_linkage<'ll, 'tcx>(

// Sign the function pointer that is used to initialize the global
let initializer = if should_sign {
let key: u32 = 0;
let discriminator: u64 = 0;
let schema = cx
.tcx
.sess
.pointer_authentication_functions()
.expect("pointer authentication functions must be available when signing");

const_ptr_auth(
cx.const_bitcast(g1, llty),
key,
discriminator,
schema.key as u32,
schema.constant_discriminator as u64,
None, /* address_diversity */
)
} else {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4556,6 +4556,7 @@ pub struct TestBinderExists<'hir> {
pub enum TestBinderConstraint<'hir> {
And { items: &'hir [TestBinderConstraint<'hir>] },
Or { items: &'hir [TestBinderConstraint<'hir>] },
Ambiguity { span: Span },
Lifetime { lhs: &'hir Lifetime, rhs: &'hir Lifetime },
PlaceholderOutlives { lhs: &'hir Ty<'hir>, rhs: &'hir Lifetime },
AliasOutlives { bound_type_constraint: &'hir TestBinderBoundTypeConstraint<'hir> },
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,7 @@ pub fn walk_test_binder_constraint<'v, V: Visitor<'v>>(
TestBinderConstraint::Or { items } => {
walk_list!(visitor, visit_test_binder_constraint, *items)
}
TestBinderConstraint::Ambiguity { span: _ } => {}
TestBinderConstraint::Lifetime { lhs, rhs } => {
try_visit!(visitor.visit_lifetime(lhs));
try_visit!(visitor.visit_lifetime(rhs));
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ impl<'tcx> ItemCtxt<'tcx> {
.map(|item| self.lower_test_binder_constraint(item))
.reduce(SolverRegionConstraint::build_or)
.unwrap_or(SolverRegionConstraint::new_false()),
rustc_hir::TestBinderConstraint::Ambiguity { span } => {
SolverRegionConstraint::new_ambig(*span)
}
hir::TestBinderConstraint::Lifetime { lhs, rhs } => {
let span = lhs.ident.span.to(rhs.ident.span);
let lhs = self.lowerer().lower_lifetime(lhs, RegionInferReason::RegionPredicate);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ rustc_arena::declare_arena! {
rustc_middle::middle::resolve::ResolverAstLowering<'tcx>
>,
index_ast:
rustc_data_structures::steal::Steal<(
Option<rustc_data_structures::steal::Steal<(
std::sync::Arc<rustc_middle::middle::resolve::ResolverAstLowering<'tcx>>,
rustc_middle::middle::resolve::AstOwner
)>,
)>>,
crate_alone: rustc_data_structures::steal::Steal<rustc_ast::Crate>,
crate_for_resolver: rustc_data_structures::steal::Steal<(rustc_ast::Crate, rustc_ast::AttrVec)>,
resolutions: rustc_middle::middle::resolve::ResolverGlobalCtxt,
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,6 @@ pub type DocLinkResMap = FxIndexMap<(Symbol, Namespace), Option<Res<NodeId>>>;
/// is as good a place as any for it.
#[derive(Debug)]
pub enum AstOwner {
/// This definition does not correspond to a HIR owner.
NonOwner,
Crate(Box<ast::Crate>),
Item(Box<ast::Item>),
TraitItem(Box<ast::AssocItem>),
Expand Down
12 changes: 5 additions & 7 deletions compiler/rustc_middle/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,11 @@ rustc_queries! {
desc { "getting the resolver for lowering" }
}

query index_ast(_: ()) -> &'tcx IndexSlice<LocalDefId, Steal<(
// There is only a single `ResolverAstLowering` for all owners.
// We want to drop it once the whole HIR has been lowered.
// We rely on reference counting to know when all definitions have been stolen.
Arc<ResolverAstLowering<'tcx>>,
AstOwner,
)>> {
// There is only a single `ResolverAstLowering` for all owners.
// We want to drop it once the whole HIR has been lowered.
// We rely on reference counting to know when all definitions have been stolen.
// None if the `LocalDefId` is not an owner.
query index_ast(_: ()) -> &'tcx IndexSlice<LocalDefId, Option<Steal<(Arc<ResolverAstLowering<'tcx>>, AstOwner)>>> {
eval_always
no_hash
desc { "getting the AST for lowering" }
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_mir_transform/src/gvn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,8 @@ fn op_to_prop_const<'tcx>(
// Transmuting a constant is just an offset in the allocation. If the alignment of the
// allocation is not enough, fallback to copying into a properly aligned value.
&& alloc.inner().align >= op.layout.align.abi
// If this is a packed field the offset must also be sufficiently aligned.
&& offset.bytes().is_multiple_of(op.layout.align.abi.bytes())
{
return Some(ConstValue::Indirect { alloc_id, offset });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ use thin_vec::ThinVec;
use crate::delegate::SolverDelegate;

/// Does this have infer/placeholder/param, free regions or ReErased?
// We're explicitly checking for fresh types and consts to trigger an
// assert if they ever leak into the trait solver. They should never
// exist with the new solver.
const NEEDS_CANONICAL: TypeFlags = TypeFlags::from_bits(
TypeFlags::HAS_INFER.bits()
| TypeFlags::HAS_PLACEHOLDER.bits()
| TypeFlags::HAS_PARAM.bits()
| TypeFlags::HAS_FREE_REGIONS.bits()
| TypeFlags::HAS_RE_ERASED.bits(),
| TypeFlags::HAS_RE_ERASED.bits()
| TypeFlags::HAS_TY_FRESH.bits()
| TypeFlags::HAS_CT_FRESH.bits(),
)
.unwrap();

Expand Down
42 changes: 29 additions & 13 deletions compiler/rustc_parse/src/parser/generics.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc_ast::{
self as ast, AttrVec, DUMMY_NODE_ID, GenericBounds, GenericParam, GenericParamKind, TyKind,
WhereClause, token,
WhereClause, WherePredicate, token,
};
use rustc_errors::{Applicability, Diag, PResult};
use rustc_span::{Ident, Span, kw, sym};
Expand Down Expand Up @@ -411,15 +411,15 @@ impl<'a> Parser<'a> {
&mut self,
struct_: Option<(Ident, Span)>,
) -> PResult<'a, (WhereClause, Option<ThinVec<ast::FieldDef>>)> {
let mut where_clause = WhereClause {
has_where_token: false,
predicates: ThinVec::new(),
span: self.prev_token.span.shrink_to_hi(),
};
let mut tuple_struct_body = None;

if !self.eat_keyword(exp!(Where)) {
return Ok((where_clause, None));
return Ok((
WhereClause {
has_where_token: false,
predicates: ThinVec::new(),
span: self.prev_token.span.shrink_to_hi(),
},
None,
));
}

if self.eat_noexpect(&token::Colon) {
Expand All @@ -435,7 +435,6 @@ impl<'a> Parser<'a> {
.emit();
}

where_clause.has_where_token = true;
let where_lo = self.prev_token.span;

// We are considering adding generics to the `where` keyword as an alternative higher-rank
Expand All @@ -446,6 +445,24 @@ impl<'a> Parser<'a> {
self.dcx().emit_err(diagnostics::WhereOnGenerics { span: generics.span });
}

let (predicates, tuple_struct_body) =
self.parse_where_clause_predicates(struct_, where_lo)?;
let where_clause = WhereClause {
has_where_token: true,
predicates,
span: where_lo.to(self.prev_token.span),
};
Ok((where_clause, tuple_struct_body))
}

pub(super) fn parse_where_clause_predicates(
&mut self,
struct_: Option<(Ident, Span)>,
where_lo: Span,
) -> PResult<'a, (ThinVec<WherePredicate>, Option<ThinVec<ast::FieldDef>>)> {
let mut predicates = ThinVec::new();
let mut tuple_struct_body = None;

loop {
let where_sp = where_lo.to(self.prev_token.span);
let attrs = self.parse_outer_attributes()?;
Expand Down Expand Up @@ -498,7 +515,7 @@ impl<'a> Parser<'a> {
Ok((predicate, Trailing::No, UsePreAttrPos::No))
})?;
match predicate {
Some(predicate) => where_clause.predicates.push(predicate),
Some(predicate) => predicates.push(predicate),
None => break,
}

Expand All @@ -516,8 +533,7 @@ impl<'a> Parser<'a> {
}
}

where_clause.span = where_lo.to(self.prev_token.span);
Ok((where_clause, tuple_struct_body))
Ok((predicates, tuple_struct_body))
}

fn parse_ty_where_predicate_kind_or_recover_tuple_struct_body(
Expand Down
Loading
Loading