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

Normalizes-to for a trait-bound-only param #1

Closed
compiler-errors opened this issue Mar 28, 2023 · 1 comment
Closed

Normalizes-to for a trait-bound-only param #1

compiler-errors opened this issue Mar 28, 2023 · 1 comment
Labels
fundamental-issue Something that'll need fundamental restructuring or a hack existing at the solver level

Comments

@compiler-errors
Copy link
Owner

compiler-errors commented Mar 28, 2023

fn next<T: Iterator<Item = U>, U>(t: &mut T) -> Option<U> {
    t.next()
}

fn foo<T: Iterator>(t: &mut T) {
    let _: Option<T::Item> = next(t);
}

fn main() {}

The below is a normalizes-to pred. In the body of foo, <T as Iterator>::Item normalizes-to <T as Iterator>::Item is false.

error[E0271]: type mismatch resolving `<T as Iterator>::Item == <T as Iterator>::Item`
 --> <source>:6:35
  |
6 |     let _: Option<T::Item> = next(t);
  |                              ---- ^ types differ
  |                              |
  |                              required by a bound introduced by this call
  |
note: required by a bound in `next`
 --> <source>:1:21
  |
1 | fn next<T: Iterator<Item = U>, U>(t: &mut T) -> Option<U> {
  |                     ^^^^^^^^ required by this bound in `next`

error: aborting due to previous error
@compiler-errors compiler-errors added the fundamental-issue Something that'll need fundamental restructuring or a hack existing at the solver level label Mar 29, 2023
@compiler-errors
Copy link
Owner Author

Can't transfer this to the new repo since github doesn't allow transferring issues across owners apparently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fundamental-issue Something that'll need fundamental restructuring or a hack existing at the solver level
Projects
None yet
Development

No branches or pull requests

1 participant