Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. ## Error format
  2.  
  3. ```
  4. error: mismatched types [--explain E0308]
  5. --> array-not-vector.rs:20:20
  6. 20 |> let _y: &i32 = x;
  7. |> ^ expected i32, found slice
  8. note: expected type `&i32`
  9. note: found type `&[i32]`
  10. ```
  11.  
  12. ## JSON
  13.  
  14. - Diagnostic
  15. - Logical:
  16. - message ("mismatched types")
  17. - labels (vec<(Span, Option<String>, is_primary: bool)>)
  18. - span: foo
  19. - span: bar
  20. - suggestions (vec<(Span, String)>)?
  21. - the string is alternative source code, not a label
  22. - error code ("E0123", explanation)
  23. - Subdiagnostics: Vec<Logical>
  24. - presentation: vec<PresentationLine>
  25.  
  26. - Span:
  27. - Start Point
  28. - End Point
  29. - plain text: Vec<String>
  30. - but: maybe crosses files?
  31.  
  32. - Point:
  33. - filename byte / line / column
  34.  
  35. - PresentationLine
  36. - Option<Point>
  37. - Bare text (String)
  38. - Vec<StyleSpan>
  39.  
  40. - StyleSpan:
  41. - column start
  42. - column end
  43. - style: choice of
  44. - filename
  45. - line-number
  46. - primary carrot
  47. - secondary dash
  48. - elision
  49. - primary-label
  50. - second-label
  51. - etc.
  52.  
  53. RenderedLineKind:
  54. - source text
  55. - highlights
  56. - elision
  57.  
  58. Examples:
  59.  
  60. - One primary span, two labels, one of which is the primary span
  61.  
  62. error: use of moved value
  63. --> filename:130:33 <-- primary span shows up here
  64. 123 |> match x {
  65. 124 |> Some(y) => ...
  66. |> - move occurs here
  67. |> ...
  68. 130 |> foo(x);
  69. |> ^ use occurs here later <-- labeled primary span
  70. suggestion: maybe a ref binding?
  71. Some(ref y) => ...
  72.  
  73. - Multiple primary spans, no labels
  74.  
  75. error: unused imports
  76. --> filename:line:col
  77. 123 |> use foo::{a, b, c};
  78. |> ^ ^
  79.  
  80. - Multiple primary spans, one of which is labeled
  81.  
  82. error: undefined variable
  83. --> filename:line:col
  84. 123 |> println(x);
  85. |> ^ did you mean `y`?
  86. 124 |> println(x);
  87. |> ^
  88. 125 |> println(x);
  89. |> ^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement