rust-lang / trait-system-refactor-initiative

The Rustc Trait System Refactor Initiative
21 stars 0 forks source link

Normalizes-to overflow with rigid alias with redundant bound #83

Closed compiler-errors closed 1 week ago

compiler-errors commented 8 months ago
pub fn choice<I>(iter: I) -> Option<I::Item>
where
    I: IntoIterator,
    I::IntoIter: Iterator,
{
    todo!()
}
error[E0275]: overflow evaluating the requirement `<I as IntoIterator>::Item normalizes-to _`
 --> <source>:1:30
  |
1 | pub fn choice<I>(iter: I) -> Option<I::Item>
  |                              ^^^^^^^^^^^^^^^
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`example`)
compiler-errors commented 8 months ago

extracted from fastrand crate

lcnr commented 8 months ago

Think this is https://github.com/rust-lang/trait-system-refactor-initiative/issues/76

normalizing <I as IntoIterator>::Item uses the impl<T: Iterator> IntoIterator for T impl, I guess that tries to prove I: Iterator which tries alias-relate(I, <I as IntoIterator>::IntoIter) which has to normalize <I as IntoItertor>::IntoIter at which point we start a trivial cycle