Skip to content

Commit 70bef35

Browse files
committed
document where mutable references are allowed in const items
1 parent 83a05c6 commit 70bef35

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

src/changelog.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ Language changes in Rust 1.90.0
3333

3434
- Above paragraph replaces :p:`fls_6g7c1kjrmfnr` and :p:`fls_hkbwa8xx2fwx`
3535

36+
* New paragraphs:
37+
38+
- :p:`fls_ooOYxhVh8hZo`
39+
40+
- :p:`fls_zkNFeBLy80UA`
41+
42+
- :p:`fls_VhzGfnWg7YrG`
43+
44+
- :p:`fls_ibYKKQdB2tDn`
45+
46+
- :p:`fls_dQdSxf8kOgbi`
47+
3648
- `Allow volatile access to non-Rust memory, including address 0 <https://github.com/rust-lang/rust/pull/141260>`_
3749

3850
- No change: lints are not part of the FLS
@@ -336,8 +348,6 @@ Language changes in Rust 1.83.0
336348

337349
* Changed paragraphs: :p:`fls_to4e7imq2c0w`, :p:`fls_6g7c1kjrmfnr`, :p:`fls_hkbwa8xx2fwx`
338350

339-
* New paragraph: :p:`fls_ooOYxhVh8hZo`
340-
341351
* Removed paragraph: :p:`fls_ox6sgl9n43g2`
342352

343353
* `Allow creating references to statics in \`const\` initializers. <https://github.com/rust-lang/rust/pull/129759>`_

src/values.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ The :t:`type specification` of a :t:`constant` shall have ``'static``
9595
The :t:`type` of a :t:`constant` shall implement the :std:`core::marker::Sized`
9696
:t:`trait`.
9797

98-
:dp:`fls_ooOYxhVh8hZo`
99-
The type of a :t:`constant` cannot be a :t:`mutable reference type`.
100-
10198
:dp:`fls_ndmfqxjpvsqy`
10299
A :t:`constant initializer` is a :t:`construct` that provides the :t:`value` of
103100
its related :t:`constant`.
@@ -114,6 +111,23 @@ The :t:`expression` of a :t:`constant initializer` shall be a
114111
The value of a :t:`constant` is determined by evaluating its
115112
:t:`constant initializer`.
116113

114+
:dp:`fls_ooOYxhVh8hZo`
115+
After a :t:`constant initializer` is evaluated to a value of the declared type,
116+
the value of the constant, after :t:`type coercion`,
117+
cannot contain any :t:`[mutable reference]s`, except when
118+
119+
- :dp:`fls_zkNFeBLy80UA`
120+
The :t:`mutable reference` is contained within an :t:`external static`, or
121+
122+
- :dp:`fls_VhzGfnWg7YrG`
123+
The :t:`mutable reference` is contained within a :t:`mutable static`, or
124+
125+
- :dp:`fls_ibYKKQdB2tDn`
126+
The :t:`mutable reference` is contained within an :t:`union`, or
127+
128+
- :dp:`fls_dQdSxf8kOgbi`
129+
The :t:`referent` is a value of a :t:`zero-sized type`.
130+
117131
.. rubric:: Dynamic Semantics
118132

119133
:dp:`fls_xezt9hl069h4`

0 commit comments

Comments
 (0)