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.
Auto merge of rust-lang#117856 - estebank:issue-66023, r=compiler-errors
Always point at index span on index obligation failure Use more targetted span for index obligation failures by rewriting the obligation cause span. CC rust-lang#66023
- Loading branch information
Showing
5 changed files
with
46 additions
and
10 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
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,7 @@ | ||
fn main() { | ||
let a = std::collections::HashMap::<String,String>::new(); | ||
let s = "hello"; | ||
let _b = a[ | ||
&s //~ ERROR E0277 | ||
]; | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/ui/indexing/point-at-index-for-obligation-failure.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,13 @@ | ||
error[E0277]: the trait bound `String: Borrow<&str>` is not satisfied | ||
--> $DIR/point-at-index-for-obligation-failure.rs:5:9 | ||
| | ||
LL | &s | ||
| ^^ the trait `Borrow<&str>` is not implemented for `String` | ||
| | ||
= help: the trait `Borrow<str>` is implemented for `String` | ||
= help: for that trait implementation, expected `str`, found `&str` | ||
= note: required for `HashMap<String, String>` to implement `Index<&&str>` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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