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

ices/68645.rs: fixed with errors #410

Merged
merged 1 commit into from
Jun 22, 2020
Merged

ices/68645.rs: fixed with errors #410

merged 1 commit into from
Jun 22, 2020

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#68645

#![feature(generic_associated_types)]

trait Fun {
    type F<'a>: Fn() -> u32;
    
    fn callme<'a>(f: Self::F<'a>) -> u32 {
        f()
    }
}

impl <T> Fun for T {
    type F<'a> = Self;
}

fn main() {
    <&dyn Iterator<Item = u8>>::callme(&std::iter::once(1));
}
=== stdout ===
=== stderr ===
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/68645.rs:1:12
  |
1 | #![feature(generic_associated_types)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information

error[E0277]: expected a `std::ops::Fn<()>` closure, found `T`
  --> /home/runner/work/glacier/glacier/ices/68645.rs:12:5
   |
4  |     type F<'a>: Fn() -> u32;
   |     ------------------------ required by `Fun::F`
...
12 |     type F<'a> = Self;
   |     ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T`
   |
   = help: the trait `std::ops::Fn<()>` is not implemented for `T`
   = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }
help: consider restricting type parameter `T`
   |
11 | impl <T: std::ops::Fn<()>> Fun for T {
   |        ^^^^^^^^^^^^^^^^^^

error: aborting due to previous error; 1 warning emitted

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

=== stdout ===
=== stderr ===
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/68645.rs:1:12
  |
1 | #![feature(generic_associated_types)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #44265 <rust-lang/rust#44265> for more information

error[E0277]: expected a `std::ops::Fn<()>` closure, found `T`
  --> /home/runner/work/glacier/glacier/ices/68645.rs:12:5
   |
4  |     type F<'a>: Fn() -> u32;
   |     ------------------------ required by `Fun::F`
...
12 |     type F<'a> = Self;
   |     ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T`
   |
   = help: the trait `std::ops::Fn<()>` is not implemented for `T`
   = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }
help: consider restricting type parameter `T`
   |
11 | impl <T: std::ops::Fn<()>> Fun for T {
   |        ^^^^^^^^^^^^^^^^^^

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0277`.
==============
@JohnTitor JohnTitor merged commit 1775614 into master Jun 22, 2020
@JohnTitor JohnTitor deleted the autofix/ices/68645.rs branch June 22, 2020 12:18
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