-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Use fulfillment in next trait solver coherence #121193
Conversation
cc @BoxyUwU who may also care about this |
For clarity, lcnr asked for this because it unbreaks some tests that are broken by their generalizer PR. They expressed some concern by coherence becoming more powerful here, but I am personally not worried about 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.
r=me after nit, cc rust-lang/trait-system-refactor-initiative#93
infcx.evaluate_obligation(obligation) | ||
} else { | ||
if infcx.next_trait_solver() { | ||
infcx.probe(|_| { |
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.
why the probe, i would expect that not using a probe results in better err msg and is desirable. E.g. if we infer _: Trait
to Foreign: Trait
we should check whether there are any intercrate ambiguity causes for Foreign
9bbdd9e
to
47e0f00
Compare
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
let (_, proof_tree) = self.evaluate_root_goal(goal, GenerateProofTree::Yes); | ||
let proof_tree = proof_tree.unwrap(); | ||
visitor.visit_goal(&InspectGoal::new(self, 0, &proof_tree)) | ||
self.probe(|_| { |
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.
Added the probe here in visit_proof_tree
so that it has no side effects.
47e0f00
to
228441d
Compare
whoops forgor the test (I'm an idiot whoops misclick) |
@bors r+ rollup (new solver) |
…ent, r=lcnr Use fulfillment in next trait solver coherence Use fulfillment in the new trait solver's `impl_intersection_has_impossible_obligation` routine. This means that inference that falls out of processing other obligations can influence whether we can determine if an obligation is impossible to satisfy. See the committed test. This should be completely sound, since evaluation and fulfillment both respect intercrate mode equally. We run the risk of breaking coherence later if we were to change the rules of fulfillment and/or inference during coherence, but this is a problem which affects evaluation, as nested obligations from a trait goal are processed together and can influence each other in the same way. r? lcnr cc rust-lang#114862 Also changed obligationctxt -> fulfillmentctxt because it feels kind of redundant to use an ocx here. I don't really care enough and can change it back if it really matters much.
…ent, r=lcnr Use fulfillment in next trait solver coherence Use fulfillment in the new trait solver's `impl_intersection_has_impossible_obligation` routine. This means that inference that falls out of processing other obligations can influence whether we can determine if an obligation is impossible to satisfy. See the committed test. This should be completely sound, since evaluation and fulfillment both respect intercrate mode equally. We run the risk of breaking coherence later if we were to change the rules of fulfillment and/or inference during coherence, but this is a problem which affects evaluation, as nested obligations from a trait goal are processed together and can influence each other in the same way. r? lcnr cc rust-lang#114862 Also changed obligationctxt -> fulfillmentctxt because it feels kind of redundant to use an ocx here. I don't really care enough and can change it back if it really matters much.
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#120952 (Don't use mem::zeroed in vec::IntoIter) - rust-lang#121079 (distribute tool documentations and avoid file conflicts on `x install`) - rust-lang#121085 (errors: only eagerly translate subdiagnostics) - rust-lang#121091 (use build.rustc config and skip-stage0-validation flag) - rust-lang#121193 (Use fulfillment in next trait solver coherence) - rust-lang#121209 (Make `CodegenBackend::join_codegen` infallible.) - rust-lang#121210 (Fix `cfg(target_abi = "sim")` on `i386-apple-ios`) - rust-lang#121228 (create stamp file for clippy) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#120952 (Don't use mem::zeroed in vec::IntoIter) - rust-lang#121085 (errors: only eagerly translate subdiagnostics) - rust-lang#121091 (use build.rustc config and skip-stage0-validation flag) - rust-lang#121149 (Fix typo in VecDeque::handle_capacity_increase() doc comment.) - rust-lang#121193 (Use fulfillment in next trait solver coherence) - rust-lang#121209 (Make `CodegenBackend::join_codegen` infallible.) - rust-lang#121210 (Fix `cfg(target_abi = "sim")` on `i386-apple-ios`) - rust-lang#121228 (create stamp file for clippy) - rust-lang#121231 (remove a couple of redundant clones) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#121193 - compiler-errors:coherence-fulfillment, r=lcnr Use fulfillment in next trait solver coherence Use fulfillment in the new trait solver's `impl_intersection_has_impossible_obligation` routine. This means that inference that falls out of processing other obligations can influence whether we can determine if an obligation is impossible to satisfy. See the committed test. This should be completely sound, since evaluation and fulfillment both respect intercrate mode equally. We run the risk of breaking coherence later if we were to change the rules of fulfillment and/or inference during coherence, but this is a problem which affects evaluation, as nested obligations from a trait goal are processed together and can influence each other in the same way. r? lcnr cc rust-lang#114862 Also changed obligationctxt -> fulfillmentctxt because it feels kind of redundant to use an ocx here. I don't really care enough and can change it back if it really matters much.
Use fulfillment in the new trait solver's
impl_intersection_has_impossible_obligation
routine. This means that inference that falls out of processing other obligations can influence whether we can determine if an obligation is impossible to satisfy. See the committed test.This should be completely sound, since evaluation and fulfillment both respect intercrate mode equally.
We run the risk of breaking coherence later if we were to change the rules of fulfillment and/or inference during coherence, but this is a problem which affects evaluation, as nested obligations from a trait goal are processed together and can influence each other in the same way.
r? lcnr
cc #114862
Also changed obligationctxt -> fulfillmentctxt because it feels kind of redundant to use an ocx here. I don't really care enough and can change it back if it really matters much.