-
Notifications
You must be signed in to change notification settings - Fork 13.4k
rustc_infer: remove InferCtxt::closure_sig as the FnSig is always shallowly known. #70089
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 63811bc with merge 2056ca8947d090a687667e68d89cceab943a3928... |
☀️ Try build successful - checks-azure |
Queued 2056ca8947d090a687667e68d89cceab943a3928 with parent 7ceebd9, future comparison URL. |
Perf looks neutral, probably makes sense outside of explicit closure stress tests. |
@@ -155,6 +156,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | |||
); | |||
} | |||
|
|||
// HACK(eddyb) this forces the types equated above into `substs` but | |||
// it should rely on `ClosureSubsts` providing a constructor, instead. | |||
let substs = self.resolve_vars_if_possible(&substs); |
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.
the purpose of this code is to ensure that have a fn
type, and not an inference variable that's been equated with a fn
type?
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.
Yupp, pretty much.
@bors r+ |
📌 Commit 63811bc has been approved by |
Rollup of 8 pull requests Successful merges: - rust-lang#67888 (Prefetch some queries used by the metadata encoder) - rust-lang#69934 (Update the mir inline costs) - rust-lang#69965 (Refactorings to get rid of rustc_codegen_utils) - rust-lang#70054 (Build dist-android with --enable-profiler) - rust-lang#70089 (rustc_infer: remove InferCtxt::closure_sig as the FnSig is always shallowly known.) - rust-lang#70092 (hir: replace "items" terminology with "nodes" where appropriate.) - rust-lang#70138 (do not 'return' in 'throw_' macros) - rust-lang#70151 (Update stdarch submodule) Failed merges: - rust-lang#70074 (Expand: nix all fatal errors) r? @ghost
That is,
ClosureSubsts
is always created (inrustc_typeck::check::closure
) with aFnSig
, as the number of inputs is known, even if they might all have inference types.The only useful thing
InferCtxt::closure_sig
was doing is resolving an inference variable used just to get thety::FnPtr
containing thatFnSig
intoClosureSubsts
.The ideal way to solve this would be to add a constructor for
ClosureSubsts
, that combines the parentSubsts
, the closure kind, the signature, and capture types together, but for now I've went with resolving the inference types just after unifying them with the real types.r? @nikomatsakis