Skip to content

Commit 4d2e965

Browse files
committed
Make a span more useful
1 parent 5518d19 commit 4d2e965

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,6 +1328,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
13281328
ty::Generator(..) => "generator",
13291329
_ => "function",
13301330
};
1331+
let span = self.tcx.sess.source_map().guess_head_span(span);
13311332
let mut err = struct_span_err!(
13321333
self.tcx.sess,
13331334
span,

src/test/ui/generator/issue-88653.stderr

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
error[E0631]: type mismatch in generator arguments
22
--> $DIR/issue-88653.rs:9:5
33
|
4-
LL | |bar| {
5-
| ^----
6-
| |
7-
| _____found signature of `fn(bool) -> _`
8-
| |
9-
LL | |
10-
LL | |
11-
LL | |
12-
... |
13-
LL | | }
14-
LL | | }
15-
| |_____^ expected signature of `fn((bool,)) -> _`
4+
LL | |bar| {
5+
| ^^^^^
6+
| |
7+
| expected signature of `fn((bool,)) -> _`
8+
| found signature of `fn(bool) -> _`
169

1710
error: aborting due to previous error
1811

0 commit comments

Comments
 (0)