Skip to content

Error message blames wrong line #66923

Closed

Description

@vchekan

The code below blames the last line for the error where in fact error is in the previous one.
The error message makes no sense because x4 type is specified explicitly and no iterator is present anymore.

fn main() {
    let v = vec![1_f64, 2.2_f64];
    let mut fft: Vec<Vec<f64>> = vec![];

    let x1: &[f64] = &v;
    let x2 = x1.into_iter();
    let x3 = x2.rev();
    let x4: Vec<f64> = x3.collect();    // <-- mistake is here
    fft.push(x4);                                 // <-- but error blames this line
}
--> src/main.rs:9:14
  |
9 |     fft.push(x4);
  |              ^^ a collection of type `std::vec::Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`

Activity

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    C-bugCategory: This is a bug.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    A-collectionsArea: `std::collections` (prefer A-binaryheap, A-btree, A-hashtable, A-linkedlist, A-vecdeque)
    on Dec 1, 2019
  2. added a commit that references this issue on Dec 5, 2019
    c6c77ac
  3. added a commit that references this issue on Dec 19, 2019
    a12ec2e
  4. added 2 commits that reference this issue on Dec 20, 2019
    2e246b8
    5a8083c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-collectionsArea: `std::collections` (prefer A-binaryheap, A-btree, A-hashtable, A-linkedlist, A-vecdeque)A-diagnosticsArea: Messages for errors, warnings, and lintsA-iteratorsArea: IteratorsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions