Skip to content

regression: overflow evaluating the requirement #128887

Closed

Description

@BoxyUwU
[INFO] [stdout] error[E0275]: overflow evaluating the requirement `NaturePokeathlonStatAffect: Unpin`
[INFO] [stdout]      |
[INFO] [stdout]      = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`poke_search`)
[INFO] [stdout] note: required because it appears within the type `PhantomData<NaturePokeathlonStatAffect>`
[INFO] [stdout]     --> /rustc/08328a323ecd80b443a8fcc72c6b1071f48e233f/library/core/src/marker.rs:740:12

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Aug 9, 2024
  2. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 9, 2024
  3. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 9, 2024
  4. compiler-errors commented on Aug 9, 2024

    @compiler-errors
    Contributor

    This regressed in #126128, cc @lcnr

  5. added
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Aug 12, 2024
  6. lcnr commented on Aug 12, 2024

    @lcnr
    Contributor

    Alright, it would be very useful to get a minimization of the underlying pattern here. I think we likely want to accept this breakage 🤔

  7. theemathas commented on Aug 12, 2024

    @theemathas
    Contributor
    Outdated comment

    Somewhat minimized from the triangulate crate:

    Code (109 lines)
    use std::{convert::TryInto, marker::PhantomData};
    
    struct PolygonElement<Index>(Index);
    
    trait PolygonList<'p>: 'p {
        type Vertex: 'p;
        type Index: 'p;
        type IntoItem: Into<PolygonElement<Self::Index>>;
        type Iter<'i>: Iterator<Item = Self::IntoItem>
        where
            Self: 'i,
            Self::Vertex: 'i,
            'p: 'i;
    
        fn iter_indices<'i>(&'i self) -> Self::Iter<'i>
        where
            Self: 'i,
            Self::Vertex: 'i,
            'p: 'i;
    }
    
    struct IndexWithIter<'i, Iter, OldIndex: Mappable<Old>, New: TryInto<Old>, Old: TryInto<New>> {
        iter: Iter,
        _phantom: PhantomData<&'i (OldIndex, New, Old)>,
    }
    
    impl<'i, Iter: Iterator + 'i, OldIndex: Mappable<Old>, New: TryInto<Old>, Old: TryInto<New>>
        IndexWithIter<'i, Iter, OldIndex, New, Old>
    where
        Iter::Item: Into<PolygonElement<OldIndex>>,
        OldIndex::Output<New>: Mappable<New, Output<Old> = OldIndex>,
    {
        fn new(iter: Iter) -> Self {
            unimplemented!()
        }
    }
    
    impl<'i, Iter: Iterator + 'i, OldIndex: Mappable<New>, In: TryInto<New>, New: TryInto<In>> Iterator
        for IndexWithIter<'i, Iter, OldIndex, In, New>
    {
        type Item = PolygonElement<OldIndex::Output<In>>;
    
        fn next(&mut self) -> Option<Self::Item> {
            unimplemented!()
        }
    }
    
    struct IndexWith<
        'p,
        P: PolygonList<'p, Index = OldIndex>,
        OldIndex: Mappable<Old>,
        Old: TryInto<New>,
        New: TryInto<Old>,
    >(P, PhantomData<&'p (OldIndex, Old, New)>)
    where
        OldIndex::Output<New>: Mappable<New, Output<Old> = OldIndex>;
    
    impl<
            'p,
            P: PolygonList<'p, Index = OldIndex>,
            OldIndex: Mappable<Old>,
            New: TryInto<Old>,
            Old: TryInto<New>,
        > PolygonList<'p> for IndexWith<'p, P, OldIndex, Old, New>
    where
        OldIndex::Output<New>: Mappable<New, Output<Old> = OldIndex>,
    {
        type Vertex = P::Vertex;
        type Index = OldIndex::Output<New>;
        type IntoItem = PolygonElement<Self::Index>;
        type Iter<'i> = IndexWithIter<'i, P::Iter<'i>, OldIndex, New, Old>
        where Self: 'i, 'p: 'i;
    
        fn iter_indices<'i>(&'i self) -> Self::Iter<'i>
        where
            Self: 'i,
            Self::Vertex: 'i,
            'p: 'i,
        {
            unimplemented!()
        }
    }
    
    fn foo<
        'p,
        'i,
        P: PolygonList<'p, Index = OldIndex>,
        OldIndex: Mappable<Old>,
        New: TryInto<Old>,
        Old: TryInto<New>,
    >(
        x: IndexWith<'p, P, OldIndex, Old, New>,
    ) where
        IndexWith<'p, P, OldIndex, Old, New>: 'i,
        P::Vertex: 'i,
        'p: 'i,
        OldIndex::Output<New>: Mappable<New, Output<Old> = OldIndex>,
    {
        IndexWithIter::new(x.0.iter_indices());
    }
    
    pub trait Mappable<T> {
        type Output<U>;
    }
    
    impl<T> Mappable<T> for T {
        type Output<U> = U;
    }
  8. apiraino commented on Aug 12, 2024

    @apiraino
    Contributor

    WG-prioritization assigning priority (Zulip discussion).

    @rustbot label -I-prioritize +P-high

    Alright, it would be very useful to get a minimization of the underlying pattern here. I think we likely want to accept this breakage 🤔

    Depending on the result of the investigation, could #126128 end up in the release notes, correct? (just mentioning so we dont forget to label it as such)

  9. added
    P-highHigh priority
    and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Aug 12, 2024
  10. theemathas commented on Aug 12, 2024

    @theemathas
    Contributor

    Minimized from the triangulate crate (I'm unable to make it any smaller):

    pub trait Mappable<T> {
        type Output;
    }
    
    pub trait Mappable2<T> {
        type Output;
    }
    
    // Deleting this impl makes it compile on beta
    impl<T> Mappable2<T> for T {
        type Output = i32;
    }
    
    pub trait Generic<M> {}
    
    // Deleting the `: Mappable<T>` makes it error on stable.
    pub struct IndexWithIter<I, M: Mappable<T>, T>(I, M, T);
    
    // Changing the where clause to be an inline bound (`impl<I: Generic<M>, ....`) causes it to compile on beta
    impl<I, M: Mappable<T, Output: Mappable2<T, Output = M>>, T> IndexWithIter<I, M, T>
    where
        I: Generic<M>,
    {
        fn new(_: I) {}
    }
    
    pub fn foo<M: Mappable<T, Output: Mappable2<T, Output = M>>, T>(x: impl Generic<M>) {
        IndexWithIter::new(x);
    }

    Compiles on stable. Gives the following error on beta:

       Compiling playground v0.0.1 (/playground)
    error[E0275]: overflow evaluating the requirement `<M as Mappable<_>>::Output: Mappable2<_>`
      --> src/lib.rs:28:5
       |
    28 |     IndexWithIter::new(x);
       |     ^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`playground`)
    note: required by a bound in `IndexWithIter::<I, M, T>::new`
      --> src/lib.rs:20:45
       |
    20 | impl<I, M: Mappable<T, Output: Mappable2<T, Output = M>>, T> IndexWithIter<I, M, T>
       |                                             ^^^^^^^^^^ required by this bound in `IndexWithIter::<I, M, T>::new`
    ...
    24 |     fn new(_: I) {}
       |        --- required by a bound in this associated function
    
    For more information about this error, try `rustc --explain E0275`.
    error: could not compile `playground` (lib) due to 1 previous error
    
  11. theemathas commented on Aug 12, 2024

    @theemathas
    Contributor

    I am unable to reproduce the issues with poke_search_cli or similari on my computer.

  12. lcnr commented on Aug 12, 2024

    @lcnr
    Contributor

    slightly more readable for me 🤔

    pub trait Mappable<T> {
        type Output;
    }
    
    pub trait Mappable2<T> {
        type Output;
    }
    
    // Deleting this impl makes it compile on beta
    impl<T> Mappable2<T> for T {
        type Output = i32;
    }
    
    pub trait Generic<M> {}
    
    // Deleting the `: Mappable<T>` makes it error on stable.
    pub struct IndexWithIter<I, M: Mappable<T>, T>(I, M, T);
    
    // Changing the where clause to be an inline bound (`impl<I: Generic<M>, ....`) causes it to compile on beta
    impl<I, M, T> IndexWithIter<I, M, T>
    where
        M: Mappable<T>,
        M::Output: Mappable2<T, Output = M>,
        I: Generic<M>,
    {
        fn new(x: I) {
            IndexWithIter::<_, _, _>::new(x);
        }
    }

    this is somehow caused by the order in which we evaluate nested goals and also subtyping, but I don't fully understand why this is happening yet.

  13. 32 remaining items

  14. kylebarron commented on Oct 18, 2024

    @kylebarron

    My crate geoarrow compiled fine for 1.81 but no longer compiles on rust 1.82 because of this issue.

    git clone https://github.com/geoarrow/geoarrow-rs
    cd geoarrow-rs
    git checkout 0b6715c6a56f0115f9078803fae945700713b22f
    

    Compiles fine:

    rustup run 1.81 cargo build --release
    

    Fails to compile:

    rustup run 1.82 cargo build --release
    
    error[E0275]: overflow evaluating the requirement `<G as geo_traits::geometry::GeometryTrait>::GeometryCollection<'_>: geo_traits::geometry_collection::GeometryCollectionTrait`
        |
        = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`geoarrow`)
    note: required for `GeometryCollectionIterator<'_, f64, <<... as GeometryTrait>::GeometryCollection<'_> as GeometryCollectionTrait>::ItemType<'_>, ...>` to implement `Iterator`
       --> src/geo_traits/iterator.rs:39:15
        |
    37  |                   ItemType: 'a + $item_trait<T = T>,
        |                                              ----- unsatisfied trait bound introduced here
    38  |                   G: $self_trait<T = T, ItemType<'a> = ItemType>,
    39  |               > Iterator for $struct_name<'a, T, ItemType, G>
        |                 ^^^^^^^^     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    109 | / impl_iterator!(
    110 | |     GeometryCollectionIterator,
    111 | |     GeometryCollectionTrait,
    112 | |     GeometryTrait,
    113 | |     geometry_unchecked
    114 | | );
        | |_- in this macro invocation
        = note: required for `GeometryCollectionIterator<'_, f64, <<... as GeometryTrait>::GeometryCollection<'_> as GeometryCollectionTrait>::ItemType<'_>, ...>` to implement `IntoIterator`
        = note: the full name for the type has been written to '/Users/kyle/github/geoarrow/geoarrow-rs/target/release/deps/geoarrow-d23c01f6fb33c633.long-type-3599692272401749992.txt'
        = note: consider using `--verbose` to print the full type name to the console
        = note: the full name for the type has been written to '/Users/kyle/github/geoarrow/geoarrow-rs/target/release/deps/geoarrow-d23c01f6fb33c633.long-type-3599692272401749992.txt'
        = note: consider using `--verbose` to print the full type name to the console
        = note: this error originates in the macro `impl_iterator` (in Nightly builds, run with -Z macro-backtrace for more info)
    
    For more information about this error, try `rustc --explain E0275`.
    warning: `geoarrow` (lib) generated 3 warnings
    error: could not compile `geoarrow` (lib) due to 1 previous error; 3 warnings emitted
    

    FWIW it does compile with

    RUSTFLAGS='-Zinline-mir=no' rustup run nightly cargo build --release
    
  15. theemathas commented on Oct 20, 2024

    @theemathas
    Contributor

    I've split the latest geoarrow regression to a separate issue in #131960, to reduce confusion.

  16. apiraino commented on Sep 22, 2025

    @apiraino
    Contributor

    Given #131960, I'll bump up the priority of this one as well

    @rustbot label -I-prioritize +P-high

  17. added a commit that references this issue on Oct 1, 2025
    5b6978a
  18. added a commit that references this issue on Oct 1, 2025
    29cfb96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions