Skip to content
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f96cea0
stray
tshepang Apr 15, 2026
655bbe3
document missing import restrictions
tshepang Apr 15, 2026
f18f69d
be more formal
tshepang Apr 21, 2026
d02ce01
use normative language
tshepang May 6, 2026
f69dd3d
make "simple import" definition more clear, and fix one in main text
tshepang May 8, 2026
91092bf
use more simple sentences
tshepang May 8, 2026
2b56a0b
match existing style
tshepang May 8, 2026
9c70941
this fills a prior gap
tshepang May 13, 2026
215f85e
clarify rule
tshepang May 29, 2026
0f2c9c1
extra precision
tshepang May 29, 2026
d7e8007
the ranaming applies specifically to the path segment
tshepang May 29, 2026
2765077
remove the overspecification
tshepang May 29, 2026
857cd5e
re-word to match parent changes
tshepang Jun 2, 2026
29ca7f8
better grammar, maybe
tshepang Jun 2, 2026
542679c
fix case
tshepang Jun 12, 2026
c57f5c6
use better terminology
tshepang Jun 12, 2026
d6f50e9
there already exists a rule definiting what the 2 keywords mean
tshepang Jun 13, 2026
51e5a8d
this is a special term, so link to definition
tshepang Jun 13, 2026
106dab1
clarity
tshepang Jun 13, 2026
9e87caf
`self` is more special than the other path keywords
tshepang Jun 15, 2026
c2ca8e1
unwrap
tshepang Jun 15, 2026
a2fd6c1
simplify a rule
tshepang Jun 18, 2026
8724822
move import renaming rules closer together
tshepang Jun 18, 2026
8bc4ab2
update the super import rule
tshepang Jun 18, 2026
001ba74
global path: add a new rule and expand an existing one
tshepang Jun 19, 2026
f237bce
consistency
tshepang Jun 23, 2026
9170045
be more precise, and consistent
tshepang Jun 23, 2026
56129b0
use more precise terminology, and removed what is already a separate …
tshepang Jun 24, 2026
e3a53f6
use consistent terminology, and flatten list
tshepang Jun 24, 2026
55ab2bc
be more consistent and complete
tshepang Jun 24, 2026
e437648
fix grammar and be more precise
tshepang Jun 25, 2026
65a5da6
improve wording
tshepang Jun 25, 2026
90feab2
whitespace
tshepang Jun 25, 2026
d261d1c
fix markup
tshepang Jun 25, 2026
ed408f7
be more precise, and consistent
tshepang Jun 25, 2026
f6cf2fc
much better wording
tshepang Jun 25, 2026
57ceb2f
re-word
tshepang Jun 29, 2026
70947a6
fix rule that is overly broad
tshepang Jun 29, 2026
4332f41
re-word
tshepang Jun 29, 2026
79aefcb
rename "simple path prefix" to "common path prefix"
tshepang Jun 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion src/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,33 @@ Language changes in Rust 1.95.0
- Lints are outside the scope of the FLS.

- `Support importing path-segment keywords with renaming <https://github.com/rust-lang/rust/pull/146972>`_

- New paragraphs:

- :p:`fls_sUhnfV62HJrb`
- :p:`fls_QGdeRTe0H1Uc`
- :p:`fls_aam34hsRmKU2`
- :p:`fls_uSajfdSsbxna`
- :p:`fls_aam34hsRmKU2`

- Changed paragraphs:

- :p:`fls_2bkcn83smy2y`
- :p:`fls_iuzvtr3oax1o`
- :p:`fls_90hQvSh7Bfyg`
- :p:`fls_RUiFQ17bmRLt`
- :p:`fls_opn5n5t2mo3m`
- :p:`fls_7k88ypcgaoff`
- :dp:`fls_yY58pFpkig9o`
- :dp:`fls_ar03D5rxjzy0`

- Removed paragraphs:

- :p:`fls_cw006jhlboa`
- :p:`fls_hv3xT2CjZuxc`
- :p:`fls_Pxc0Ts8Y7pfW`
- :p:`fls_kz2Gij5wHXnl`

- `Stabilize ppc inline assembly <https://github.com/rust-lang/rust/pull/147996>`_

- The target is outside the scope of the FLS.
Expand All @@ -44,7 +71,10 @@ FLS corrections

Changed paragraph: :p:`fls_1941wid94hlg`

New paragraph: :p:`fls_CSuxTkwR96j9`
New paragraphs:

- :p:`fls_CSuxTkwR96j9`
- :p:`fls_LV94x3HlpBWk`

Language changes in Rust 1.94.0
-------------------------------
Expand Down
76 changes: 32 additions & 44 deletions src/entities-and-resolution.rst
Comment thread
PLeVasseur marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -295,24 +295,25 @@ A :t:`path segment` is an element of a :t:`path`.
A :t:`path` is subject to :t:`path resolution`.

