-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Conversation
r? @wesleywiser (rust-highfive has picked a reviewer for you, use r? to override) |
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); |
There was a problem hiding this comment.
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.
src/test/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr
Show resolved
Hide resolved
04bf53a
to
763b3a5
Compare
There was a problem hiding this 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
compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs
Outdated
Show resolved
Hide resolved
☔ The latest upstream changes (presumably #101261) made this pull request unmergeable. Please resolve the merge conflicts. |
763b3a5
to
8219177
Compare
8219177
to
bee48e3
Compare
@bors r=cjgillot |
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
Fixes #101421
cc #100838