Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly deal with missing/placeholder types inside GACs #125457

Merged
merged 2 commits into from
May 24, 2024

Conversation

fmease
Copy link
Member

@fmease fmease commented May 23, 2024

Fixes #124833.

r? oli-obk (#123130)

@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 23, 2024
@@ -236,9 +236,17 @@ fn infer_type_if_missing<'tcx>(fcx: &FnCtxt<'_, 'tcx>, node: Node<'tcx>) -> Opti
&& let ty::AssocKind::Const = item.kind
&& let ty::ImplContainer = item.container
&& let Some(trait_item) = item.trait_item_def_id
// We don't want to call `tcx.compare_impl_const` here to avoid cycle errors. This is a
// very naive check to prevent us from messing up the generic param instantiation below.
&& tcx.generics_of(def_id).own_counts() == tcx.generics_of(trait_item).own_counts()
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Like, similar to what we do when we have a mismatch between GAT params in a trait and impl

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the pointer, I'll check!

Copy link
Member

Choose a reason for hiding this comment

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

relevant callsite:

if !tcx.check_args_compatible(assoc_ty.item.def_id, args) {
let err = Ty::new_error_with_message(
tcx,
obligation.cause.span,
"impl item and trait item have different parameters",
);
Progress { term: err.into(), obligations: nested }
} else {

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied. Great idea, thanks!

@fmease fmease added the F-generic_const_items `#![feature(generic_const_items)]` label May 23, 2024
@compiler-errors compiler-errors self-assigned this May 23, 2024
@fmease fmease 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 23, 2024
@fmease fmease force-pushed the gacs-diag-infer-plac-missing-ty branch from ecb118e to 39d9b84 Compare May 23, 2024 22:43
@fmease fmease added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 23, 2024
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

r=me if ci is green

@fmease
Copy link
Member Author

fmease commented May 23, 2024

@bors r=compiler-errors rollup

@bors
Copy link
Contributor

bors commented May 23, 2024

📌 Commit 39d9b84 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 23, 2024
@bors
Copy link
Contributor

bors commented May 24, 2024

⌛ Testing commit 39d9b84 with merge 7c54789...

@bors
Copy link
Contributor

bors commented May 24, 2024

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 7c54789 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 24, 2024
@bors bors merged commit 7c54789 into rust-lang:master May 24, 2024
7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 24, 2024
@fmease fmease deleted the gacs-diag-infer-plac-missing-ty branch May 24, 2024 09:38
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7c54789): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 673.634s -> 673.551s (-0.01%)
Artifact size: 315.67 MiB -> 315.70 MiB (0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-generic_const_items `#![feature(generic_const_items)]` merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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 : Region parameter out of range when instantiating in region
6 participants