Skip to content

cargo check works fine, but cargo build gives "overflow evaluating the requirement " #139658

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

Open
theemathas opened this issue Apr 11, 2025 · 1 comment
Labels
C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@theemathas
Copy link
Contributor

theemathas commented Apr 11, 2025

I tried this code:

trait Trait {
    type Output;
}

impl<O, F: Fn() -> O> Trait for F {
    type Output = O;
}

struct Wrap<P>(P);

impl<P: Trait> Trait for Wrap<P> {
    type Output = P::Output;
}

fn wrap<P: Trait>(x: P) -> impl Trait {
    Wrap(x)
}

fn consume<P: Trait>(_: P) -> P::Output {
    unimplemented!()
}

pub fn recurse() -> impl Sized {
    consume(wrap(recurse))
}

I think that the code should compile fine. However:

  • When compiling with cargo check, it compiles fine.
  • When compiling with cargo build, I get the following error:
error[E0275]: overflow evaluating the requirement `fn() -> impl Sized {recurse}: Trait`
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`foo`)
note: required for `Wrap<fn() -> impl Sized {recurse}>` to implement `Trait`
  --> src/lib.rs:11:16
   |
11 | impl<P: Trait> Trait for Wrap<P> {
   |         -----  ^^^^^     ^^^^^^^
   |         |
   |         unsatisfied trait bound introduced here

For more information about this error, try `rustc --explain E0275`.

Minimized from real code written by fearless_process on the rust community discord.

Very similar to #139659, which instead ICEs.

Meta

rustc --version --verbose:

rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: aarch64-apple-darwin
release: 1.86.0
LLVM version: 19.1.7

The issue also reproduces on rustc 1.88.0-nightly (0fe8f3454 2025-04-10).

@theemathas theemathas added the C-bug Category: This is a bug. label Apr 11, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 11, 2025
@theemathas
Copy link
Contributor Author

Another variant:

trait Trait<'a> {
    type Output;
}

impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
    type Output = O;
}

struct Wrap<P>(P);

impl<'a, P: Trait<'a>> Trait<'a> for Wrap<P> {
    type Output = P::Output;
}

fn wrap<'a, P: Trait<'a>>(x: P) -> impl Trait<'a> {
    Wrap(x)
}

fn consume<'a, P: Trait<'a>>(_: P) -> P::Output {
    unimplemented!()
}

pub fn recurse<'a>(_: &'a str) -> impl Sized + 'a {
    consume(wrap(recurse))
}
Output:
error[E0275]: overflow evaluating the requirement `for<'a> Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>: Trait<'a>`
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`foo`)
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `for<'a> Trait<'a>`
  = note: required because it appears within the type `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}`
note: required for `for<'a> fn(&'a str) -> impl Sized + 'a {recurse}` to implement `Trait<'_>`
 --> src/lib.rs:5:34
  |
5 | impl<'a, O, F: Fn(&'a str) -> O> Trait<'a> for F {
  |                               -  ^^^^^^^^^     ^
  |                               |
  |                               unsatisfied trait bound introduced here
  = note: 1 redundant requirement hidden
  = note: required for `Wrap<for<'a> fn(&'a str) -> impl Sized + 'a {recurse}>` to implement `Trait<'_>`

For more information about this error, try `rustc --explain E0275`.

@lolbinarycat lolbinarycat added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 11, 2025
@saethlin saethlin added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Apr 11, 2025
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. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. 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