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

ices/92305.sh: fixed with errors #1229

Merged
merged 1 commit into from
Apr 30, 2022
Merged

ices/92305.sh: fixed with errors #1229

merged 1 commit into from
Apr 30, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#92305

#!/usr/bin/env bash

rustc --edition 2021 - << EOF

use std::iter;

fn f<T>(data: &[T]) -> impl Iterator<Item = Vec> {
    iter::empty()
}

fn g<T>(data: &[T], target: T) -> impl Iterator<Item = Vec<T>> {
    f(data).filter(|x| x == target)
}

fn main() {}

EOF
=== stdout ===
=== stderr ===
error[E0107]: missing generics for struct `Vec`
 --> <anon>:4:45
  |
4 | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec> {
  |                                             ^^^ expected at least 1 generic argument
  |
help: add missing generic argument
  |
4 | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec<T>> {
  |                                             ~~~~~~

error[E0282]: type annotations needed
 --> <anon>:5:5
  |
5 |     iter::empty()
  |     ^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the function `empty`

error[E0282]: type annotations needed
 --> <anon>:8:35
  |
8 | fn g<T>(data: &[T], target: T) -> impl Iterator<Item = Vec<T>> {
  |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type

error: aborting due to 3 previous errors

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

=== stdout ===
=== stderr ===
error[E0107]: missing generics for struct `Vec`
 --> <anon>:4:45
  |
4 | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec> {
  |                                             ^^^ expected at least 1 generic argument
  |
help: add missing generic argument
  |
4 | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec<T>> {
  |                                             ~~~~~~

error[E0282]: type annotations needed
 --> <anon>:5:5
  |
5 |     iter::empty()
  |     ^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the function `empty`

error[E0282]: type annotations needed
 --> <anon>:8:35
  |
8 | fn g<T>(data: &[T], target: T) -> impl Iterator<Item = Vec<T>> {
  |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0107, E0282.
For more information about an error, try `rustc --explain E0107`.
==============
@JohnTitor JohnTitor merged commit 87d1bc5 into master Apr 30, 2022
@JohnTitor JohnTitor deleted the autofix/ices/92305.sh branch April 30, 2022 19:42
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