fix ICE in suggest_add_reference_to_arg for non-callable items - #160628
fix ICE in suggest_add_reference_to_arg for non-callable items#160628im-lunex wants to merge 1 commit into
suggest_add_reference_to_arg for non-callable items#160628Conversation
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
fix ICE in `suggest_add_reference_to_arg` for non-callable items
`tcx.fn_sig(def_id)` panicked ("unexpected sort of node in fn_sig()") when
the `def_id` in a `WhereClauseInExpr` obligation was the struct being
constructed, not the impl. This happens when a struct literal argument is
missing a field.
Guard both `fn_sig` call sites in `suggest_add_reference_to_arg` so the
suggestion only fires for callable defs.
Fixes rust-lang#160591.
|
hi, i want to ask it due to our new policy: was LLM used for this and if so how? |
fix ICE in `suggest_add_reference_to_arg` for non-callable items
`tcx.fn_sig(def_id)` panicked ("unexpected sort of node in fn_sig()") when
the `def_id` in a `WhereClauseInExpr` obligation was the struct being
constructed, not the impl. This happens when a struct literal argument is
missing a field.
Guard both `fn_sig` call sites in `suggest_add_reference_to_arg` so the
suggestion only fires for callable defs.
Fixes rust-lang#160591.
Rollup of 14 pull requests Successful merges: - #150885 (Revive L4Re target) - #159643 (Add support for splatted function pointers) - #160433 (delegation: add support for wrapping of the return value with `From::from`) - #160530 (refactor handling of target features in Session) - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`) - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items) - #160634 (miri subtree update) - #158904 (Fix FutureDropPoll shim for by-move async closures) - #160335 (dlopen offload) - #160445 (codegen: classify localized MSVC linker progress as linker_info) - #160504 (cleanup borrowck, improve c-variadic handling) - #160587 (Add regression test for associated type outlives bound at call site) - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.) - #160636 (derive(Diagnostic): link to proper docs)
|
@Kivooeo yeah used here for the text stuff |
|
you mean you used llm to generate .stderr file? |
|
@Kivooeo yeah, 1st tried doing it by my self then saw there was typo mistakes and many more then used LLM on this |
|
we have
|
|
@Kivooeo nice im really new to this repo soo didn't knew that. thanks for you guidance |
|
It is highly encouraged to ask questions on Zulip. |
yeah will try that out thanks for it. (btw i verified this with |
|
btw, @teor2345 do you have opinion on that fix? |
fix ICE in `suggest_add_reference_to_arg` for non-callable items
`tcx.fn_sig(def_id)` panicked ("unexpected sort of node in fn_sig()") when
the `def_id` in a `WhereClauseInExpr` obligation was the struct being
constructed, not the impl. This happens when a struct literal argument is
missing a field.
Guard both `fn_sig` call sites in `suggest_add_reference_to_arg` so the
suggestion only fires for callable defs.
Fixes rust-lang#160591.
…uwer Rollup of 21 pull requests Successful merges: - #159784 (Hint that memchr returns an in-bounds index) - #150885 (Revive L4Re target) - #159643 (Add support for splatted function pointers) - #160433 (delegation: add support for wrapping of the return value with `From::from`) - #160530 (refactor handling of target features in Session) - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`) - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items) - #160634 (miri subtree update) - #157641 (Do not promote extern statics) - #158904 (Fix FutureDropPoll shim for by-move async closures) - #160103 (Add regression test for GAT bound mismatched type error) - #160335 (dlopen offload) - #160445 (codegen: classify localized MSVC linker progress as linker_info) - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing) - #160504 (cleanup borrowck, improve c-variadic handling) - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements) - #160587 (Add regression test for associated type outlives bound at call site) - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.) - #160636 (derive(Diagnostic): link to proper docs) - #160644 (Clean up some manual debug impls) - #160649 (move naked function ui tests)
fix ICE in `suggest_add_reference_to_arg` for non-callable items
`tcx.fn_sig(def_id)` panicked ("unexpected sort of node in fn_sig()") when
the `def_id` in a `WhereClauseInExpr` obligation was the struct being
constructed, not the impl. This happens when a struct literal argument is
missing a field.
Guard both `fn_sig` call sites in `suggest_add_reference_to_arg` so the
suggestion only fires for callable defs.
Fixes rust-lang#160591.
…uwer Rollup of 20 pull requests Successful merges: - #159784 (Hint that memchr returns an in-bounds index) - #150885 (Revive L4Re target) - #159643 (Add support for splatted function pointers) - #160433 (delegation: add support for wrapping of the return value with `From::from`) - #160530 (refactor handling of target features in Session) - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`) - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items) - #160634 (miri subtree update) - #157641 (Do not promote extern statics) - #158904 (Fix FutureDropPoll shim for by-move async closures) - #160103 (Add regression test for GAT bound mismatched type error) - #160335 (dlopen offload) - #160445 (codegen: classify localized MSVC linker progress as linker_info) - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing) - #160504 (cleanup borrowck, improve c-variadic handling) - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements) - #160587 (Add regression test for associated type outlives bound at call site) - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.) - #160636 (derive(Diagnostic): link to proper docs) - #160644 (Clean up some manual debug impls)
fix ICE in `suggest_add_reference_to_arg` for non-callable items
`tcx.fn_sig(def_id)` panicked ("unexpected sort of node in fn_sig()") when
the `def_id` in a `WhereClauseInExpr` obligation was the struct being
constructed, not the impl. This happens when a struct literal argument is
missing a field.
Guard both `fn_sig` call sites in `suggest_add_reference_to_arg` so the
suggestion only fires for callable defs.
Fixes rust-lang#160591.
There was a problem hiding this comment.
This seems fine to merge, but it would be good to add some more test coverage soon.
As well as the impl case, it might also be worth adding a UI test for closures (if it's possible to construct one):
rust/compiler/rustc_hir/src/def.rs
Lines 367 to 372 in 65bcac4
| c @ ObligationCauseCode::WhereClauseInExpr(def_id, _, hir_id, idx) | ||
| if let hir::Node::Expr(expr) = self.tcx.hir_node(*hir_id) | ||
| && let hir::ExprKind::MethodCall(_segment, rcvr, args, ..) = expr.kind | ||
| // The `def_id` can also point at the impl, which has no fn sig. |
There was a problem hiding this comment.
It would be good to have a test case for this change.
I think the current UI test only checks the struct case.
It's slightly odd that the method impl doesn't have a fn_sig, are you sure about that?
(This is a genuine question, because I don't know for sure.)
fix ICE in `suggest_add_reference_to_arg` for non-callable items
`tcx.fn_sig(def_id)` panicked ("unexpected sort of node in fn_sig()") when
the `def_id` in a `WhereClauseInExpr` obligation was the struct being
constructed, not the impl. This happens when a struct literal argument is
missing a field.
Guard both `fn_sig` call sites in `suggest_add_reference_to_arg` so the
suggestion only fires for callable defs.
Fixes rust-lang#160591.
…uwer Rollup of 28 pull requests Successful merges: - #159784 (Hint that memchr returns an in-bounds index) - #160673 (Improve `canonical_param_env_cache`) - #150885 (Revive L4Re target) - #159643 (Add support for splatted function pointers) - #160433 (delegation: add support for wrapping of the return value with `From::from`) - #160530 (refactor handling of target features in Session) - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`) - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items) - #160683 (Add regression test for unknown feaeture name reported with other errors) - #157641 (Do not promote extern statics) - #158904 (Fix FutureDropPoll shim for by-move async closures) - #159816 (added note/help about iterator invalidation when mutating a collection inside a for loop) - #160103 (Add regression test for GAT bound mismatched type error) - #160335 (dlopen offload) - #160445 (codegen: classify localized MSVC linker progress as linker_info) - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing) - #160504 (cleanup borrowck, improve c-variadic handling) - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements) - #160587 (Add regression test for associated type outlives bound at call site) - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.) - #160633 (delegation: fix determining wrong `FnKind` when delegation is inside const arg) - #160636 (derive(Diagnostic): link to proper docs) - #160644 (Clean up some manual debug impls) - #160649 (move naked function ui tests) - #160672 (Improve `MaybeLiveLocals`) - #160693 (Add branch config for perf. unrolling in bors) - #160696 (rustc_codegen_llvm: handle sm_101* features being an alias) - #160706 (renovate: clarify that vulnerability PRs are opened automatically)
tcx.fn_sig(def_id)panicked ("unexpected sort of node in fn_sig()") whenthe
def_idin aWhereClauseInExprobligation was the struct beingconstructed, not the impl. This happens when a struct literal argument is
missing a field.
Guard both
fn_sigcall sites insuggest_add_reference_to_argso thesuggestion only fires for callable defs.
Fixes #160591.