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

Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments #101427

Merged
merged 1 commit into from
Sep 6, 2022

Conversation

compiler-errors
Copy link
Member

Fixes #101421
cc #100838

@rust-highfive
Copy link
Collaborator

r? @wesleywiser

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 5, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 5, 2022
expr: &'tcx hir::Expr<'tcx>,
msg: String,
num_assoc_fn_excess_args: usize,
num_trait_generics_except_self: usize,
) {
if let hir::ExprKind::MethodCall(_, args, _) = expr.kind {
assert_eq!(args.len(), 1);
Copy link
Member Author

@compiler-errors compiler-errors Sep 5, 2022

Choose a reason for hiding this comment

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

Nothing enforces this assertion as a precondition, and also it's artificially quite limiting. There's no reason we can't make this suggestion for when there are >1 arguments, and so I generalized it -- that's where most of this new logic comes from.

@compiler-errors compiler-errors force-pushed the issue-101421 branch 2 times, most recently from 04bf53a to 763b3a5 Compare September 5, 2022 00:53
Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

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

I'm usually not a fan of span_to_snippet, but I don't see how else this would work here.
r=me with a few nits

@bors
Copy link
Contributor

bors commented Sep 5, 2022

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

@compiler-errors
Copy link
Member Author

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Sep 5, 2022

📌 Commit bee48e3 has been approved by cjgillot

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 Sep 5, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 6, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#100658 (TyCtxt::get_attr should check that no duplicates are allowed)
 - rust-lang#101021 (Migrate ``rustc_middle`` diagnostic)
 - rust-lang#101287 (Document eager evaluation of `bool::then_some` argument)
 - rust-lang#101412 (Some more cleanup in `core`)
 - rust-lang#101427 (Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8936211 into rust-lang:master Sep 6, 2022
@rustbot rustbot added this to the 1.65.0 milestone Sep 6, 2022
@compiler-errors compiler-errors deleted the issue-101421 branch November 2, 2022 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
6 participants