forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#66933 - VirrageS:blame-wrong-line, r=Centril
Fix pointing at arg when cause is outside of call Closes: rust-lang#66923
- Loading branch information
Showing
3 changed files
with
71 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/test/ui/issues/issue-66923-show-error-for-correct-call.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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 | ||
fft.push(x2); | ||
|
||
let x3 = x1.into_iter().collect::<Vec<f64>>(); | ||
//~^ ERROR a collection of type | ||
fft.push(x3); | ||
} |
19 changes: 19 additions & 0 deletions
19
src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
error[E0277]: a collection 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(); | ||
| ^^^^^^^ a collection 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 collection 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>>(); | ||
| ^^^^^^^ a collection 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`. |