Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d061dcb
Fix misattributed type inference error span for index expressions
Dnreikronos May 24, 2026
7be87ed
Don't ICE on non-lifetime binders under `-Zassumptions-on-binders`
Dnreikronos Jun 11, 2026
5ffbf04
remove some redundant closures
cyrgani May 30, 2026
acac5b3
simplify `Buffer`
cyrgani May 30, 2026
d727a0e
set `issue = none` for `proc_macro_internals`
cyrgani Jun 1, 2026
b292ff8
fix "rountrips" typo
cyrgani Jun 8, 2026
30004a8
improve `nonfatal-parsing` test
cyrgani Jun 8, 2026
a390036
resolve region inference vars when computing their max universe
Dnreikronos Jun 15, 2026
b1483e3
Update mingw-w64 C toolchain
mati865 Jun 17, 2026
a09fc01
Avoid forcing index operand inference
Dnreikronos Jun 19, 2026
a2f80c9
Handle alias outlives ambiguity during rewrite
Dnreikronos Jun 19, 2026
3bb0a1c
Resolve vars before computing max universe
Dnreikronos Jun 20, 2026
a44ab8d
Format max universe visitor
Dnreikronos Jun 20, 2026
e7b8d13
Ignore println newline in foreign format hints
Dnreikronos Jun 21, 2026
56dfba7
Update foreign format UI baselines
Dnreikronos Jun 21, 2026
356c63f
Correct issue 92267 UI baseline
Dnreikronos Jun 21, 2026
2a86b91
Update issue 92267 stderr ending
Dnreikronos Jun 21, 2026
b1e1db9
Add tup expr arg unbounded assoc const test and update test with prop…
Shourya742 Jun 22, 2026
f0cf392
typo fix from hid_id to hir_id
Shourya742 Jun 22, 2026
cd8c4d0
Check the target and souce tuple elements mismatch duing const_arg_tu…
Shourya742 Jun 22, 2026
3da4612
norm: fix escaping placeholder check
lcnr Jun 22, 2026
f99e894
Move target checking for `#[lang]` to the attribute parser
JonathanBrouwer Jun 21, 2026
b8758a3
Add lifetime parameter to `AllowedTargets`
JonathanBrouwer Jun 21, 2026
9ad6dbf
Use `AllowedTargets::ManuallyChecked` for `LangParser`
JonathanBrouwer Jun 21, 2026
6863281
Split `resolve_ident_in_module_non_globs_unadjusted` into local and e…
LorrensP-2158466 Jun 21, 2026
0eb146c
Extract all instance shim variants into new `ShimKind` enum
camelid Jun 18, 2026
c329a0e
Strip vestigial `Shim` suffix from `ShimKind` variants
camelid Jun 18, 2026
d06469a
Remove `MirSource::from_instance` helper that is only used in one place
camelid Jun 18, 2026
7d42183
Add support for infers in delegation's generics
aerooneqq Jun 22, 2026
2172c51
triagebot: Stop pinging myself
aDotInTheVoid Jun 22, 2026
1bdb472
Add test.
cjgillot Jun 23, 2026
490d32c
Follow goto and drop when linting unreachable code.
cjgillot Jun 22, 2026
24d4439
Use `cfg_select` in `std::os`
hkBst Jun 22, 2026
5d07ed5
slice_split_once: bounds check optimization note
ArhanChaudhary Jun 23, 2026
7e50f56
Rollup merge of #156885 - Dnreikronos:fix/index-expr-ambiguous-type-s…
JonathanBrouwer Jun 23, 2026
39f9f42
Rollup merge of #157271 - cyrgani:pm-cleaning, r=petrochenkov
JonathanBrouwer Jun 23, 2026
b25ae83
Rollup merge of #157883 - Shourya742:2026-06-14-remove-strict-invaria…
JonathanBrouwer Jun 23, 2026
ef8294b
Rollup merge of #157921 - Dnreikronos:fix-assumptions-on-binders-plac…
JonathanBrouwer Jun 23, 2026
00db71d
Rollup merge of #157960 - aerooneqq:delegation-infers-in-generics, r=…
JonathanBrouwer Jun 23, 2026
3e4b312
Rollup merge of #158105 - camelid:group-shims, r=oli-obk
JonathanBrouwer Jun 23, 2026
aedc1f8
Rollup merge of #158207 - LorrensP-2158466:split-resolve-fns, r=petro…
JonathanBrouwer Jun 23, 2026
7501dcf
Rollup merge of #158279 - cjgillot:unreachable-goto, r=folkertdev
JonathanBrouwer Jun 23, 2026
5e7672a
Rollup merge of #157807 - Dnreikronos:assumptions_on_binders_non_life…
JonathanBrouwer Jun 23, 2026
75e6a3d
Rollup merge of #158020 - mati865:mingw-baseline, r=marcoieni
JonathanBrouwer Jun 23, 2026
1ab5842
Rollup merge of #158222 - Dnreikronos:format/foreign_newline_diagnost…
JonathanBrouwer Jun 23, 2026
50a5f64
Rollup merge of #158223 - JonathanBrouwer:lang-target, r=mejrs
JonathanBrouwer Jun 23, 2026
2a264b1
Rollup merge of #158252 - hkBst:std-os-cfg-select, r=jhpratt
JonathanBrouwer Jun 23, 2026
87f949a
Rollup merge of #158257 - lcnr:normalize-hr-aliases, r=adwinwhite
JonathanBrouwer Jun 23, 2026
3a61a4a
Rollup merge of #158274 - aDotInTheVoid:im-american-made-bud-light-ch…
JonathanBrouwer Jun 23, 2026
3ef0f8c
Rollup merge of #158282 - ArhanChaudhary:unchecked-subslice, r=tgross…
JonathanBrouwer Jun 23, 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
97 changes: 65 additions & 32 deletions compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
return self.generate_delegation_error(span, delegation);
}

