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.
Use more precise span for E0282 in cast expressions
- Loading branch information
1 parent
c5fbcd3
commit 74d1bd2
Showing
3 changed files
with
23 additions
and
2 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
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,10 @@ | ||
// Check that errors for unresolved types in cast expressions are reported | ||
// for the offending subexpression, not the whole cast expression. | ||
|
||
#![allow(unused_variables)] | ||
|
||
fn main() { | ||
let a = [1, 2, 3].iter().sum(); | ||
let b = (a + 1) as usize; | ||
//~^ ERROR: type annotations needed [E0282] | ||
} |
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,11 @@ | ||
error[E0282]: type annotations needed | ||
--> $DIR/issue-85586.rs:8:13 | ||
| | ||
LL | let b = (a + 1) as usize; | ||
| ^^^^^^^ cannot infer type | ||
| | ||
= note: type must be known at this point | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0282`. |