Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bf03fc3
powerpc64le_unknown_freebsd.rs: link with -lgcc
pkubaj Jul 1, 2026
340e079
ci: use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} arti…
jieyouxu Jul 5, 2026
b50b5b2
Avoid unused braces lint for macro-provided call arguments
chenyukang Jul 4, 2026
7f39e9f
allow mGCA const arguments to fall back to anon consts
khyperia Jul 6, 2026
de73ac0
Fix typetree generation for arguments, like slices and re-enable thei…
ZuseZ4 Jun 23, 2026
6bb1c07
Refactor the Type to TypeTree parser into a large match
ZuseZ4 Jul 6, 2026
f13657c
Rename some body_id vars to body_def_id
camsteffen Jun 28, 2026
f05ac1d
tests: catch up with LLVM returning f128 on the stack
durin42 Jul 7, 2026
66beceb
Add constraints to new delegation's generic args
aerooneqq Jul 7, 2026
831a2e8
delegation: support mapping of all arguments with `Self` type
aerooneqq Jul 7, 2026
4b90917
add wasm targets to unsupported abi test
folkertdev Jun 30, 2026
3decf25
disallow `extern "custom"` on wasm
folkertdev Jun 30, 2026
b10bdc4
add `extern "custom"` test to the naked functions tests
folkertdev Jun 30, 2026
5d925d7
disallow `extern "custom"` on spirv
folkertdev Jun 30, 2026
4674b5d
std: unconditionally use `preadv`/`pwritev` on AArch64 macOS
joboet Jul 7, 2026
674598e
Rollup merge of #158179 - joboet:arm_macos_preadv, r=Darksonn
JonathanBrouwer Jul 7, 2026
b2efe5b
Rollup merge of #158617 - khyperia:gca-syntax-flip, r=BoxyUwU
JonathanBrouwer Jul 7, 2026
4ace805
Rollup merge of #158621 - folkertdev:abi-custom-wasm, r=bjorn3
JonathanBrouwer Jul 7, 2026
3feb381
Rollup merge of #158690 - aerooneqq:delegation-self-type-arguments-wr…
JonathanBrouwer Jul 7, 2026
201f27c
Rollup merge of #158696 - camsteffen:body-id, r=oli-obk
JonathanBrouwer Jul 7, 2026
6fdd5fe
Rollup merge of #158333 - ZuseZ4:typetrees-for-enzyme3, r=oli-obk
JonathanBrouwer Jul 7, 2026
511a286
Rollup merge of #158646 - pkubaj:patch-1, r=bjorn3
JonathanBrouwer Jul 7, 2026
8dc219a
Rollup merge of #158791 - chenyukang:yukang-fix-158747-unused-braces-…
JonathanBrouwer Jul 7, 2026
4afe7ca
Rollup merge of #158802 - jieyouxu:jieyouxu/ci/armhf-gnu-mirror, r=ma…
JonathanBrouwer Jul 7, 2026
f090626
Rollup merge of #158889 - durin42:llvm-23-win-x64-f128, r=folkertdev
JonathanBrouwer Jul 7, 2026
455971c
Rollup merge of #158905 - aerooneqq:delegation-forgotten-constraints,…
JonathanBrouwer Jul 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
16 changes: 6 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 @@ -2564,6 +2558,8 @@ pub enum TyKind {
/// Usually not written directly in user code but indirectly via the macro
/// `core::field::field_of!(...)`.
FieldOf(Box<Ty>, Option<Ident>, 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
11 changes: 11 additions & 0 deletions compiler/rustc_ast/src/expand/typetree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ pub enum Kind {
Anything,
Integer,
Pointer,
// We prefer to directly lower to things that our Enzyme backend supports.
// However, it's sometimes convenient to pass ptr+int as one type.
RustSlice,
Half,
Float,
Double,
Expand Down Expand Up @@ -57,6 +60,9 @@ impl TypeTree {
}
Self(ints)
}
pub fn add_indirection(self) -> Self {
Self(vec![Type { offset: 0, size: 1, kind: Kind::Pointer, child: self }])
}
}

#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, StableHash)]
Expand All @@ -72,6 +78,11 @@ pub struct Type {
pub kind: Kind,
pub child: TypeTree,
}
impl Type {
pub fn from_ty(offset: isize, other: &Type) -> Self {
Self { offset, size: other.size, kind: other.kind, child: other.child.clone() }
}
}

impl Type {
pub fn add_offset(self, add: isize) -> Self {
Expand Down
3 changes: 3 additions & 0 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,6 +303,7 @@ fn type_trailing_braced_mac_call(mut ty: &ast::Ty) -> Option<&ast::MacCall> {
| ast::TyKind::CVarArgs
| ast::TyKind::Pat(..)
| ast::TyKind::FieldOf(..)
| ast::TyKind::DirectConstArg(..)
| ast::TyKind::Dummy
| 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
23 changes: 11 additions & 12 deletions compiler/rustc_ast_lowering/src/delegation/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_hir::def_id::DefId;
use rustc_middle::ty::{GenericParamDefKind, TyCtxt};
use rustc_middle::{bug, ty};
use rustc_span::symbol::kw;
use rustc_span::{Ident, Span, sym};
use rustc_span::{ErrorGuaranteed, Ident, Span, sym};

use crate::LoweringContext;
use crate::delegation::resolution::resolver::DelegationResolver;
Expand Down Expand Up @@ -281,7 +281,7 @@ impl<'hir> DelegationResolver<'_, 'hir> {
&self,
delegation: &'a Delegation,
sig_id: DefId,
) -> GenericsResolution<'a, 'hir> {
) -> Result<GenericsResolution<'a, 'hir>, ErrorGuaranteed> {
let tcx = self.tcx();
let delegation_parent_kind = tcx.def_kind(tcx.local_parent(self.owner_id()));

Expand All @@ -300,9 +300,8 @@ impl<'hir> DelegationResolver<'_, 'hir> {
let qself_is_none = delegation.qself.is_none();

let parent_args = if let [.., parent_segment, _] = &delegation.path.segments[..] {
if let Some(res) = self.get_resolution_id(parent_segment.id)
&& matches!(tcx.def_kind(res), DefKind::Trait | DefKind::TraitAlias)
{
let res = self.get_resolution_id(parent_segment.id)?;
if matches!(tcx.def_kind(res), DefKind::Trait | DefKind::TraitAlias) {
sig_parent_params = &tcx.generics_of(sig_parent).own_params;
self.get_user_args(parent_segment)
.map(|args| ParentSegmentArgs::Specified(args))
Expand All @@ -314,7 +313,7 @@ impl<'hir> DelegationResolver<'_, 'hir> {
ParentSegmentArgs::Invalid
};

GenericsResolution {
Ok(GenericsResolution {
parent_args,
sig_parent_params,
qself_is_none,
Expand All @@ -326,7 +325,7 @@ impl<'hir> DelegationResolver<'_, 'hir> {
child_args: self.get_user_args(
delegation.path.segments.last().expect("must be at least one segment"),
),
}
})
}

fn get_user_args<'a>(&self, segment: &'a PathSegment) -> Option<&'a AngleBracketedArgs> {
Expand All @@ -350,14 +349,14 @@ impl<'hir> DelegationResolver<'_, 'hir> {
&self,
delegation: &Delegation,
sig_id: DefId,
) -> GenericsGenerationResults<'hir> {
) -> Result<GenericsGenerationResults<'hir>, ErrorGuaranteed> {
let res @ GenericsResolution {
trait_impl,
generate_self,
sig_child_params,
sig_parent_params,
..
} = self.resolve_generics(delegation, sig_id);
} = self.resolve_generics(delegation, sig_id)?;

// If we are in trait impl always generate function whose generics matches
// those that are defined in trait.
Expand All @@ -374,7 +373,7 @@ impl<'hir> DelegationResolver<'_, 'hir> {

let child = GenericsGenerationResult::new(child);

return GenericsGenerationResults { parent, child, self_ty_propagation_kind: None };
return Ok(GenericsGenerationResults { parent, child, self_ty_propagation_kind: None });
}

let tcx = self.tcx();
Expand Down Expand Up @@ -421,7 +420,7 @@ impl<'hir> DelegationResolver<'_, 'hir> {
DelegationGenerics::generate_all(sig_child_params, GenericsPosition::Child, trait_impl)
};

GenericsGenerationResults {
Ok(GenericsGenerationResults {
parent: GenericsGenerationResult::new(parent_generics),
child: GenericsGenerationResult::new(child_generics),
self_ty_propagation_kind: match res.free_to_trait_delegation {
Expand All @@ -435,7 +434,7 @@ impl<'hir> DelegationResolver<'_, 'hir> {
}),
false => None,
},
}
})
}

/// Generates generic argument slots for user-specified `args` and
Expand Down
Loading
Loading