:dp:`fls_opn5n5t2mo3m`
If a :t:`path segment` is expressed as either :t:`keyword` ``crate``,
:t:`keyword` ``$crate``, :t:`keyword` ``self``, or :t:`keyword` ``Self``, then
the :t:`path segment` shall be the first :t:`path segment` of a :t:`path`.
If a :t:`path segment` is expressed as either :t:`keyword` ``crate``, :t:`keyword` ``$crate``, or :t:`keyword` ``Self``, then the :t:`path segment` shall be the first :t:`path segment` of a :t:`path`.

:dp:`fls_uSajfdSsbxna`
If a :t:`path segment` is expressed as :t:`keyword` ``self``, then the :t:`path segment` shall be the first :t:`path segment` of a :t:`path`, except that it may also be the last :t:`path segment` of a :t:`simple import` that appears in a :t:`nesting import`.
Comment thread
tshepang marked this conversation as resolved.
Outdated

:dp:`fls_774uryecc2sx`
A :t:`path` that starts with a :t:`path segment` that is expressed as
:t:`keyword` ``$crate`` shall appear only within a :t:`macro transcriber`.

:dp:`fls_7k88ypcgaoff`
If a :t:`path segment` is expressed as :t:`keyword` ``super``, then the
:t:`path segment` shall either be the first :t:`path segment` of a :t:`path`,
or the previous :t:`path segment` of the :t:`path` shall also be expressed as
:t:`keyword` ``super``.
If a :t:`path segment` is expressed as :t:`keyword` ``super``, then each :t:`path segment` that precedes it in the :t:`path` shall be expressed as :t:`keyword` ``super``, except that the first :t:`path segment` of the :t:`path` may be expressed as :t:`keyword` ``self``.

:dp:`fls_7kb6ltajgiou`
A :t:`global path` is a :t:`path` that starts with :t:`namespace qualifier`
``::``.

:dp:`fls_P6dFw89ZDKv2`
The first :t:`path segment` of a :t:`global path` shall be expressed as an :t:`identifier` whose :t:`name` matches the :t:`name` of a :t:`candidate external prelude entity`.

:dp:`fls_n77icl6idazp`
A :t:`simple path` is a :t:`path` whose :t:`[path segment]s` consist of either
:t:`[identifier]s` or certain :t:`[keyword]s` as defined in the syntax rules
Expand All @@ -327,13 +328,7 @@ If a :t:`simple path` appears in a :t:`use import` and starts with a
:t:`path segment` expressed as either :t:`keyword` ``crate``, :t:`keyword`
``$crate``, :t:`keyword` ``self``, or :t:`keyword` ``super``, then the
:t:`path` shall be the :t:`simple path prefix` of a :t:`glob import` or a
:t:`nesting import`, or the :t:`simple path` of a :t:`simple import`.

:dp:`fls_cw006jhlboa`
If a :t:`simple path` appears in a :t:`use import` and starts with a
:t:`path segment` expressed as :t:`keyword` ``self``, then the :t:`path` shall
be part of the :s:`UseImportContent` of a :t:`nesting import` as long as the
:t:`path` is a :t:`single segment path`.
:t:`nesting import`, or the :t:`path` of a :t:`simple import`.

:dp:`fls_kv5bpq8rf1j9`
A :t:`simple path` is subject to :t:`simple path resolution`.
Expand Down Expand Up @@ -1049,9 +1044,7 @@ An :dt:`import path prefix` is the fully constructed :t:`path` prefix of a
the current :t:`use import`.

:dp:`fls_2bkcn83smy2y`
A :t:`simple import` is a :t:`use import` that brings all :t:`entities <entity>`
it refers to into scope, optionally with a different
:t:`name` than they are declared with by using a :t:`renaming`.
A :dt:`simple import` is a :t:`use import` that bring an :t:`entity` selected by its :t:`simple import path`, or by its :t:`import path prefix` when its :t:`simple path` ends in :t:`keyword` ``self`` and it appears in a :t:`nesting import`, into :t:`scope`.
Comment thread
kirtchev-adacore marked this conversation as resolved.
Outdated

:dp:`fls_v3a6y2ze44v2`
A :t:`glob import` is a :t:`use import` that brings all :t:`entities <entity>`
Expand All @@ -1075,37 +1068,30 @@ A :t:`glob import` brings :t:`[name]s` into :t:`scope` as follows:

:dp:`fls_90hQvSh7Bfyg`
A :dt:`simple import path` is the :t:`path` constructed by appending the last
:t:`path segment` of a :t:`simple import`'s :t:`simple path` to the
:t:`path segment` of the :t:`path` of the :t:`simple import` to the
:t:`import path prefix`.

:dp:`fls_wRmvtgQkFA6w`
A :t:`simple import` brings :t:`[name]s` into :t:`scope` as follows:

* :dp:`fls_kz2Gij5wHXnl`
If the :t:`simple path` is keyword ``self`` and:

