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

ices/94429.rs: fixed with errors #1202

Merged
merged 1 commit into from
Mar 31, 2022
Merged

ices/94429.rs: fixed with errors #1202

merged 1 commit into from
Mar 31, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#94429

#![feature(type_alias_impl_trait, generator_trait, generators)]
use std::ops::Generator;

trait Runnable {
    type Gen: Generator<Yield = (), Return = ()>;

    fn run(&mut self) -> Self::Gen;
}

struct Implementor {}

impl Runnable for Implementor {
    type Gen = impl Generator<Yield = (), Return = ()>;

    fn run(&mut self) -> Self::Gen {
        move || {
            // This line causes the ICE;
            // the same error occurs if the return type is wrong (e.g. `return 1`)
            yield 1;
        }
    }
}
=== stdout ===
=== stderr ===
error[E0601]: `main` function not found in crate `94429`
  --> /home/runner/work/glacier/glacier/ices/94429.rs:22:2
   |
22 | }
   |  ^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/94429.rs`

error[E0271]: type mismatch resolving `<[generator@/home/runner/work/glacier/glacier/ices/94429.rs:16:9: 20:10] as Generator>::Yield == ()`
  --> /home/runner/work/glacier/glacier/ices/94429.rs:16:9
   |
16 | /         move || {
17 | |             // This line causes the ICE;
18 | |             // the same error occurs if the return type is wrong (e.g. `return 1`)
19 | |             yield 1;
20 | |         }
   | |_________^ expected integer, found `()`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0271, E0601.
For more information about an error, try `rustc --explain E0271`.
==============

=== stdout ===
=== stderr ===
error[E0601]: `main` function not found in crate `94429`
  --> /home/runner/work/glacier/glacier/ices/94429.rs:22:2
   |
22 | }
   |  ^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/94429.rs`

error[E0271]: type mismatch resolving `<[generator@/home/runner/work/glacier/glacier/ices/94429.rs:16:9: 20:10] as Generator>::Yield == ()`
  --> /home/runner/work/glacier/glacier/ices/94429.rs:16:9
   |
16 | /         move || {
17 | |             // This line causes the ICE;
18 | |             // the same error occurs if the return type is wrong (e.g. `return 1`)
19 | |             yield 1;
20 | |         }
   | |_________^ expected integer, found `()`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0271, E0601.
For more information about an error, try `rustc --explain E0271`.
==============
@Alexendoo Alexendoo merged commit 49f1cff into master Mar 31, 2022
@Alexendoo Alexendoo deleted the autofix/ices/94429.rs branch March 31, 2022 21:53
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