File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 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 {
3030```
3131
3232We 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
3535diagnostic. The attributes above produce code which is roughly equivalent to the following (in
3636pseudo-Rust):
3737
@@ -49,7 +49,7 @@ impl SessionDiagnostic for FieldAlreadyDeclared {
4949```
5050
5151The 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
5353explicitly into the format string -- in this example here, `#[ message = "field {field_name} is
5454already declared"] ` produces a call to ` format!` with the appropriate arguments to format
5555` 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