* :dp:`fls_yY58pFpkig9o`
The :t:`simple import` is in a :t:`nesting import`, then bring the
:t:`entity` in :t:`type namespace` that the :t:`import path prefix` resolves
to into :t:`scope`.
* :dp:`fls_yY58pFpkig9o`
If the :t:`simple import` appears in a :t:`nesting import`, and the last :t:`path segment` of its :t:`simple path` is expressed as :t:`keyword` ``self``, then bring the :t:`entity` in :t:`type namespace` that the :t:`import path prefix` resolves to into :t:`scope`.
Comment thread
tshepang marked this conversation as resolved.
Outdated

* :dp:`fls_ar03D5rxjzy0`
Otherwise bring the containing :t:`module` into :t:`scope`.
* :dp:`fls_ar03D5rxjzy0`
If the :t:`simple path` is :t:`keyword` ``self``, then bring the containing :t:`module` into :t:`scope`.
Comment thread
tshepang marked this conversation as resolved.
Outdated

* :dp:`fls_ce73bg0BqV1X`
Otherwise bring all :t:`entities <entity>` that the :t:`simple import path`
resolves to that are visible from the location of the
:t:`simple import` into :t:`scope`.

:dp:`fls_FILuR3pfwjw3`
An :t:`Entity` imported by a :t:`simple import` subject to a
An :t:`entity` imported by a :t:`simple import` subject to a
:t:`renaming` with :t:`identifier` is brought into :t:`scope` under the
:t:`name` declared by the :t:`renaming`.

:dp:`fls_iQOgxNihUEr7`
A :t:`trait` imported by a :t:`simple import` subject to a
:t:`renaming` with character underscore ``_`` is added into :t:`scope` without
a :t:`name`.
An :t:`entity` imported by a :t:`simple import` subject to a :t:`renaming` with character underscore ``_`` is added into :t:`scope` without a :t:`name`.

:dp:`fls_ldr7tsuqw34s`
A :t:`nesting import` is a :t:`use import` that provides a common
Expand All @@ -1115,17 +1101,6 @@ A :t:`nesting import` is a :t:`use import` that provides a common
A :t:`glob import` outside of a :t:`nesting import` without a :t:`simple path
prefix` is rejected, but may still be consumed by :t:`[macro]s`.

:dp:`fls_RUiFQ17bmRLt`
A :t:`simple import` with a :t:`simple path` with a single :t:`path segment` of
keyword ``self`` shall be subject to the following:

* :dp:`fls_hv3xT2CjZuxc`
It shall either appear in a :t:`nesting import` with a non-empty
:t:`import path prefix`, or

* :dp:`fls_Pxc0Ts8Y7pfW`
It shall be subject to a :t:`renaming`.

:dp:`fls_wB3fVglLOqbZ`
It is a static error if two :t:`[glob import]s` import the same :t:`name` in the
same :t:`namespace` but refer to different :t:`entities <entity>` if the
Expand All @@ -1135,6 +1110,21 @@ same :t:`namespace` but refer to different :t:`entities <entity>` if the
If two :t:`[glob import]s` import the same :t:`entity` under the same :t:`name`,
the :t:`visibility` of the :t:`name` is the most permissive one.

:dp:`fls_RUiFQ17bmRLt`
A :t:`simple import` with a single :t:`path segment` expressed as :t:`keyword` ``self`` shall be subject to a :t:`renaming`.
Comment thread
PLeVasseur marked this conversation as resolved.
Outdated

:dp:`fls_sUhnfV62HJrb`
A :t:`use import` with a single :t:`path segment` expressed as either :t:`keyword` ``crate`` or :t:`keyword` ``$crate`` shall be subject to a :t:`renaming`.

:dp:`fls_QGdeRTe0H1Uc`
When a :t:`path segment` expressed as :t:`keyword` ``super`` is used to import a parent :t:`module`, the imported :t:`entity` shall be subject to a :t:`renaming`.

:dp:`fls_aam34hsRmKU2`
A :t:`global path` where any of its :t:`[path segment]s` are expressed as any of the :t:`[keyword]s`, ``self``, ``super``, ``crate``, and ``$crate``, shall not be used.
Comment thread
PLeVasseur marked this conversation as resolved.
Outdated

:dp:`fls_LV94x3HlpBWk`
A :t:`simple import` shall not refer to :t:`[enum variant]s` through a :t:`type alias`.

.. rubric:: Examples

:dp:`fls_5dlnffim6fso`
Expand Down Expand Up @@ -1164,8 +1154,6 @@ The following is a selective import. The imported functions are
use outer_module::inner_module
{crate_visible_function, visible_function}

.. rubric:: Legality Rules

Comment thread
tshepang marked this conversation as resolved.
.. _fls_ydmnb7qnmzzq:

Shadowing
Expand Down
3 changes: 1 addition & 2 deletions src/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4099,8 +4099,7 @@ See :s:`SimpleCStringLiteral`.
simple import
^^^^^^^^^^^^^

A :dt:`simple import` is a :t:`use import` that binds a :t:`simple path` to a
local :t:`name` by using an optional :t:`renaming`.
A :dt:`simple import` is a :t:`use import` that brings a :t:`simple path` into scope, optionally with a :t:`renaming`.

See :s:`SimpleImport`.

Expand Down
Loading