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

ices/97706.rs: fixed with errors #1404

Merged
merged 1 commit into from
Aug 31, 2022
Merged

ices/97706.rs: fixed with errors #1404

merged 1 commit into from
Aug 31, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#97706

pub fn compose(
    f1: impl FnOnce(f64) -> f64 + Clone,
    f2: impl FnOnce(f64) -> f64 + Clone,
) -> impl FnOnce(f64) -> f64 + Clone {
    move |x| f1(f2(x))
}

pub fn double(f: impl FnOnce(f64) -> f64 + Clone) -> impl FnOnce(f64) -> f64 + Clone {
    compose(f.clone(), f)
}


fn repeat_helper(f: impl FnOnce(f64) -> f64 + Clone, res: impl FnOnce(f64) -> f64 + Clone, times: usize) -> impl FnOnce(f64) -> f64 + Clone {
    if times == 1 {
        return res;
    }
    repeat_helper(f.clone(), compose(f, res), times - 1)
}

pub fn repeat(f: impl FnOnce(f64) -> f64 + Clone, times: usize) -> impl FnOnce(f64) -> f64 + Clone {
    repeat_helper(f.clone(), f, times)
}

fn main() {}
=== stdout ===
=== stderr ===
error: type parameter `impl FnOnce(f64) -> f64 + Clone` is part of concrete type but not used in parameter list for the `impl Trait` type alias
  --> /home/runner/work/glacier/glacier/ices/97706.rs:17:5
   |
17 |     repeat_helper(f.clone(), compose(f, res), times - 1)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

==============

=== stdout ===
=== stderr ===
error: type parameter `impl FnOnce(f64) -> f64 + Clone` is part of concrete type but not used in parameter list for the `impl Trait` type alias
  --> /home/runner/work/glacier/glacier/ices/97706.rs:17:5
   |
17 |     repeat_helper(f.clone(), compose(f, res), times - 1)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

==============
@JohnTitor JohnTitor merged commit a3ea9ca into master Aug 31, 2022
@JohnTitor JohnTitor deleted the autofix/ices/97706.rs branch August 31, 2022 12:25
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