]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #71284 - JOE1994:serialize_id, r=petrochenkov
authorDylan DPC <dylan.dpc@gmail.com>
Mon, 20 Apr 2020 16:07:09 +0000 (18:07 +0200)
committerGitHub <noreply@github.com>
Mon, 20 Apr 2020 16:07:09 +0000 (18:07 +0200)
commit314b78c5502cc232b975a5ce8870f61c5902ad47
tree60c129db565535407284e006d364fe01066726c1
parente80d30347ab9dc2e4f73a9f3c8cc3bf09914a597
parentb469d2db6dc7329dcf7a1a42e2111b46da818b9a
Rollup merge of #71284 - JOE1994:serialize_id, r=petrochenkov

fix -Zast-json to output correct JSON form

fixes #71086 (Reverts some of the changes made in #70215)

JSON output (from an empty library) after fix has something for **"id"** field
```shell
lonelyjoe@lonelyjoe-desktop:~/workspace/empty_lib/src$ rustc lib.rs -Zast-json
```
```json
{
   "module":{
      "inner":{
         "lo":0,
         "hi":94
      },
      "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
                                 }
                              ]
                           },
                           "args":"Empty"
                        }
                     ]
                  },
                  "id":null,
                  "style":"Outer",
                  "span":{
                     "lo":0,
                     "hi":0
                  }
               }
            ],
            "id":4,
            "span":{
               "lo":0,
               "hi":0
            },
            "vis":{
               "node":"Inherited",
               "span":{
                  "lo":0,
                  "hi":0
               }
            },
            "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
                           }
                        ]
                     },
                     "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
                                 }
                              ]
                           },
                           "args":"Empty"
                        }
                     ]
                  },
                  "id":null,
                  "style":"Outer",
                  "span":{
                     "lo":0,
                     "hi":0
                  }
               }
            ],
            "id":10,
            "span":{
               "lo":0,
               "hi":0
            },
            "vis":{
               "node":"Inherited",
               "span":{
                  "lo":0,
                  "hi":0
               }
            },
            "ident":{
               "name":"std",
               "span":{
                  "lo":0,
                  "hi":0
               }
            },
            "kind":{
               "variant":"ExternCrate",
               "fields":[
                  null
               ]
            },
            "tokens":null
         }
      ],
      "inline":true
   },
   "attrs":[

   ],
   "span":{
      "lo":0,
      "hi":94
   },
   "proc_macros":[

   ]
}
```
src/librustc_ast/ast.rs