File tree Expand file tree Collapse file tree 2 files changed +2
-67
lines changed Expand file tree Collapse file tree 2 files changed +2
-67
lines changed Original file line number Diff line number Diff line change @@ -1187,7 +1187,7 @@ impl EmitterWriter {
1187
1187
let sub_len = parts[ 0 ] . snippet . trim ( ) . chars ( ) . fold ( 0 , |acc, ch| {
1188
1188
acc + unicode_width:: UnicodeWidthChar :: width ( ch) . unwrap_or ( 0 )
1189
1189
} ) ;
1190
- let underline_start = span_start_pos. col . 0 + start;
1190
+ let underline_start = span_start_pos. col_display + start;
1191
1191
let underline_end = span_start_pos. col . 0 + start + sub_len;
1192
1192
for p in underline_start..underline_end {
1193
1193
buffer. putc ( row_num,
Original file line number Diff line number Diff line change 2
2
"message": "cannot find type `Iter` in this scope",
3
3
"code": {
4
4
"code": "E0412",
5
- "explanation": "
6
- The type name used is not in scope.
7
-
8
- Erroneous code examples:
9
-
10
- ```compile_fail,E0412
11
- impl Something {} // error: type name `Something` is not in scope
12
-
13
- // or:
14
-
15
- trait Foo {
16
- fn bar(N); // error: type name `N` is not in scope
17
- }
18
-
19
- // or:
20
-
21
- fn foo(x: T) {} // type name `T` is not in scope
22
- ```
23
-
24
- To fix this error, please verify you didn't misspell the type name, you did
25
- declare it or imported it into the scope. Examples:
26
-
27
- ```
28
- struct Something;
29
-
30
- impl Something {} // ok!
31
-
32
- // or:
33
-
34
- trait Foo {
35
- type N;
36
-
37
- fn bar(_: Self::N); // ok!
38
- }
39
-
40
- // or:
41
-
42
- fn foo<T>(x: T) {} // ok!
43
- ```
44
-
45
- Another case that causes this error is when a type is imported into a parent
46
- module. To fix this, you can follow the suggestion and use File directly or
47
- `use super::File;` which will import the types from the parent namespace. An
48
- example that causes this error is below:
49
-
50
- ```compile_fail,E0412
51
- use std::fs::File;
52
-
53
- mod foo {
54
- fn some_function(f: File) {}
55
- }
56
- ```
57
-
58
- ```
59
- use std::fs::File;
60
-
61
- mod foo {
62
- // either
63
- use super::File;
64
- // or
65
- // use std::fs::File;
66
- fn foo(f: File) {}
67
- }
68
- # fn main() {} // don't insert it for us; that'll break imports
69
- ```
70
- "
5
+ "explanation": null
71
6
},
72
7
"level": "error",
73
8
"spans": [
You can’t perform that action at this time.
0 commit comments