-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Check that built-in callable types validate their output type is Sized
(in new solver)
#107867
Check that built-in callable types validate their output type is Sized
(in new solver)
#107867
Conversation
r? @eholk (rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
03cbc19
to
a7c3415
Compare
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.
Am in favor of landing this PR.
some related thoughts wrt naming n stuff: I am actually not too happy about the name consider_assumption
given how it is used.
If we have a builtin impl we're not really considering an assumption as it's something where we know that it holds, we're simply looking at an impl header with no nested goals.
If we were to change consider_assumption
to also take a list of nested obligations it would be pretty much how candidates in chalk (and probably a-mir-formality) work?
So maybe a name like fn consider_normal_candidate
(with a comment explaining what normal means might be better? 🤔 idk
454d4a6
to
189e26f
Compare
I renamed it to @rustbot ready |
ecx: &mut EvalCtxt<'_, 'tcx>, | ||
goal: Goal<'tcx, Self>, | ||
impl_def_id: DefId, | ||
assumption: ty::Predicate<'tcx>, | ||
requirements: Vec<Goal<'tcx, ty::Predicate<'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.
impl IntoIterator<Item = Goal>
maybe. We have a bunch of fixed len requirements which can just be [goal]
🤔
// Use a hypothesis, which consists of a "assumption" and some "requirements", | ||
// to satisfy a goal. If the requirements hold, then attempt to satisfy our | ||
// goal by equating it with the assumption. | ||
fn consider_hypothesis( |
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.
not too happy with hypothesis https://www.merriam-webster.com/dictionary/hypothesis
A hypothesis is an assumption, an idea that is proposed for the sake of argument so that it can be tested to see if it might be true.
In the scientific method, the hypothesis is constructed before any applicable research has been done, apart from a basic background review. You ask a question, read up on what has been studied before, and then form a hypothesis.
we know that the requirements -> assumption
is correct. Looking at chalk, they use clause
for this. I don't think we should do that in rustc because we already have a Clause
which (at least for now) is something slightly different.
Other ideas:
consider_(logical)_statement
(meh)consider_implication
(this will be how implications in the param env will be implemented (if and once we get them))consider_implied_clause
(changingassumption
toclause: ty::Clause
, will actually re)
I personally kinda like consider_implied_clause
🤔 It is a clause which is implied by some requirements
. But yeah, if you don't like consider_implied_clause
we can just go with whatever.
r=me after nit
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.
Yeah, consider_implied_clause is a totally fine name!
189e26f
to
6402c98
Compare
@bors r=lcnr |
☀️ Test successful - checks-actions |
Finished benchmarking commit (fcdbd1c): 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.
CyclesThis benchmark run did not return any relevant results for this metric. |
Working on parity with old solver. Putting this up for consideration, it's not really needed or anything just yet. Maybe it's better to approach this from another direction (like always checking the item bounds when calling
consider_assumption
? we may need that for coinduction to be sound though?)This basically implements #100096 for the new solver.