-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
EarlyBinder
prevent misuse
#101901
EarlyBinder
prevent misuse
#101901
Conversation
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
ty::FnDef(def_id, substs) => tcx.normalize_erasing_regions( | ||
tcx.param_env(def_id), | ||
tcx.bound_fn_sig(def_id).subst(tcx, 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.
e.g. this was wrong in that it could result in unnormalized types, we should be able to write a testcase for this 🤷 but that seems like effort, so i am not going to do it
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.
and woops, wrong param env xd
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.
ok, it feels wrong but polymorphization breaks with this change, ah whatever.
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.
Any idea of a "proper" solution for polymorphism?
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.
well, two ideas:
- don't normalize while computing whether we may polymorphize
- only use the normalized types after polymorphization
thinking about this, it would be correct to normalize twice here: once to get to the state assumed by polymorphization, and then once after the subst
call to actually have a fully normalized type.
Actually, the result of fn_sig_for_fn_abi
is only used by fn_abi_new_uncached
which does the following 😁
let sig = self.tcx.normalize_erasing_late_bound_regions(self.param_env, sig);
so we don't have to normalize here at all, except to deal with 2
. added a comment mentioning this.
This comment has been minimized.
This comment has been minimized.
b2cf8e7
to
872aa52
Compare
☔ The latest upstream changes (presumably #98588) made this pull request unmergeable. Please resolve the merge conflicts. |
I think this is fine to land now, since the polymorphism thing is already labeled with a r=me once rebased |
I would like at least some idea of what the plan to fix polymorphism might look like though. (Though, I really do like the goal of this PR) |
872aa52
to
647052f
Compare
@bors r=compiler-errors |
☀️ Test successful - checks-actions |
Tested on commit rust-lang/rust@11bb80a. Direct link to PR: <rust-lang/rust#101901> 💔 miri on windows: test-fail → build-fail (cc @oli-obk @RalfJung). 💔 miri on linux: test-fail → build-fail (cc @oli-obk @RalfJung).
Finished benchmarking commit (11bb80a): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
Footnotes |
folding a type before substituting is pretty much always wrong and could happen by accident, e.g. see #99798 (comment)
this PR removes the
TypeFoldable
andTypeVisitable
impl fromEarlyBinder
.r? types cc @jackh726