Skip to content
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 ObligationCtxt in favor of TraitEngine in many more places #124588

Merged
merged 2 commits into from
May 3, 2024

Conversation

compiler-errors
Copy link
Member

r? lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 1, 2024
@rustbot
Copy link
Collaborator

rustbot commented May 1, 2024

Some changes occurred in engine.rs, potentially modifying the public API of ObligationCtxt.

cc @lcnr, @compiler-errors

@@ -182,6 +195,11 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
self.engine.borrow_mut().select_all_or_error(self.infcx)
}

#[must_use]
pub fn pending_obligations(&self) -> Vec<PredicateObligation<'tcx>> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also consume the ocx, since registering more goals (or doing anything else) will be ignored.

compiler/rustc_infer/src/traits/mod.rs Show resolved Hide resolved
@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't yet replace the uses of FulfillmentCtxt, did you?

can do that in separate PRs, r=me after nits

compiler/rustc_hir_analysis/src/autoderef.rs Outdated Show resolved Hide resolved
compiler/rustc_infer/src/traits/mod.rs Show resolved Hide resolved
let mut fulfill_cx = crate::solve::FulfillmentCtxt::new(self);
fulfill_cx.register_predicate_obligation(self, obligation.clone());
// True errors
// FIXME(-Znext-solver): Overflows are reported as ambig here, is that OK?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either handle this FIXME or keep it :<

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine to remove. We don't have EvaluatedToErrStackDependent anymore, and EvaluatedToAmbigStackDependent only matters for the purposes of caching in the solver.

@rustbot rustbot added the WG-trait-system-refactor The Rustc Trait System Refactor Initiative label May 2, 2024
@rustbot
Copy link
Collaborator

rustbot commented May 2, 2024

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@compiler-errors
Copy link
Member Author

Only usage of FulfillmentCtxt seems to be the one in the deep normalizer, which afaict we can't change (??) -- am I forgetting something?

@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me, wait for me to make a small changes to coherence

fmease added a commit to fmease/rust that referenced this pull request May 2, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 2, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 2, 2024
Rollup merge of rust-lang#124623 - lcnr:coherence-uwu, r=compiler-errors

shallow resolve in orphan check

r? ``@compiler-errors`` cc rust-lang#124588 (review)
@compiler-errors
Copy link
Member Author

Rebased onto #124623

@bors r=lcnr

@bors
Copy link
Contributor

bors commented May 3, 2024

📌 Commit 9286151 has been approved by lcnr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 3, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#124461 (handle the targets that are missing in stage0)
 - rust-lang#124492 (Generalize `adjust_from_tcx` for `Allocation`)
 - rust-lang#124588 (Use `ObligationCtxt` in favor of `TraitEngine` in many more places)
 - rust-lang#124612 (Add support for inputing via stdin with run-make-support)
 - rust-lang#124613 (Allow fmt to run on rmake.rs test files)
 - rust-lang#124649 (Fix HorizonOS build broken by rust-lang#124210)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 08d9992 into rust-lang:master May 3, 2024
6 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 3, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2024
Rollup merge of rust-lang#124588 - compiler-errors:ocx, r=lcnr

Use `ObligationCtxt` in favor of `TraitEngine` in many more places

r? lcnr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants