Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit e03175e

Browse files
committed
Implement common traits for Diagnostic and associated types
1 parent 7e88e76 commit e03175e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/diagnostics.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! The following data types are copied from [rust-lang/rust](https://github.com/rust-lang/rust/blob/de78655bca47cac8e783dbb563e7e5c25c1fae40/src/libsyntax/json.rs)
44
5-
#[derive(Deserialize, Debug)]
5+
#[derive(Clone, Deserialize, Debug, Hash, Eq, PartialEq)]
66
pub struct Diagnostic {
77
/// The primary error message.
88
pub message: String,
@@ -18,7 +18,7 @@ pub struct Diagnostic {
1818
pub rendered: Option<String>,
1919
}
2020

21-
#[derive(Deserialize, Debug)]
21+
#[derive(Clone, Deserialize, Debug, Hash, Eq, PartialEq)]
2222
pub struct DiagnosticSpan {
2323
pub file_name: String,
2424
pub byte_start: u32,
@@ -46,15 +46,15 @@ pub struct DiagnosticSpan {
4646
expansion: Option<Box<DiagnosticSpanMacroExpansion>>,
4747
}
4848

49-
#[derive(Copy, Clone, Debug, PartialEq, Deserialize)]
49+
#[derive(Copy, Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
5050
pub enum Applicability {
5151
MachineApplicable,
5252
HasPlaceholders,
5353
MaybeIncorrect,
5454
Unspecified,
5555
}
5656

57-
#[derive(Deserialize, Debug)]
57+
#[derive(Clone, Deserialize, Debug, Eq, PartialEq, Hash)]
5858
pub struct DiagnosticSpanLine {
5959
pub text: String,
6060

@@ -64,7 +64,7 @@ pub struct DiagnosticSpanLine {
6464
pub highlight_end: usize,
6565
}
6666

67-
#[derive(Deserialize, Debug)]
67+
#[derive(Clone, Deserialize, Debug, Eq, PartialEq, Hash)]
6868
struct DiagnosticSpanMacroExpansion {
6969
/// span where macro was applied to generate this code; note that
7070
/// this may itself derive from a macro (if
@@ -78,7 +78,7 @@ struct DiagnosticSpanMacroExpansion {
7878
def_site_span: Option<DiagnosticSpan>,
7979
}
8080

81-
#[derive(Deserialize, Debug)]
81+
#[derive(Clone, Deserialize, Debug, Eq, PartialEq, Hash)]
8282
pub struct DiagnosticCode {
8383
/// The code itself.
8484
pub code: String,

0 commit comments

Comments
 (0)