let mut generics = self.uplift_delegation_generics(delegation, sig_id, is_method);
let mut generics = self.uplift_delegation_generics(delegation, sig_id);

let (body_id, call_expr_id, unused_target_expr) = self.lower_delegation_body(
delegation,
Expand Down Expand Up @@ -404,10 +404,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::InferDelegationSig::Output(self.arena.alloc(hir::DelegationInfo {
call_expr_id,
call_path_res: self.get_resolution_id(call_path_node_id),
child_args_segment_id: generics.child.args_segment_id,
parent_args_segment_id: generics.parent.args_segment_id,
self_ty_id: generics.self_ty_id,
propagate_self_ty: generics.propagate_self_ty,
child_seg_id: generics.child.args_segment_id,
child_seg_id_for_sig: generics.child.segment_id_for_sig(),
parent_seg_id_for_sig: generics.parent.segment_id_for_sig(),
self_ty_propagation_kind: generics.self_ty_propagation_kind,
group_id: {
let id = match source {
DelegationSource::Single => None,
Expand Down Expand Up @@ -625,20 +625,40 @@ impl<'hir> LoweringContext<'_, 'hir> {
}),
);

hir::QPath::Resolved(ty, self.arena.alloc(new_path))
}
hir::QPath::TypeRelative(ty, segment) => {
let segment = self.process_segment(span, segment, &mut generics.child);
// Explicitly create `Self` self-type in case of infers or static
// free-to-trait reuses.
let ty = match generics.self_ty_propagation_kind {
Some(hir::DelegationSelfTyPropagationKind::SelfParam) => {
let self_param = generics.parent.generics.find_self_param();
let path = self.create_generic_arg_path(self_param);
let kind = hir::TyKind::Path(path);

let ty = match ty {
Some(ty) => hir::Ty { kind, ..ty.clone() },
None => hir::Ty { kind, hir_id: self.next_id(), span },
};

Some(&*self.arena.alloc(ty))
}
_ => ty,
};

hir::QPath::TypeRelative(ty, self.arena.alloc(segment))
hir::QPath::Resolved(ty, self.arena.alloc(new_path))
}
hir::QPath::TypeRelative(..) => unreachable!("until inherent methods are supported"),
};

generics.self_ty_id = match new_path {
hir::QPath::Resolved(ty, _) => ty,
hir::QPath::TypeRelative(ty, _) => Some(ty),
if let Some(hir::DelegationSelfTyPropagationKind::SelfTy(id)) =
generics.self_ty_propagation_kind.as_mut()
{
*id = match new_path {
hir::QPath::Resolved(ty, _) => {
ty.expect("must contain self type as `SelfTy` propagation kind is specified")
}
hir::QPath::TypeRelative(ty, _) => ty,
}
.hir_id;
}
.map(|ty| ty.hir_id);

let callee_path = self.arena.alloc(self.mk_expr(hir::ExprKind::Path(new_path), span));
let args = self.arena.alloc_from_iter(args);
Expand All @@ -662,25 +682,38 @@ impl<'hir> LoweringContext<'_, 'hir> {
segment: &hir::PathSegment<'hir>,
result: &mut GenericsGenerationResult<'hir>,
) -> hir::PathSegment<'hir> {
let details = result.generics.args_propagation_details();

// Always uplift generic params, because if they are not empty then they
// should be generated in delegation.
let generics = result.generics.into_hir_generics(self, span);
let segment = if details.should_propagate {
let args = generics.into_generic_args(self, span);

// Needed for better error messages (`trait-impl-wrong-args-count.rs` test).
let args = if args.is_empty() { None } else { Some(args) };

hir::PathSegment { args, ..segment.clone() }
} else {
segment.clone()
};
let infer_indices = result.generics.infer_indices();
result.generics.into_hir_generics(self, span);

let mut segment = segment.clone();
let mut args_iter = result.generics.create_args_iterator();

let new_args = segment
.args
.filter(|args| !args.is_empty())
.map(|args| {
self.arena.alloc_from_iter(args.args.iter().enumerate().map(|(idx, arg)| {
if infer_indices.contains(&idx) {
args_iter.next(self, |_| arg.hir_id()).expect("arg must exist for infer")
} else {
*arg
}
}))
})
.unwrap_or_else(|| self.arena.alloc_from_iter(args_iter.consume_all(self)));

// Needed for better error messages (`trait-impl-wrong-args-count.rs` test).
segment.args = (!new_args.is_empty()).then(|| {
&*self.arena.alloc(hir::GenericArgs {
args: new_args,
constraints: &[],
parenthesized: hir::GenericArgsParentheses::No,
span_ext: segment.args.map_or(span, |args| args.span_ext),
})
});

if details.use_args_in_sig_inheritance {
result.args_segment_id = Some(segment.hir_id);
}
result.args_segment_id = segment.hir_id;
result.use_for_sig_inheritance = !result.generics.is_trait_impl();

segment
}
Expand Down
Loading
Loading