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

ices/74282.rs: fixed with errors #1115

Merged
merged 1 commit into from
Feb 9, 2022
Merged

ices/74282.rs: fixed with errors #1115

merged 1 commit into from
Feb 9, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Feb 9, 2022

Issue: rust-lang/rust#74282

#![feature(type_alias_impl_trait)]

type Closure = impl Fn() -> u64;
struct Anonymous(Closure);

fn test() {
    let y = || -> Closure { || 3 };
    Anonymous(|| 3)
}

fn main() {}
=== stdout ===
=== stderr ===
error[E0308]: mismatched types
 --> /home/runner/work/glacier/glacier/ices/74282.rs:8:5
  |
8 |     Anonymous(|| 3)
  |     ^^^^^^^^^^^^^^^ expected `()`, found struct `Anonymous`
  |
help: consider using a semicolon here
  |
8 |     Anonymous(|| 3);
  |                    +
help: try adding a return type
  |
6 | fn test() -> Anonymous {
  |           ++++++++++++

error[E0308]: mismatched types
 --> /home/runner/work/glacier/glacier/ices/74282.rs:8:15
  |
3 | type Closure = impl Fn() -> u64;
  |                ---------------- the expected opaque type
...
8 |     Anonymous(|| 3)
  |               ^^^^ expected closure, found a different closure
  |
  = note: expected opaque type `Closure`
                 found closure `[closure@/home/runner/work/glacier/glacier/ices/74282.rs:8:15: 8:19]`
  = note: no two closures, even if identical, have the same type
  = help: consider boxing your closure and/or using it as a trait object

error: aborting due to 2 previous errors

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

=== stdout ===
=== stderr ===
error[E0308]: mismatched types
 --> /home/runner/work/glacier/glacier/ices/74282.rs:8:5
  |
8 |     Anonymous(|| 3)
  |     ^^^^^^^^^^^^^^^ expected `()`, found struct `Anonymous`
  |
help: consider using a semicolon here
  |
8 |     Anonymous(|| 3);
  |                    +
help: try adding a return type
  |
6 | fn test() -> Anonymous {
  |           ++++++++++++

error[E0308]: mismatched types
 --> /home/runner/work/glacier/glacier/ices/74282.rs:8:15
  |
3 | type Closure = impl Fn() -> u64;
  |                ---------------- the expected opaque type
...
8 |     Anonymous(|| 3)
  |               ^^^^ expected closure, found a different closure
  |
  = note: expected opaque type `Closure`
                 found closure `[closure@/home/runner/work/glacier/glacier/ices/74282.rs:8:15: 8:19]`
  = note: no two closures, even if identical, have the same type
  = help: consider boxing your closure and/or using it as a trait object

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.
==============
@Alexendoo Alexendoo merged commit 06c8426 into master Feb 9, 2022
@Alexendoo Alexendoo deleted the autofix/ices/74282.rs branch February 9, 2022 12:54
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