-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Disentangle InferCtxt, MemCategorizationContext and ExprUseVisitor. #42563
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
Conversation
cc @Mark-Simulacrum @tomprince This could use some cratering/cargobombing. EDIT: Although, if crater works again, I could do that now myself. |
Note that some lints use visitors because they need a second pass (e.g. to find usages of something). Those Lint's could be rewritten to store the relevant information, thus reducing them to single-pass, but this isn't exactly trivial. |
@llogiq EDIT: as in, it's not feasible to replace it without replicating large portions of it. |
Crater report only has network errors and |
@bors try |
Disentangle InferCtxt, MemCategorizationContext and ExprUseVisitor. At some point in the past, `InferCtxt` started being used to replace an old "`Typer`" abstraction, which provided access to `TypeckTables` and had optionally type inference to account for. That didn't play so nicely with the `'gcx`/`'tcx` split and I had to introduce `borrowck_fake_infer_ctxt`. The situation wasn't great but it wasn't too painful inside `rustc` itself. Recently I've found that method being used in clippy, which does need EUV (before we make it plausible to run lints on HAIR or MIR), and set out to separate inference from tables, for the sake of lint authors. Also fixes #42435 to make it trivial to compute type layout or use EUV from lints. The remaining uses of `TypeckTables` in `InferCtxt` are for closure kinds and signatures, used in trait selection and projection normalization. The solution there is likely to add them as bounds to `ParamEnv`. r? @nikomatsakis cc @mcarton @llogiq @Manishearth
self.infcx.is_tainted_by_errors() | ||
} | ||
|
||
fn closure_kind(&self, def_id: DefId, span: Span) -> ty::ClosureKind { |
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.
did this get copied from the version in infcx? I don't see any corresponding -
lines...?
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.
Yes but it works a bit differently - ideally in_progress_tables
would be used nowhere.
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 might be able to make it simpler and check tables
then tcx
without caring about infcx
, since now I am always inserting the kinds in the tables
ahead of time.
r=me modulo crater etc |
💥 Test timed out |
Second crater report doesn't have any real regressions either. |
@bors r=nikomatsakis |
📌 Commit fc5c31c has been approved by |
Disentangle InferCtxt, MemCategorizationContext and ExprUseVisitor. At some point in the past, `InferCtxt` started being used to replace an old "`Typer`" abstraction, which provided access to `TypeckTables` and had optionally type inference to account for. That didn't play so nicely with the `'gcx`/`'tcx` split and I had to introduce `borrowck_fake_infer_ctxt`. The situation wasn't great but it wasn't too painful inside `rustc` itself. Recently I've found that method being used in clippy, which does need EUV (before we make it plausible to run lints on HAIR or MIR), and set out to separate inference from tables, for the sake of lint authors. Also fixes #42435 to make it trivial to compute type layout or use EUV from lints. The remaining uses of `TypeckTables` in `InferCtxt` are for closure kinds and signatures, used in trait selection and projection normalization. The solution there is likely to add them as bounds to `ParamEnv`. r? @nikomatsakis cc @mcarton @llogiq @Manishearth
☀️ Test successful - status-appveyor, status-travis |
I let the cargobomb run I started complete, and the results are here. |
@tomprince Thanks! Those all look like false positives, so I'm confident this is fine. |
At some point in the past,
InferCtxt
started being used to replace an old "Typer
" abstraction, which provided access toTypeckTables
and had optionally type inference to account for.That didn't play so nicely with the
'gcx
/'tcx
split and I had to introduceborrowck_fake_infer_ctxt
.The situation wasn't great but it wasn't too painful inside
rustc
itself.Recently I've found that method being used in clippy, which does need EUV (before we make it plausible to run lints on HAIR or MIR), and set out to separate inference from tables, for the sake of lint authors.
Also fixes #42435 to make it trivial to compute type layout or use EUV from lints.
The remaining uses of
TypeckTables
inInferCtxt
are for closure kinds and signatures, used in trait selection and projection normalization. The solution there is likely to add them as bounds toParamEnv
.r? @nikomatsakis
cc @mcarton @llogiq @Manishearth