Skip to content

Commit

Permalink
Rename tests and add short test description
Browse files Browse the repository at this point in the history
  • Loading branch information
VirrageS committed Dec 6, 2019
1 parent d419a5f commit e2e4801
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// This test checks that errors are showed for lines with `collect` rather than `push` method.

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

let x1: &[f64] = &v;
let x2: Vec<f64> = x1.into_iter().collect();
//~^ ERROR a collection of type
//~^ ERROR a value of type
fft.push(x2);

let x3 = x1.into_iter().collect::<Vec<f64>>();
//~^ ERROR a collection of type
//~^ ERROR a value of type
fft.push(x3);
}
19 changes: 19 additions & 0 deletions src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0277]: a value of type `std::vec::Vec<f64>` cannot be built from an iterator over elements of type `&f64`
--> $DIR/issue-66923-show-error-for-correct-call.rs:8:39
|
LL | let x2: Vec<f64> = x1.into_iter().collect();
| ^^^^^^^ value of type `std::vec::Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
= help: the trait `std::iter::FromIterator<&f64>` is not implemented for `std::vec::Vec<f64>`

error[E0277]: a value of type `std::vec::Vec<f64>` cannot be built from an iterator over elements of type `&f64`
--> $DIR/issue-66923-show-error-for-correct-call.rs:12:29
|
LL | let x3 = x1.into_iter().collect::<Vec<f64>>();
| ^^^^^^^ value of type `std::vec::Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
= help: the trait `std::iter::FromIterator<&f64>` is not implemented for `std::vec::Vec<f64>`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
19 changes: 0 additions & 19 deletions src/test/ui/issues/issue-66923.stderr

This file was deleted.

0 comments on commit e2e4801

Please sign in to comment.