-
Notifications
You must be signed in to change notification settings - Fork 13.5k
evaluate_goal
avoid unnecessary step
#142774
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
base: master
Are you sure you want to change the base?
Conversation
also return `EvaluationResult` instead of the final `StackEntry` to make sure we correctly track information between reruns.
This comment has been minimized.
This comment has been minimized.
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
); | ||
canonical_goal_evaluation.query_result(canonical_response); | ||
goal_evaluation.canonical_goal_evaluation(canonical_goal_evaluation); |
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.
hmm, now that I understand the various new_foo
/foo
APIs on ProofTreeBuilder
I have questions 😆
- could these be one function taking a closure and thus being more of a transaction? The current use cases seem to say so, but I'm guessing there will be more uses and you want to keep a more general API?
- some doc comments would have helped (at least linking functions together that belong together)
- some functions take
&mut self
but do not need it canonical_goal_evalution
mutatingself
seems surprising. I would have expected something withapply
orfinish
in the name
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.
could these be one function taking a closure and thus being more of a transaction? The current use cases seem to say so, but I'm guessing there will be more uses and you want to keep a more general API?
this concrete case yes, ignoring the issue of this potentially being a perf hit 🤔 I think it should be fine... I personally feel slightly iffy about having proof tree stuff be "in control of the control flow", but expect that using closures hare is easier to read
some functions take &mut self but do not need it
unsurprising :3
canonical_goal_evalution
mutatingself
seems surprising. I would have expected something withapply
orfinish
in the name
I agree, ideally we just have WipGoalEvaluation
be the Root
and not have a separate root state.
Mind pushing these cleanups until after #142735/to not do them in this PR? I am changing the control flow inside of the search graph and don't fully know how this will impact stuff.
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.
Absolutely. I just wanted to understand things xD
let response = match canonical_result { | ||
Err(e) => return Err(e), | ||
Ok(response) => response, | ||
}; |
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.
let response = match canonical_result { | |
Err(e) => return Err(e), | |
Ok(response) => response, | |
}; | |
let response = canonical_result? |
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.
considered it, i actually kinda feel like explicitly matching is better than using ?
on a local 🤔 but fine to apply this if u think it's significantly better :3
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 do think it is, but I understand verbosity as a signal that something unusual is going on can be useful. I just see this getting changed as a drive by in the future without a comment, and if you add a comment to the one liner you have as much signal as the expanded version
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.
r=me once base PR lands
The job Click to see the possible cause of the failure (guessed by this bot)
|
based on #142617.
This does not mess with the debug logging for the trait solver and is a very nice cleanup for #142735. E.g. for
We get the following proof tree with
RUSTC_LOG=rustc_type_ir::search_graph=debug,rustc_next_trait_solver=debug