Skip to content

Commit 0fcf050

Browse files
committed
v0.4
1 parent 683679c commit 0fcf050

File tree

5 files changed

+42
-3
lines changed

5 files changed

+42
-3
lines changed

COMMIT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6dff51f37d87eb02e8776032fa8da16c990a3283
1+
2a6022949077176bfff9f72282dc52e51a175cb7

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rustdoc-types"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
authors = ["Nixon Enraght-Moony <[email protected]>", "The Rust Project Developers"]
55
edition = "2018"
66
license = "MIT OR Apache-2.0"
@@ -10,3 +10,6 @@ repository = "https://github.com/aDotInTheVoid/rustdoc-types/"
1010

1111
[dependencies]
1212
serde = {version="1", features=["derive"]}
13+
14+
[dev-dependencies]
15+
serde_json = "1.0"

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ pub enum GenericArg {
127127
Lifetime(String),
128128
Type(Type),
129129
Const(Constant),
130+
Infer,
130131
}
131132

132133
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
@@ -322,7 +323,7 @@ pub struct GenericParamDef {
322323
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
323324
#[serde(rename_all = "snake_case")]
324325
pub enum GenericParamDefKind {
325-
Lifetime,
326+
Lifetime { outlives: Vec<String> },
326327
Type { bounds: Vec<GenericBound>, default: Option<Type> },
327328
Const { ty: Type, default: Option<String> },
328329
}

src/tests.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
use super::*;
2+
3+
#[test]
4+
fn test_struct_info_roundtrip() {
5+
let s = ItemEnum::Struct(Struct {
6+
struct_type: StructType::Plain,
7+
generics: Generics { params: vec![], where_predicates: vec![] },
8+
fields_stripped: false,
9+
fields: vec![],
10+
impls: vec![],
11+
});
12+
13+
let struct_json = serde_json::to_string(&s).unwrap();
14+
15+
let de_s = serde_json::from_str(&struct_json).unwrap();
16+
17+
assert_eq!(s, de_s);
18+
}
19+
20+
#[test]
21+
fn test_union_info_roundtrip() {
22+
let u = ItemEnum::Union(Union {
23+
generics: Generics { params: vec![], where_predicates: vec![] },
24+
fields_stripped: false,
25+
fields: vec![],
26+
impls: vec![],
27+
});
28+
29+
let union_json = serde_json::to_string(&u).unwrap();
30+
31+
let de_u = serde_json::from_str(&union_json).unwrap();
32+
33+
assert_eq!(u, de_u);
34+
}

update.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
curl -# https://raw.githubusercontent.com/rust-lang/rust/master/src/rustdoc-json-types/lib.rs | sed 's/rustc_data_structures::fx::/std::collections::/g' | sed 's/FxHashMap/HashMap/g' > src/lib.rs
44

5+
curl -# https://raw.githubusercontent.com/rust-lang/rust/master/src/rustdoc-json-types/tests.rs > src/tests.rs
56

67
curl -# "https://api.github.com/repos/rust-lang/rust/commits?path=src/rustdoc-json-types/lib.rs" | jq -r ".[0].sha" > COMMIT.txt

0 commit comments

Comments
 (0)