Skip to content

delegation: emit error when there is an error in lowered user-specified generic args#156953

Open
aerooneqq wants to merge 1 commit into
rust-lang:mainfrom
aerooneqq:delegation-emit-err-when-incorrect-gen-args
Open

delegation: emit error when there is an error in lowered user-specified generic args#156953
aerooneqq wants to merge 1 commit into
rust-lang:mainfrom
aerooneqq:delegation-emit-err-when-incorrect-gen-args

Conversation

@aerooneqq
Copy link
Copy Markdown
Contributor

@aerooneqq aerooneqq commented May 26, 2026

This PR checks if lowered user-specified generic args reference error and emits error if so. And get_delegation_user_specified_args is now query as we invoke it two times.

Somewhat similar to #156565.

Fixes #156848. Part of #118212.
r? @petrochenkov

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 26, 2026
@aerooneqq aerooneqq changed the title delegation: emit error when there is an error in lowered user-specified generic args delegation: emit error when there is an error in lowered user-specified generic args May 26, 2026
@petrochenkov petrochenkov added the F-fn_delegation `#![feature(fn_delegation)]` label May 26, 2026

// If self type is present skip it, as error will be emitted when self type will be accessed.
let skip_self = self_ty.is_some() as usize;
if parent_args.iter().skip(skip_self).chain(child_args).any(|arg| arg.references_error()) {
Copy link
Copy Markdown
Contributor

@petrochenkov petrochenkov May 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The referenced error here is constructed using ErrorGuaranteed from a span_delayed_bug in HIR->ty lowering.

Our conclusion here is that some regular error (not a delayed bug) needs to be reported there, instead of reporting this kind of "some unknown error happened in the past" message post-factum.

It's not very clear what that error should be, and whether the code from #156848 should compile or not at all, and how an explicitly passed '_ should be propagated.

View changes since the review

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 26, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 26, 2026

☔ The latest upstream changes (presumably #156967) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-fn_delegation `#![feature(fn_delegation)]` S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: unelided lifetime in signature

3 participants