Skip to content

Commit 2a28e4c

Browse files
committed
fix(ast_tools): correct error message and doc comment (#20930)
Correct an incorrect error message, and a doc comment which was out of date after the introduction of `Ident` type.
1 parent 15546c0 commit 2a28e4c

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

tasks/ast_tools/src/derives/estree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ impl<'s> StructSerializerGenerator<'s> {
521521

522522
value.unwrap_or_else(|| {
523523
panic!(
524-
"`#[estree(json_safe)]` is only valid on struct fields containing a `&str`, `Str`, or `Ident`: {}::{}",
524+
"`#[estree(json_safe)]` is only valid on struct fields containing a `&str`, `Str`, `Ident`, or `Option` of one of those: {}::{}",
525525
struct_def.name(),
526526
field.name(),
527527
)

tasks/ast_tools/src/schema/extensions/estree.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ pub struct ESTreeStructField {
7979
pub flatten: bool,
8080
/// No not flatten field. Overrides `#[estree(flatten)]` on the type of the field.
8181
pub no_flatten: bool,
82-
/// `true` for fields containing a `&str` or `Str` which does not need escaping in JSON
82+
/// `true` for fields containing a `&str`, `Str`, `Ident`, or `Option` of one of those,
83+
/// which does not need escaping in JSON.
8384
pub json_safe: bool,
8485
/// `true` for fields containing a `&str`, `Str`, `Ident`, or `Option` of one of those,
8586
/// whose contents can be derived from a slice of source text with `Span` for the struct.

0 commit comments

Comments
 (0)