Fix opaque type ICE in late lints under the next-generation trait solver - #159840
Conversation
|
r? @nnethercote rustbot has assigned @nnethercote. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Is the clippy ICE not caused by the fallback to |
|
Thanks! Could you add a next solver revision in the Also the reason we trigger ICE is that we have non-empty opaque storage when dropping We should also update the comments in the |
|
I definitely did not read the condition correctly. It wouldn't even matter anyway since it's in a function defining an opaque type. The ICE is fixed by normalizing the return type first. Given that we have |
No, we're not using |
Ah, I'm blind. you mean normalizing the return type. that will only fix cases that the opaques types are return types. |
|
The type is currently retrieved via: let ret_ty = cx.tcx.normalize_erasing_regions(cx.typing_env(), cx.tcx.fn_sig(fn_def_id).instantiate_identity()).output();
cx.tcx.instantiate_bound_regions_with_erased(ret_ty)Switching it to: let ret_ty = cx.tcx.normalize_erasing_regions(cx.typing_env(), cx.tcx.fn_sig(fn_def_id).instantiate_identity()).output();
cx.tcx.instantiate_bound_regions_with_erased(ret_ty)Gets rid of the ICE. |
|
The crashing lint looks for functions returning |
I thought the new solver generally wanted things normalized first. There's quite a few times where we want to explicitly skip normalization since we want what was actually typed, but we also do quite a few trait queries. |
|
r? @adwinwhite ...who clearly knows much more about this than I do :) |
|
Thanks for the clarification. But actually the root cause of this ICE affects more than the
Any use of defining opaque types under
Yeah, just that it's not always achievable 😔 |
|
cc @rust-lang/clippy |
I assume the point of what both the typeck and borrowck modes are doing is to gather up all the different types that flow into the opaque type. If that's the the case then lint passes are using the wrong mode since we don't ever do that. If a lint ever needed to it could still switch to a different mode. |
|
@bors r+ rollup |
…-mode, r=adwinwhite Fix opaque type ICE in late lints under the next-generation trait solver fixes rust-lang/rust-clippy#17411 Under the next trait solver, late lints trigger an ICE due to having non-empty opaque storage when dropping `InferCtxt`. Rather than forcing all current and future late lints to manually use `ignoring_regions`, use `PostBorrowck` in `LateContext`. cc @adwinwhite
…uwer Rollup of 8 pull requests Successful merges: - #159085 (Fix decoding attributes of `SyntheticCoroutineBody`) - #159554 (feat: Update method signature of int_from_ascii) - #159637 (Some place analysis tweaks) - #159961 (sanitize_standard_fds: Miri supports poll now) - #159967 (rustc_target: callconv: mips64: Return structs with single f128 in FPRs) - #159253 (Add suggestions for using `#[export_name]` instead of `#[link_name]` on static) - #159840 (Fix opaque type ICE in late lints under the next-generation trait solver) - #159956 (Fix observable intermediate state in `thread::add_spawn_hook`)
…uwer Rollup of 8 pull requests Successful merges: - #159085 (Fix decoding attributes of `SyntheticCoroutineBody`) - #159554 (feat: Update method signature of int_from_ascii) - #159637 (Some place analysis tweaks) - #159961 (sanitize_standard_fds: Miri supports poll now) - #159967 (rustc_target: callconv: mips64: Return structs with single f128 in FPRs) - #159253 (Add suggestions for using `#[export_name]` instead of `#[link_name]` on static) - #159840 (Fix opaque type ICE in late lints under the next-generation trait solver) - #159956 (Fix observable intermediate state in `thread::add_spawn_hook`)
…-mode, r=adwinwhite Fix opaque type ICE in late lints under the next-generation trait solver fixes rust-lang/rust-clippy#17411 Under the next trait solver, late lints trigger an ICE due to having non-empty opaque storage when dropping `InferCtxt`. Rather than forcing all current and future late lints to manually use `ignoring_regions`, use `PostBorrowck` in `LateContext`. cc @adwinwhite
…uwer Rollup of 14 pull requests Successful merges: - #158417 (Avoid ICE when cfg_eval recovers no item from derive input) - #159085 (Fix decoding attributes of `SyntheticCoroutineBody`) - #159554 (feat: Update method signature of int_from_ascii) - #159637 (Some place analysis tweaks) - #159649 (Normalize region obligations before regionck) - #159961 (sanitize_standard_fds: Miri supports poll now) - #159967 (rustc_target: callconv: mips64: Return structs with single f128 in FPRs) - #159253 (Add suggestions for using `#[export_name]` instead of `#[link_name]` on static) - #159804 (Expand docs for fs::metadata and fs::symlink_metadata) - #159821 (Update expect message using the recommended style in binary_heap module) - #159840 (Fix opaque type ICE in late lints under the next-generation trait solver) - #159956 (Fix observable intermediate state in `thread::add_spawn_hook`) - #159991 (std: make send_process_group_signal unsupported on VxWorks) - #159996 (Detect when a macro without exclamation mark uses square brackets)
Rollup merge of #159840 - Gri-ffin:lint-post-borrowck-typing-mode, r=adwinwhite Fix opaque type ICE in late lints under the next-generation trait solver fixes rust-lang/rust-clippy#17411 Under the next trait solver, late lints trigger an ICE due to having non-empty opaque storage when dropping `InferCtxt`. Rather than forcing all current and future late lints to manually use `ignoring_regions`, use `PostBorrowck` in `LateContext`. cc @adwinwhite
…uwer Rollup of 14 pull requests Successful merges: - rust-lang/rust#158417 (Avoid ICE when cfg_eval recovers no item from derive input) - rust-lang/rust#159085 (Fix decoding attributes of `SyntheticCoroutineBody`) - rust-lang/rust#159554 (feat: Update method signature of int_from_ascii) - rust-lang/rust#159637 (Some place analysis tweaks) - rust-lang/rust#159649 (Normalize region obligations before regionck) - rust-lang/rust#159961 (sanitize_standard_fds: Miri supports poll now) - rust-lang/rust#159967 (rustc_target: callconv: mips64: Return structs with single f128 in FPRs) - rust-lang/rust#159253 (Add suggestions for using `#[export_name]` instead of `#[link_name]` on static) - rust-lang/rust#159804 (Expand docs for fs::metadata and fs::symlink_metadata) - rust-lang/rust#159821 (Update expect message using the recommended style in binary_heap module) - rust-lang/rust#159840 (Fix opaque type ICE in late lints under the next-generation trait solver) - rust-lang/rust#159956 (Fix observable intermediate state in `thread::add_spawn_hook`) - rust-lang/rust#159991 (std: make send_process_group_signal unsupported on VxWorks) - rust-lang/rust#159996 (Detect when a macro without exclamation mark uses square brackets)
fixes rust-lang/rust-clippy#17411
Under the next trait solver, late lints trigger an ICE due to having non-empty opaque storage when dropping
InferCtxt.Rather than forcing all current and future late lints to manually use
ignoring_regions, usePostBorrowckinLateContext.cc @adwinwhite