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

Hack out effects support for old solver #132119

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

compiler-errors
Copy link
Member

Opening this for vibes ✨

Turns out that a basic, somewhat incomplete implementation of host effects is achievable in the old trait solver pretty easily. This should be sufficient for us to use in the standard library itself.

Regarding incompleteness, maybe we should always treat host predicates as ambiguous in intercrate mode (at least in the old solver) to avoid any worries about accidental impl overlap or something.

r? @lcnr cc @fee1-dead

@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 Oct 24, 2024
Comment on lines 84 to 99
if candidate.is_some() {
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

nyaaa?

either add a comment or modify the impl

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah this impl is scuffed lol

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 should've been a return Err(EvaluationFailure::Ambiguous), so we bail on ambiguity if there are 2 applicable w.c.

todo!()
ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(data)) => {
self.infcx.enter_forall(bound_predicate.rebind(data), |data| {
match effects::evaluate_host_effect_obligation(
Copy link
Contributor

Choose a reason for hiding this comment

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

pretty sure that can cause undetected overflow 🤔 too tired to explain my thoughts here via comment for today, can do so in sync or maybe you're able to come up with a test yourself

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, though it's the same way that we can encounter overflow in projection afaict.

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 is just a consequence of not tracking effect goals (or projections) on the trait stack.

Copy link
Member

@fee1-dead fee1-dead left a comment

Choose a reason for hiding this comment

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

The test changes appear correct to me. For the solver parts I did not see anything else than what lcnr commented on (in my limited understanding of the trait solver infra)

@bors
Copy link
Contributor

bors commented Oct 26, 2024

☔ The latest upstream changes (presumably #132184) made this pull request unmergeable. Please resolve the merge conflicts.

.instantiate(tcx, impl_.args)
.into_iter()
.map(|(trait_ref, _)| {
obligation.with(
Copy link
Member Author

Choose a reason for hiding this comment

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

Increment the depth correctly

Copy link
Member Author

Choose a reason for hiding this comment

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

Did this more manually. It's kinda ugly but 🤷

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.

pls do:

  • incr obligation depth when recursing in evaluate host effect
  • ICE when used with intercrate mode

r=me after

@compiler-errors
Copy link
Member Author

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Oct 29, 2024

📌 Commit 8b7b8e5 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 Oct 29, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Oct 29, 2024
…, r=lcnr

Hack out effects support for old solver

Opening this for vibes ✨

Turns out that a basic, somewhat incomplete implementation of host effects is achievable in the old trait solver pretty easily. This should be sufficient for us to use in the standard library itself.

Regarding incompleteness, maybe we should always treat host predicates as ambiguous in intercrate mode (at least in the old solver) to avoid any worries about accidental impl overlap or something.

r? `@lcnr` cc `@fee1-dead`
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Oct 29, 2024
…, r=lcnr

Hack out effects support for old solver

Opening this for vibes ✨

Turns out that a basic, somewhat incomplete implementation of host effects is achievable in the old trait solver pretty easily. This should be sufficient for us to use in the standard library itself.

Regarding incompleteness, maybe we should always treat host predicates as ambiguous in intercrate mode (at least in the old solver) to avoid any worries about accidental impl overlap or something.

r? ``@lcnr`` cc ``@fee1-dead``
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 29, 2024
…kingjubilee

Rollup of 10 pull requests

Successful merges:

 - rust-lang#131375 (compiler: apply clippy::clone_on_ref_ptr for CI)
 - rust-lang#132119 (Hack out effects support for old solver)
 - rust-lang#132151 (Ensure that resume arg outlives region bound for coroutines)
 - rust-lang#132216 (correct LLVMRustCreateThinLTOData arg types)
 - rust-lang#132233 (Split `boxed.rs` into a few modules)
 - rust-lang#132266 (riscv-soft-abi-with-float-features.rs: adapt for LLVM 20)
 - rust-lang#132270 (clarified doc for `std::fs::OpenOptions.truncate()`)
 - rust-lang#132274 (Cleanup op lookup in HIR typeck)
 - rust-lang#132284 (Remove my ping for rustdoc/clean/types.rs)
 - rust-lang#132293 (Remove myself from mentions inside `tests/ui/check-cfg` directory)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 29, 2024
…kingjubilee

Rollup of 12 pull requests

Successful merges:

 - rust-lang#131375 (compiler: apply clippy::clone_on_ref_ptr for CI)
 - rust-lang#131520 (Mark `str::is_char_boundary` and `str::split_at*` unstably `const`.)
 - rust-lang#132119 (Hack out effects support for old solver)
 - rust-lang#132194 (Collect item bounds for RPITITs from trait where clauses just like associated types)
 - rust-lang#132216 (correct LLVMRustCreateThinLTOData arg types)
 - rust-lang#132233 (Split `boxed.rs` into a few modules)
 - rust-lang#132266 (riscv-soft-abi-with-float-features.rs: adapt for LLVM 20)
 - rust-lang#132270 (clarified doc for `std::fs::OpenOptions.truncate()`)
 - rust-lang#132284 (Remove my ping for rustdoc/clean/types.rs)
 - rust-lang#132293 (Remove myself from mentions inside `tests/ui/check-cfg` directory)
 - rust-lang#132312 (Delete `tests/crashes/23707.rs` because it's flaky)
 - rust-lang#132313 (compiletest: Rename `command-list.rs` to `directive-list.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e97286e into rust-lang:master Oct 29, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Oct 29, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 29, 2024
Rollup merge of rust-lang#132119 - compiler-errors:effects-old-solver, r=lcnr

Hack out effects support for old solver

Opening this for vibes ✨

Turns out that a basic, somewhat incomplete implementation of host effects is achievable in the old trait solver pretty easily. This should be sufficient for us to use in the standard library itself.

Regarding incompleteness, maybe we should always treat host predicates as ambiguous in intercrate mode (at least in the old solver) to avoid any worries about accidental impl overlap or something.

r? ```@lcnr``` cc ```@fee1-dead```
djkoloski pushed a commit to djkoloski/rust that referenced this pull request Oct 29, 2024
…kingjubilee

Rollup of 12 pull requests

Successful merges:

 - rust-lang#131375 (compiler: apply clippy::clone_on_ref_ptr for CI)
 - rust-lang#131520 (Mark `str::is_char_boundary` and `str::split_at*` unstably `const`.)
 - rust-lang#132119 (Hack out effects support for old solver)
 - rust-lang#132194 (Collect item bounds for RPITITs from trait where clauses just like associated types)
 - rust-lang#132216 (correct LLVMRustCreateThinLTOData arg types)
 - rust-lang#132233 (Split `boxed.rs` into a few modules)
 - rust-lang#132266 (riscv-soft-abi-with-float-features.rs: adapt for LLVM 20)
 - rust-lang#132270 (clarified doc for `std::fs::OpenOptions.truncate()`)
 - rust-lang#132284 (Remove my ping for rustdoc/clean/types.rs)
 - rust-lang#132293 (Remove myself from mentions inside `tests/ui/check-cfg` directory)
 - rust-lang#132312 (Delete `tests/crashes/23707.rs` because it's flaky)
 - rust-lang#132313 (compiletest: Rename `command-list.rs` to `directive-list.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants