-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntactically invalid JSON from -Z ast-json
#54880
Labels
C-bug
Category: This is a bug.
Comments
rust/src/libsyntax/parse/token.rs Lines 755 to 765 in 4efdc04
|
I cannot reproduce this issue with 1.50.0-nightly (2225ee1 2020-12-11). The JSON output is now syntactically valid. JSON output{ "module": { "inner": { "lo": 0, "hi": 144 }, "unsafety": "No", "items": [ { "attrs": [ { "kind": { "variant": "Normal", "fields": [ { "path": { "span": { "lo": 0, "hi": 0 }, "segments": [ { "ident": { "name": "prelude_import", "span": { "lo": 0, "hi": 0 } }, "id": 3, "args": null } ], "tokens": null }, "args": "Empty", "tokens": null }, null ] }, "id": null, "style": "Outer", "span": { "lo": 0, "hi": 0 } } ], "id": 4, "span": { "lo": 0, "hi": 0 }, "vis": { "kind": "Inherited", "span": { "lo": 0, "hi": 0 }, "tokens": null }, "ident": { "name": "", "span": { "lo": 0, "hi": 0 } }, "kind": { "variant": "Use", "fields": [ { "prefix": { "span": { "lo": 0, "hi": 0 }, "segments": [ { "ident": { "name": "{{root}}", "span": { "lo": 0, "hi": 0 } }, "id": 5, "args": null }, { "ident": { "name": "std", "span": { "lo": 0, "hi": 0 } }, "id": 6, "args": null }, { "ident": { "name": "prelude", "span": { "lo": 0, "hi": 0 } }, "id": 7, "args": null }, { "ident": { "name": "v1", "span": { "lo": 0, "hi": 0 } }, "id": 8, "args": null } ], "tokens": null }, "kind": "Glob", "span": { "lo": 0, "hi": 0 } } ] }, "tokens": null }, { "attrs": [ { "kind": { "variant": "Normal", "fields": [ { "path": { "span": { "lo": 0, "hi": 0 }, "segments": [ { "ident": { "name": "macro_use", "span": { "lo": 0, "hi": 0 } }, "id": 9, "args": null } ], "tokens": null }, "args": "Empty", "tokens": null }, null ] }, "id": null, "style": "Outer", "span": { "lo": 0, "hi": 0 } } ], "id": 10, "span": { "lo": 0, "hi": 0 }, "vis": { "kind": "Inherited", "span": { "lo": 0, "hi": 0 }, "tokens": null }, "ident": { "name": "std", "span": { "lo": 0, "hi": 0 } }, "kind": { "variant": "ExternCrate", "fields": [ null ] }, "tokens": null }, { "attrs": [], "id": 11, "span": { "lo": 0, "hi": 14 }, "vis": { "kind": "Inherited", "span": { "lo": 0, "hi": 0 }, "tokens": null }, "ident": { "name": "Struct", "span": { "lo": 7, "hi": 13 } }, "kind": { "variant": "Struct", "fields": [ { "variant": "Unit", "fields": [ 12 ] }, { "params": [], "where_clause": { "has_where_token": false, "predicates": [], "span": { "lo": 13, "hi": 13 } }, "span": { "lo": 13, "hi": 13 } } ] }, "tokens": null }, { "attrs": [], "id": 13, "span": { "lo": 15, "hi": 29 }, "vis": { "kind": "Inherited", "span": { "lo": 15, "hi": 15 }, "tokens": null }, "ident": { "name": "Trait", "span": { "lo": 21, "hi": 26 } }, "kind": { "variant": "Trait", "fields": [ "No", "No", { "params": [], "where_clause": { "has_where_token": false, "predicates": [], "span": { "lo": 26, "hi": 26 } }, "span": { "lo": 26, "hi": 26 } }, [], [] ] }, "tokens": null }, { "attrs": [], "id": 14, "span": { "lo": 31, "hi": 118 }, "vis": { "kind": "Inherited", "span": { "lo": 31, "hi": 31 }, "tokens": null }, "ident": { "name": "impl_trait_for", "span": { "lo": 44, "hi": 58 } }, "kind": { "variant": "MacroDef", "fields": [ { "body": { "variant": "Delimited", "fields": [ { "open": { "lo": 59, "hi": 60 }, "close": { "lo": 117, "hi": 118 } }, "Brace", { "0": [ [ { "variant": "Delimited", "fields": [ { "open": { "lo": 65, "hi": 66 }, "close": { "lo": 74, "hi": 75 } }, "Paren", { "0": [ [ { "variant": "Token", "fields": [ { "kind": "Dollar", "span": { "lo": 66, "hi": 67 } } ] }, "Alone" ], [ { "variant": "Token", "fields": [ { "kind": { "variant": "Ident", "fields": [ "s", false ] }, "span": { "lo": 67, "hi": 68 } } ] }, "Joint" ], [ { "variant": "Token", "fields": [ { "kind": "Colon", "span": { "lo": 68, "hi": 69 } } ] }, "Alone" ], [ { "variant": "Token", "fields": [ { "kind": { "variant": "Ident", "fields": [ "ident", false ] }, "span": { "lo": 69, "hi": 74 } } ] }, "Alone" ] ] } ] }, "Alone" ], [ { "variant": "Token", "fields": [ { "kind": "FatArrow", "span": { "lo": 76, "hi": 78 } } ] }, "Alone" ], [ { "variant": "Delimited", "fields": [ { "open": { "lo": 79, "hi": 80 }, "close": { "lo": 114, "hi": 115 } }, "Brace", { "0": [ [ { "variant": "Token", "fields": [ { "kind": { "variant": "Ident", "fields": [ "impl", false ] }, "span": { "lo": 89, "hi": 93 } } ] }, "Alone" ], [ { "variant": "Token", "fields": [ { "kind": { "variant": "Ident", "fields": [ "Trait", false ] }, "span": { "lo": 94, "hi": 99 } } ] }, "Alone" ], [ { "variant": "Token", "fields": [ { "kind": { "variant": "Ident", "fields": [ "for", false ] }, "span": { "lo": 100, "hi": 103 } } ] }, "Alone" ], [ { "variant": "Token", "fields": [ { "kind": "Dollar", "span": { "lo": 104, "hi": 105 } } ] }, "Alone" ], [ { "variant": "Token", "fields": [ { "kind": { "variant": "Ident", "fields": [ "s", false ] }, "span": { "lo": 105, "hi": 106 } } ] }, "Alone" ], [ { "variant": "Delimited", "fields": [ { "open": { "lo": 107, "hi": 108 }, "close": { "lo": 108, "hi": 109 } }, "Brace", { "0": [] } ] }, "Alone" ] ] } ] }, "Alone" ], [ { "variant": "Token", "fields": [ { "kind": "Semi", "span": { "lo": 115, "hi": 116 } } ] }, "Alone" ] ] } ] }, "macro_rules": true } ] }, "tokens": null }, { "attrs": [], "id": 15, "span": { "lo": 89, "hi": 109 }, "vis": { "kind": "Inherited", "span": { "lo": 89, "hi": 89 }, "tokens": null }, "ident": { "name": "", "span": { "lo": 0, "hi": 0 } }, "kind": { "variant": "Impl", "fields": [ "No", "Positive", "Final", "No", { "params": [], "where_clause": { "has_where_token": false, "predicates": [], "span": { "lo": 106, "hi": 106 } }, "span": { "lo": 93, "hi": 93 } }, { "path": { "span": { "lo": 94, "hi": 99 }, "segments": [ { "ident": { "name": "Trait", "span": { "lo": 94, "hi": 99 } }, "id": 16, "args": null } ], "tokens": null }, "ref_id": 17 }, { "id": 18, "kind": { "variant": "Path", "fields": [ null, { "span": { "lo": 104, "hi": 106 }, "segments": [ { "ident": { "name": "Struct", "span": { "lo": 136, "hi": 142 } }, "id": 19, "args": null } ], "tokens": null } ] }, "span": { "lo": 104, "hi": 106 }, "tokens": null }, [] ] }, "tokens": null } ], "inline": true }, "attrs": [], "span": { "lo": 0, "hi": 144 }, "proc_macros": [] } |
The ast-json flag was removed in #85993. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The JSON emitted for the following AST is not legal JSON.
To reproduce:
With indentation added, part of the JSON output looks like this. The problem is with the last
,
in this snippet.The text was updated successfully, but these errors were encountered: