File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ tcx.sess.emit_err(FieldAlreadyDeclared {
30
30
```
31
31
32
32
We see that using ` SessionDiagnostic ` is relatively straight forward. The ` #[error = "..."] `
33
- attribute is used to supply the error code for the diagnostic. We are then annotate fields in the
34
- struct with various information of how to convert an instance of the struct into a proper
33
+ attribute is used to supply the error code for the diagnostic. We then annotate fields in the
34
+ struct with various information on how to convert an instance of the struct into a rendered
35
35
diagnostic. The attributes above produce code which is roughly equivalent to the following (in
36
36
pseudo-Rust):
37
37
@@ -49,7 +49,7 @@ impl SessionDiagnostic for FieldAlreadyDeclared {
49
49
```
50
50
51
51
The generated code draws attention to a number of features. First, we see that within the strings
52
- passed to each attribute, we see that field names can be referenced without needing to be passed
52
+ passed to each attribute, field names can be referenced without needing to be passed
53
53
explicitly into the format string -- in this example here, `#[ message = "field {field_name} is
54
54
already declared"] ` produces a call to ` format!` with the appropriate arguments to format
55
55
` self.field_name ` into the string. This applies to strings passed to all attributes.
You can’t perform that action at this time.
0 commit comments