Skip to content

Commit a5d06a2

Browse files
bors-ferrocene[bot]Veykrilpietroalbini
authored
Merge #511
511: Add changelog appendix r=pietroalbini a=Veykril Co-authored-by: Lukas Wirth <[email protected]> Co-authored-by: Pietro Albini <[email protected]>
2 parents 3e662ea + b1f8956 commit a5d06a2

File tree

7 files changed

+244
-28
lines changed

7 files changed

+244
-28
lines changed

exts/ferrocene_spec/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
# SPDX-FileCopyrightText: The Ferrocene Developers
33

44
from . import definitions, informational, syntax_directive, std_role, paragraph_ids
5-
from . import items_with_rubric
6-
from .utils import FlsSortIds
5+
from . import items_with_rubric, sphinx_fixes
76
from sphinx.domains import Domain
87

98

@@ -38,11 +37,11 @@ def is_empty(data):
3837

3938
def setup(app):
4039
app.add_domain(SpecDomain)
41-
app.add_transform(FlsSortIds)
4240
definitions.setup(app)
4341
paragraph_ids.setup(app)
4442
informational.setup(app)
4543
items_with_rubric.setup(app)
44+
sphinx_fixes.setup(app)
4645

4746
app.add_config_value(
4847
name="spec_std_docs_url",

exts/ferrocene_spec/definitions/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def get_object_types():
214214
def id_from_text(kind, text):
215215
# We lowercase the text so that capitalization does not matter for
216216
# references and definitions, which is sometimes the case for when they are
217-
# used as the start of a sentence.
217+
# used at the start of a sentence.
218218
# Notably though, this breaks for paragraph ids which are unique randomized
219219
# strings where capitalization matters for hyperlinking, so we don't do so
220220
# for those

exts/ferrocene_spec/sphinx_fixes.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# SPDX-License-Identifier: MIT OR Apache-2.0
2+
# SPDX-FileCopyrightText: The Ferrocene Developers
3+
4+
from docutils import nodes
5+
from sphinx.transforms import SphinxTransform, SortIds
6+
7+
8+
# Sphinx by default sorts all ids of the form `id[0-9]+` to the end.
9+
# Our IDs are section name and fls_ id pairs, so in some cases this transform
10+
# will instead sort the section name to the back, but not always!
11+
# So we overwrite the transform instead so that our fls ids are sorted to the back.
12+
# In addition to that we normalize them, as sphinx turns the `_` in `fls_{id}`
13+
# into `fls-{id}` which can break the link check from working correctly.
14+
class FerroceneSortIds(SphinxTransform):
15+
# Run this step after sphinx sorted.
16+
default_priority = SortIds.default_priority + 1
17+
18+
def apply(self):
19+
for node in self.document.findall(nodes.section):
20+
for n, id in enumerate(node["ids"]):
21+
node["ids"][n] = normalize_fls_id(id)
22+
# sort the fls id to the back
23+
if len(node["ids"]) > 1 and node["ids"][0].startswith("fls_"):
24+
node["ids"] = node["ids"][1:] + [node["ids"][0]]
25+
26+
27+
class NormalizeFlsReferences(SphinxTransform):
28+
default_priority = 500
29+
30+
def apply(self):
31+
for reference in self.document.findall(nodes.reference):
32+
if "internal" not in reference or not reference["internal"]:
33+
continue
34+
if "refuri" not in reference or "#" not in reference["refuri"]:
35+
continue
36+
path, hash = reference["refuri"].rsplit("#", 1)
37+
reference["refuri"] = f"{path}#{normalize_fls_id(hash)}"
38+
39+
40+
def normalize_fls_id(id):
41+
if id.startswith("fls-"):
42+
return id.replace("fls-", "fls_", 1)
43+
else:
44+
return id
45+
46+
47+
def setup(app):
48+
app.add_transform(FerroceneSortIds)
49+
app.add_post_transform(NormalizeFlsReferences)

exts/ferrocene_spec/utils.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# SPDX-FileCopyrightText: The Ferrocene Developers
33

44
from docutils import nodes
5-
from sphinx import transforms
65

76

87
def section_id_and_anchor(section):
@@ -24,25 +23,3 @@ def section_id_and_anchor(section):
2423

2524
class NoSectionIdError(RuntimeError):
2625
pass
27-
28-
29-
# Sphinx by default sorts all ids of the form `id[0-9]+` to the end.
30-
# Our IDs are section name and fls_ id pairs, so in some cases this transform
31-
# will instead sort the section name to the back, but not always!
32-
# So we overwrite the transform instead so that our fls ids are sorted to the back.
33-
# In addition to that we normalize them, as sphinx turns the `_` in `fls_{id}`
34-
# into `fls-{id}` which can break the link check from working correctly.
35-
class FlsSortIds(transforms.SphinxTransform):
36-
# Run this step after sphinx sorted.
37-
default_priority = transforms.SortIds.default_priority + 1
38-
39-
def apply(self, **kwargs):
40-
from docutils import nodes
41-
42-
for node in self.document.findall(nodes.section):
43-
for n, id in enumerate(node["ids"]):
44-
if id.startswith("fls-"):
45-
node["ids"][n] = id[:3] + "_" + id[4:]
46-
# sort the fls id to the back
47-
if len(node["ids"]) > 1 and node["ids"][0].startswith("fls_"):
48-
node["ids"] = node["ids"][1:] + [node["ids"][0]]

src/changelog.rst

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
.. SPDX-License-Identifier: MIT OR Apache-2.0
2+
SPDX-FileCopyrightText: The Ferrocene Developers
3+
4+
.. default-domain:: spec
5+
.. informational-page::
6+
7+
FLS Changelog
8+
=============
9+
10+
This page describes the changes that have been applied to the FLS itself to
11+
address changes and new features introduced in each Rust release. Every item
12+
listed in the "Language" section of the release note is reproduced here, along
13+
with the change that has been applied due to it.
14+
15+
.. caution::
16+
17+
This page is **not** an exhaustive list of all of the changes in a release,
18+
just the language changes that had an impact to the FLS. See the `release
19+
notes`_ for a full list of changes.
20+
21+
Language changes in Rust 1.79.0
22+
-------------------------------
23+
24+
* `Stabilize inline \`const {}\` expressions. <https://github.com/rust-lang/rust/pull/104087/>`_
25+
26+
* New section: :ref:`fls_G59PiNQkVUnQ`
27+
28+
* `Prevent opaque types being instantiated twice with different regions within the same function. <https://github.com/rust-lang/rust/pull/116935/>`_
29+
30+
* No change: already described in :p:`fls_hza5n5eb18ta`
31+
32+
* `Stabilize WebAssembly target features that are in phase 4 and 5. <https://github.com/rust-lang/rust/pull/117457/>`_
33+
34+
* No change: ``cfg`` and ``cfg_attr`` configuration predicates are not part of the FLS
35+
36+
* `Add the \`redundant_lifetimes\` lint to detect lifetimes which are semantically redundant. <https://github.com/rust-lang/rust/pull/118391/>`_
37+
38+
* No change: lints are not part of the FLS
39+
40+
* `Stabilize the \`unnameable_types\` lint for public types that can't be named. <https://github.com/rust-lang/rust/pull/120144/>`_
41+
42+
* No change: lints are not part of the FLS
43+
44+
* `Enable debuginfo in macros, and stabilize \`-C collapse-macro-debuginfo\` and \`#[collapse_debuginfo]\`. <https://github.com/rust-lang/rust/pull/120845/>`_
45+
46+
* New section: :ref:`fls_qyudjGHZfyJH`
47+
48+
* `Propagate temporary lifetime extension into \`if\` and \`match\` expressions. <https://github.com/rust-lang/rust/pull/121346/>`_
49+
50+
* New paragraphs: :p:`fls_Rj9zhVutfQod`, :p:`fls_oodpp3LpXC13`, :p:`fls_xGThCPoTUSAi`
51+
52+
* `Restrict promotion of \`const fn\` calls. <https://github.com/rust-lang/rust/pull/121557/>`_
53+
54+
* No change: already described in :p:`fls_3h5vr7xk2rrt`
55+
56+
* `Warn against refining impls of crate-private traits with \`refining_impl_trait\` lint. <https://github.com/rust-lang/rust/pull/121720/>`_
57+
58+
* No change: lints are not part of the FLS
59+
60+
* `Stabilize associated type bounds (RFC 2289). <https://github.com/rust-lang/rust/pull/122055/>`_
61+
62+
* New paragraph: :p:`fls_mcUMWsYcxzmZ`
63+
64+
* `Stabilize importing \`main\` from other modules or crates. <https://github.com/rust-lang/rust/pull/122060/>`_
65+
66+
* No change: this lifted restriction was not previously described in the FLS
67+
68+
* While updating the FLS to account for this feature, we realized that the
69+
way the FLS described crate types was incorrect. We rectified this:
70+
71+
* New section: :ref:`fls_8JB3SJqamdpU`
72+
* New glossary entry: :t:`crate type`
73+
* New paragraphs: :p:`fls_unxalgMqIr3v`, :p:`fls_e7jGvXvTsFpC`, :p:`fls_kQiJPwb2Hjcc`, :p:`fls_OyFwBtDGVimT`
74+
* Updated glossary entries: :t:`binary crate`, :t:`proc-macro crate`
75+
* Updated paragraphs: :p:`fls_9ub6ks8qrang`, :p:`fls_Mf62VqAhoZ3c`
76+
* Moved paragraph: :p:`fls_sbGnkm8Ephiu`
77+
* Removed paragraph about library crates
78+
79+
* `Check return types of function types for well-formedness <https://github.com/rust-lang/rust/pull/115538>`_
80+
81+
* No change: the exact trait resolution implementation is not part of the FLS
82+
83+
* `Rework \`impl Trait\` lifetime inference <https://github.com/rust-lang/rust/pull/116891/>`_
84+
85+
* No change: capturing of lifestime within ``impl Trait`` types is not described in the FLS
86+
87+
* `Change inductive trait solver cycles to be ambiguous <https://github.com/rust-lang/rust/pull/122791>`_
88+
89+
* No change: the exact trait solver is not part of the FLS
90+
91+
Language changes in Rust 1.78.0
92+
-------------------------------
93+
94+
* `Stabilize \`#[cfg(target_abi = ...)]\` <https://github.com/rust-lang/rust/pull/119590/>`_
95+
96+
* No change: ``cfg`` and ``cfg_attr`` configuration predicates are not part of the FLS
97+
98+
* `Stabilize the \`#[diagnostic]\` namespace and \`#[diagnostic::on_unimplemented]\` attribute <https://github.com/rust-lang/rust/pull/119888/>`_
99+
100+
* No change: tool attributes are not part of the FLS
101+
102+
* `Make async-fn-in-trait implementable with concrete signatures <https://github.com/rust-lang/rust/pull/120103/>`_
103+
104+
* No change: no paragraph in the FLS forbids this prior incompatability
105+
106+
* `Make matching on NaN a hard error, and remove the rest of \`illegal_floating_point_literal_pattern\` <https://github.com/rust-lang/rust/pull/116284/>`_
107+
108+
* New paragraph: :p:`fls_JP8YSbxSN0Ym`
109+
110+
* `static mut: allow mutable reference to arbitrary types, not just slices and arrays <https://github.com/rust-lang/rust/pull/117614/>`_
111+
112+
* No change: this lifted restriction was not previously described in the FLS
113+
114+
* `Extend \`invalid_reference_casting\` to include references casting to bigger memory layout <https://github.com/rust-lang/rust/pull/118983/>`_
115+
116+
* No change: lints are not part of the FLS
117+
118+
* `Add \`non_contiguous_range_endpoints\` lint for singleton gaps after exclusive ranges <https://github.com/rust-lang/rust/pull/118879/>`_
119+
120+
* No change: lints are not part of the FLS
121+
122+
* `Add \`wasm_c_abi\` lint for use of older wasm-bindgen versions <https://github.com/rust-lang/rust/pull/117918/>`_
123+
124+
* No change: lints are not part of the FLS
125+
126+
* `Update \`indirect_structural_match\` and \`pointer_structural_match\` lints to match RFC <https://github.com/rust-lang/rust/pull/120423/>`_
127+
128+
* No change: lints are not part of the FLS
129+
130+
* `Make non-\`PartialEq\`-typed consts as patterns a hard error <https://github.com/rust-lang/rust/pull/120805/>`_
131+
132+
* No change: already described in :p:`fls_zCswsyuitexI`
133+
134+
* `Split \`refining_impl_trait\` lint into \`_reachable\`, \`_internal\` variants <https://github.com/rust-lang/rust/pull/121720/>`_
135+
136+
* No change: lints are not part of the FLS
137+
138+
* `Remove unnecessary type inference when using associated types inside of higher ranked \`where\`-bounds <https://github.com/rust-lang/rust/pull/119849>`_
139+
140+
* No change: the FLS does not specify type inference to such a degree
141+
142+
* `Weaken eager detection of cyclic types during type inference <https://github.com/rust-lang/rust/pull/119989>`_
143+
144+
* No change: the FLS does not specify type inference to such a degree
145+
146+
* `\`trait Trait: Auto {}\`: allow upcasting from \`dyn Trait\` to \`dyn Trait + Auto\` <https://github.com/rust-lang/rust/pull/119338>`_
147+
148+
language changes in Rust 1.77.0
149+
-------------------------------
150+
151+
* `Reveal opaque types within the defining body for exhaustiveness checking. <https://github.com/rust-lang/rust/pull/116821/>`_
152+
153+
* No change: the FLS does not specify introspection of the concrete type of the match expression scrutinee to such a degree
154+
155+
* `Stabilize C-string literals. <https://github.com/rust-lang/rust/pull/117472/>`_
156+
157+
* New section: :ref:`fls_U1gHCy16emVe`
158+
159+
* `Stabilize THIR unsafeck. <https://github.com/rust-lang/rust/pull/117673/>`_
160+
161+
* No change: not a language change
162+
163+
* `Add lint \`static_mut_refs\` to warn on references to mutable statics. <https://github.com/rust-lang/rust/pull/117556/>`_
164+
165+
* No change: lints are not part of the FLS
166+
167+
* `Support async recursive calls (as long as they have indirection). <https://github.com/rust-lang/rust/pull/117703/>`_
168+
169+
* No change: this lifted restriction was not previously described in the FLS
170+
171+
* `Undeprecate lint \`unstable_features\` and make use of it in the compiler. <https://github.com/rust-lang/rust/pull/118639/>`_
172+
173+
* No change: lints are not part of the FLS
174+
175+
* `Make inductive cycles in coherence ambiguous always. <https://github.com/rust-lang/rust/pull/118649/>`_
176+
177+
* No change: the FLS does not describe the trait solver to such a degree
178+
179+
* `Get rid of type-driven traversal in const-eval interning <https://github.com/rust-lang/rust/pull/119044/>`_, only as a `future compatibility lint <https://github.com/rust-lang/rust/pull/122204>`_ for now.
180+
181+
* No change: this lifted restriction was not previously described in the FLS
182+
183+
* `Deny braced macro invocations in let-else. <https://github.com/rust-lang/rust/pull/119062/>`_
184+
185+
* New paragraph: :p:`fls_1s1UikGU5YQb`
186+
187+
.. Note: for the publicly rendered version of the FLS we want to link to
188+
upstream's release notes. In the Ferrocene subtree this should be replaced
189+
to the link to the Ferrocene release notes!
190+
.. _release notes: https://doc.rust-lang.org/releases.html

src/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@
5656

5757
lint_alphabetical_section_titles = ["glossary"]
5858

59-
lint_no_paragraph_ids = ["index"]
59+
lint_no_paragraph_ids = ["index", "changelog"]

src/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Ferrocene Language Specification
4040
licenses
4141
glossary
4242
undefined-behavior
43+
changelog
4344

4445
Indices and tables
4546
------------------

0 commit comments

Comments
 (0)