-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustc_infer
cleanups
#131226
rustc_infer
cleanups
#131226
Conversation
changes to the core type system changes to the core type system |
@@ -377,7 +377,7 @@ impl<'tcx> InferCtxt<'tcx> { | |||
/// | |||
/// We ignore any type parameters because impl trait values are assumed to | |||
/// capture all the in-scope type parameters. | |||
pub struct ConstrainOpaqueTypeRegionVisitor<'tcx, OP: FnMut(ty::Region<'tcx>)> { | |||
struct ConstrainOpaqueTypeRegionVisitor<'tcx, OP: FnMut(ty::Region<'tcx>)> { | |||
pub tcx: TyCtxt<'tcx>, |
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.
now that the type is private, it's fields can be as well. Also... interesting that we don't have a lint for this case
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 unreachable_pub
lint was deliberately changed to not warn on this case in #126040, because it was deemed annoying. Specifically:
This PR restrict the
unreachable_pub
lint by not linting onpub
fields ofpub(restricted)
structs and unions. This is done because that can quickly clutter the code for an uncertain value, in particular since the "real" visibility is defined by the parent (the struct it-self).
The implementation does more than that description indicates -- it also doesn't lint on pub
fields of non-pub
structs and unions. Perhaps it should?
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.
some nits, then r=me
☔ The latest upstream changes (presumably #131269) made this pull request unmergeable. Please resolve the merge conflicts. |
It's simpler, for this tiny module.
Three of the modules don't need to be `pub`, and then `warn(unreachable_pub)` identifies a bunch more things that also shouldn't be `pub`, plus a couple of things that are unused.
It helps people reading the code understand how widely things are used.
It's no longer used meaningfully. This also means `DiagCtxtHandle::err_count_excluding_lint_errs` can be removed.
`FixupError` is isomorphic with `TyOrConstInferVar`, so this commit changes it to just be a wrapper around `TyOrConstInferVar`. Also, move the `Display` impl for `FixupError` next to `FixupError`.
It has a single use.
Inline and remove `next_const_var_id`, `next_int_var_id`, `next_float_var_id`, all of which have a single call site.
Matches involving `GenericArgKind` pairs typically use a single `_` for the impossible case. This commit shortens two verbose matches in this way.
ebd7a1e
to
3fdcde7
Compare
I addressed the comments and rebased. @bors r=lcnr |
☀️ Test successful - checks-actions |
Finished benchmarking commit (8841a3d): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (primary 4.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary -6.8%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 773.837s -> 775.129s (0.17%) |
Huh, those perf results look like they could be genuine improvements? Not sure how that would happen, this commit is the only one I can imagine might have a perf impact, and even then it would be surprising. |
(ty::GenericArgKind::Const(unpacked), x) => { | ||
bug!("impossible case reached: can't relate: {:?} with {:?}", unpacked, x) | ||
} | ||
_ => bug!("impossible case reached: can't relate: {a:?} with {b:?}"), |
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.
this may also cause the improvement. I would expect that this is some incredibly hot code and likely these paths couldn't get deduplicated because of line information?
…ups, r=lcnr More `rustc_infer` cleanups A sequel to rust-lang#131226. r? `@lcnr`
Rollup merge of rust-lang#131348 - nnethercote:rustc_infer-more-cleanups, r=lcnr More `rustc_infer` cleanups A sequel to rust-lang#131226. r? `@lcnr`
Perf improvements outweigh the regressions so marking this as triaged @rustbot label: +perf-regression-triaged |
Various small improvements I found while reading over this code.
r? @lcnr