Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/100463.rs: fixed with errors #1407

Merged
merged 1 commit into from
Aug 31, 2022
Merged

ices/100463.rs: fixed with errors #1407

merged 1 commit into from
Aug 31, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#100463

struct Foo<T> {
    inner: Vec<T>,
}

impl<T> Foo<T> {
    fn get(&self) -> impl Iterator<Item = &T> {
        self.inner.iter()
    }
}

fn main() {
    let foo: Foo<()> = Foo { inner: Vec::new() };
    let vals: Vec<_> = foo.get();
}
=== stdout ===
=== stderr ===
error[E0308]: mismatched types
  --> /home/runner/work/glacier/glacier/ices/100463.rs:13:24
   |
6  |     fn get(&self) -> impl Iterator<Item = &T> {
   |                      ------------------------ the found opaque type
...
13 |     let vals: Vec<_> = foo.get();
   |               ------   ^^^^^^^^^ expected struct `Vec`, found opaque type
   |               |
   |               expected due to this
   |
   = note:   expected struct `Vec<_>`
           found opaque type `impl Iterator<Item = &()>`

error: aborting due to previous error

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

=== stdout ===
=== stderr ===
error[E0308]: mismatched types
  --> /home/runner/work/glacier/glacier/ices/100463.rs:13:24
   |
6  |     fn get(&self) -> impl Iterator<Item = &T> {
   |                      ------------------------ the found opaque type
...
13 |     let vals: Vec<_> = foo.get();
   |               ------   ^^^^^^^^^ expected struct `Vec`, found opaque type
   |               |
   |               expected due to this
   |
   = note:   expected struct `Vec<_>`
           found opaque type `impl Iterator<Item = &()>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
==============
@JohnTitor JohnTitor merged commit 3db2f85 into master Aug 31, 2022
@JohnTitor JohnTitor deleted the autofix/ices/100463.rs branch August 31, 2022 10:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants