Skip to content

Commit 078d680

Browse files
committed
misc stuff
Support `Stabilized APIs` and `Rustdoc` Consider `Libraries` header instead of `Library` Newtype instead of having a 20 arity tuple of strings Delete `_unsorted` dead code
1 parent 33e78d7 commit 078d680

File tree

2 files changed

+91
-75
lines changed

2 files changed

+91
-75
lines changed

src/main.rs

Lines changed: 73 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,19 @@ const RELNOTES_LABELS: &[&str] = &[
2121
#[derive(Clone, Template)]
2222
#[template(path = "relnotes.md", escape = "none")]
2323
struct ReleaseNotes {
24-
cargo_relnotes: String,
25-
cargo_unsorted: String,
26-
compat_relnotes: String,
27-
compat_unsorted: String,
28-
compiler_relnotes: String,
29-
compiler_unsorted: String,
24+
version: String,
3025
date: NaiveDate,
26+
3127
language_relnotes: String,
32-
language_unsorted: String,
28+
compiler_relnotes: String,
3329
libraries_relnotes: String,
34-
libraries_unsorted: String,
35-
unsorted: String,
36-
unsorted_relnotes: String,
37-
version: String,
30+
stabilized_apis_relnotes: String,
31+
const_stabilized_apis_relnotes: String,
32+
cargo_relnotes: String,
33+
rustdoc_relnotes: String,
34+
compat_relnotes: String,
3835
internal_changes_relnotes: String,
39-
internal_changes_unsorted: String,
36+
other_relnotes: String,
4037
}
4138

4239
fn main() {
@@ -68,58 +65,42 @@ fn main() {
6865
.any(|o| SKIP_LABELS.contains(&o["name"].as_str().unwrap()))
6966
});
7067

71-
let (relnotes, rest) = in_release
68+
let relnotes = in_release
7269
.into_iter()
73-
.partition::<Vec<_>, _>(|o| has_tags(o, RELNOTES_LABELS));
70+
.filter(|o| has_tags(o, RELNOTES_LABELS))
71+
.collect::<Vec<_>>();
7472

75-
let (
76-
compat_relnotes,
77-
libraries_relnotes,
73+
let Sections {
7874
language_relnotes,
7975
compiler_relnotes,
76+
libraries_relnotes,
77+
stabilized_apis_relnotes,
78+
const_stabilized_apis_relnotes,
79+
rustdoc_relnotes,
80+
compat_relnotes,
8081
internal_changes_relnotes,
81-
unsorted_relnotes,
82-
) = to_sections(relnotes, &mut tracking_rust);
83-
84-
let (
85-
compat_unsorted,
86-
libraries_unsorted,
87-
language_unsorted,
88-
compiler_unsorted,
89-
internal_changes_unsorted,
90-
unsorted,
91-
) = to_sections(rest, &mut tracking_rust);
82+
other_relnotes,
83+
} = to_sections(relnotes, &mut tracking_rust);
9284

9385
let cargo_issues = get_issues_by_milestone(&version, "cargo");
9486

95-
let (cargo_relnotes, cargo_unsorted) = {
96-
let (relnotes, rest) = cargo_issues
87+
let cargo_relnotes = {
88+
let relnotes = cargo_issues
9789
.iter()
98-
.partition::<Vec<_>, _>(|o| has_tags(o, RELNOTES_LABELS));
90+
.filter(|o| has_tags(o, RELNOTES_LABELS))
91+
.collect::<Vec<_>>();
9992

100-
(
101-
relnotes
102-
.iter()
103-
.map(|o| {
104-
format!(
105-
"- [{title}]({url}/)",
106-
title = o["title"].as_str().unwrap(),
107-
url = o["url"].as_str().unwrap(),
108-
)
109-
})
110-
.collect::<Vec<_>>()
111-
.join("\n"),
112-
rest.iter()
113-
.map(|o| {
114-
format!(
115-
"- [{title}]({url}/)",
116-
title = o["title"].as_str().unwrap(),
117-
url = o["url"].as_str().unwrap(),
118-
)
119-
})
120-
.collect::<Vec<_>>()
121-
.join("\n"),
122-
)
93+
relnotes
94+
.iter()
95+
.map(|o| {
96+
format!(
97+
"- [{title}]({url}/)",
98+
title = o["title"].as_str().unwrap(),
99+
url = o["url"].as_str().unwrap(),
100+
)
101+
})
102+
.collect::<Vec<_>>()
103+
.join("\n")
123104
};
124105

125106
for issue in tracking_rust.issues.values() {
@@ -156,20 +137,17 @@ fn main() {
156137
let relnotes = ReleaseNotes {
157138
version,
158139
date: (end + six_weeks).naive_utc(),
159-
compat_relnotes,
160-
compat_unsorted,
140+
161141
language_relnotes,
162-
language_unsorted,
163-
libraries_relnotes,
164-
libraries_unsorted,
165142
compiler_relnotes,
166-
compiler_unsorted,
143+
libraries_relnotes,
144+
rustdoc_relnotes,
145+
stabilized_apis_relnotes,
146+
const_stabilized_apis_relnotes,
167147
cargo_relnotes,
168-
cargo_unsorted,
169148
internal_changes_relnotes,
170-
internal_changes_unsorted,
171-
unsorted_relnotes,
172-
unsorted,
149+
compat_relnotes,
150+
other_relnotes,
173151
};
174152

175153
println!("{}", relnotes.render().unwrap());
@@ -428,24 +406,44 @@ fn has_tags<'a>(o: &'a json::Value, tags: &[&str]) -> bool {
428406
.any(|o| tags.iter().any(|tag| o["name"] == *tag))
429407
}
430408

409+
struct Sections {
410+
language_relnotes: String,
411+
compiler_relnotes: String,
412+
libraries_relnotes: String,
413+
stabilized_apis_relnotes: String,
414+
const_stabilized_apis_relnotes: String,
415+
rustdoc_relnotes: String,
416+
compat_relnotes: String,
417+
internal_changes_relnotes: String,
418+
other_relnotes: String,
419+
}
420+
431421
fn to_sections<'a>(
432422
iter: impl IntoIterator<Item = &'a json::Value>,
433423
mut tracking: &mut TrackingIssues,
434-
) -> (String, String, String, String, String, String) {
424+
) -> Sections {
435425
let mut by_section = HashMap::new();
436-
by_section.insert("Compatibility Notes", String::new());
437-
by_section.insert("Library", String::new());
438426
by_section.insert("Language", String::new());
439427
by_section.insert("Compiler", String::new());
428+
by_section.insert("Libraries", String::new());
429+
by_section.insert("Stabilized APIs", String::new());
430+
by_section.insert("Const Stabilized APIs", String::new());
431+
by_section.insert("Rustdoc", String::new());
432+
by_section.insert("Compatibility Notes", String::new());
440433
by_section.insert("Internal Changes", String::new());
441434
by_section.insert("Other", String::new());
435+
442436
map_to_line_items(iter, &mut tracking, &mut by_section);
443-
(
444-
by_section.remove("Compatibility Notes").unwrap(),
445-
by_section.remove("Library").unwrap(),
446-
by_section.remove("Language").unwrap(),
447-
by_section.remove("Compiler").unwrap(),
448-
by_section.remove("Internal Changes").unwrap(),
449-
by_section.remove("Other").unwrap(),
450-
)
437+
438+
Sections {
439+
language_relnotes: by_section.remove("Language").unwrap(),
440+
compiler_relnotes: by_section.remove("Compiler").unwrap(),
441+
libraries_relnotes: by_section.remove("Libraries").unwrap(),
442+
stabilized_apis_relnotes: by_section.remove("Stabilized APIs").unwrap(),
443+
const_stabilized_apis_relnotes: by_section.remove("Const Stabilized APIs").unwrap(),
444+
rustdoc_relnotes: by_section.remove("Rustdoc").unwrap(),
445+
compat_relnotes: by_section.remove("Compatibility Notes").unwrap(),
446+
internal_changes_relnotes: by_section.remove("Internal Changes").unwrap(),
447+
other_relnotes: by_section.remove("Other").unwrap(),
448+
}
451449
}

templates/relnotes.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,24 @@ Libraries
2424
Stabilized APIs
2525
---------------
2626

27+
{{stabilized_apis_relnotes}}
28+
29+
These APIs are now stable in const contexts:
30+
31+
{{const_stabilized_apis_relnotes}}
32+
2733
<a id="{{version}}-Cargo"></a>
2834

2935
Cargo
3036
-----
3137
{{cargo_relnotes}}
3238

39+
<a id="{{version}}-Rustdoc"></a>
40+
41+
Rustdoc
42+
-----
43+
{{rustdoc_relnotes}}
44+
3345
<a id="{{version}}-Compatibility-Notes"></a>
3446

3547
Compatibility Notes
@@ -46,3 +58,9 @@ significant improvements to the performance or internals of rustc and related
4658
tools.
4759

4860
{{internal_changes_relnotes}}
61+
62+
63+
Other
64+
-----
65+
66+
{{other_relnotes}}

0 commit comments

Comments
 (0)