|
3 | 3 | //! These types are the public API exposed through the `--output-format json` flag. The [`Crate`]
|
4 | 4 | //! struct is the root of the JSON blob and all other items are contained within.
|
5 | 5 |
|
6 |
| -use std::collections::{HashMap, HashSet}; |
| 6 | +use std::collections::HashMap; |
7 | 7 | use std::path::PathBuf;
|
8 | 8 |
|
9 | 9 | use serde::{Deserialize, Serialize};
|
10 | 10 |
|
11 | 11 | /// rustdoc format-version.
|
12 |
| -pub const FORMAT_VERSION: u32 = 10; |
| 12 | +pub const FORMAT_VERSION: u32 = 11; |
13 | 13 |
|
14 | 14 | /// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
|
15 | 15 | /// about the language items in the local crate, as well as info about external items to allow
|
@@ -287,29 +287,45 @@ pub enum StructType {
|
287 | 287 | Unit,
|
288 | 288 | }
|
289 | 289 |
|
290 |
| -#[non_exhaustive] |
291 | 290 | #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)]
|
292 |
| -#[serde(rename_all = "snake_case")] |
293 |
| -pub enum Qualifiers { |
294 |
| - Const, |
295 |
| - Unsafe, |
296 |
| - Async, |
| 291 | +pub struct Header { |
| 292 | + #[serde(rename = "const")] |
| 293 | + pub const_: bool, |
| 294 | + #[serde(rename = "unsafe")] |
| 295 | + pub unsafe_: bool, |
| 296 | + #[serde(rename = "async")] |
| 297 | + pub async_: bool, |
| 298 | + pub abi: Abi, |
| 299 | +} |
| 300 | + |
| 301 | +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)] |
| 302 | +pub enum Abi { |
| 303 | + // We only have a concrete listing here for stable ABI's because their are so many |
| 304 | + // See rustc_ast_passes::feature_gate::PostExpansionVisitor::check_abi for the list |
| 305 | + Rust, |
| 306 | + C { unwind: bool }, |
| 307 | + Cdecl { unwind: bool }, |
| 308 | + Stdcall { unwind: bool }, |
| 309 | + Fastcall { unwind: bool }, |
| 310 | + Aapcs { unwind: bool }, |
| 311 | + Win64 { unwind: bool }, |
| 312 | + SysV64 { unwind: bool }, |
| 313 | + System { unwind: bool }, |
| 314 | + Other(String), |
297 | 315 | }
|
298 | 316 |
|
299 | 317 | #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
300 | 318 | pub struct Function {
|
301 | 319 | pub decl: FnDecl,
|
302 | 320 | pub generics: Generics,
|
303 |
| - pub header: HashSet<Qualifiers>, |
304 |
| - pub abi: String, |
| 321 | + pub header: Header, |
305 | 322 | }
|
306 | 323 |
|
307 | 324 | #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
308 | 325 | pub struct Method {
|
309 | 326 | pub decl: FnDecl,
|
310 | 327 | pub generics: Generics,
|
311 |
| - pub header: HashSet<Qualifiers>, |
312 |
| - pub abi: String, |
| 328 | + pub header: Header, |
313 | 329 | pub has_body: bool,
|
314 | 330 | }
|
315 | 331 |
|
@@ -426,8 +442,7 @@ pub enum Type {
|
426 | 442 | pub struct FunctionPointer {
|
427 | 443 | pub decl: FnDecl,
|
428 | 444 | pub generic_params: Vec<GenericParamDef>,
|
429 |
| - pub header: HashSet<Qualifiers>, |
430 |
| - pub abi: String, |
| 445 | + pub header: Header, |
431 | 446 | }
|
432 | 447 |
|
433 | 448 | #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
|
0 commit comments