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

-Znext-solver overflow evaluating the requirement #119585

Closed
cynecx opened this issue Jan 4, 2024 · 1 comment
Closed

-Znext-solver overflow evaluating the requirement #119585

cynecx opened this issue Jan 4, 2024 · 1 comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@cynecx
Copy link
Contributor

cynecx commented Jan 4, 2024

I tried this code (with -Znext-solver):

use std::future::Future;

trait AsyncFn<I, O>: Fn(I) -> Self::Fut {
    type Fut: Future<Output = O>;
}

impl<F, Fut, I, O> AsyncFn<I, O> for F
where
    F: Fn(I) -> Fut,
    Fut: Future<Output = O>
{
    type Fut = Fut;
}

fn okay<F: for<'a> AsyncFn<&'a mut Vec<u8>, ()>>(f: F) {
    let mut data = vec![];

    let fut = f(&mut data);
}

I expected to see this happen: Compiles without errors.

Instead, this happened:

With -Znext-solver:

error[E0275]: overflow evaluating the requirement `<F as FnOnce<(&mut Vec<u8>,)>>::Output == _`
  --> a.rs:18:15
   |
18 |     let fut = f(&mut data);
   |               ^^^^^^^^^^^^
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`a`)

error[E0275]: overflow evaluating the requirement `<F as AsyncFn<&mut Vec<u8>, ()>>::Fut normalizes-to _`
  --> a.rs:18:15
   |
18 |     let fut = f(&mut data);
   |               ^^^^^^^^^^^^
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`a`)

error: aborting due to 2 previous errors

rustc --version --verbose:

rustc 1.77.0-nightly (e51e98dde 2023-12-31)
binary: rustc
commit-hash: e51e98dde6a60637b6a71b8105245b629ac3fe77
commit-date: 2023-12-31
host: aarch64-apple-darwin
release: 1.77.0-nightly
LLVM version: 17.0.6
@cynecx cynecx added the C-bug Category: This is a bug. label Jan 4, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 4, 2024
@saethlin saethlin added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-types Relevant to the types team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 7, 2024
@compiler-errors
Copy link
Member

This is tracked via rust-lang/trait-system-refactor-initiative#84

@cynecx cynecx closed this as completed Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants