Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 18 additions & 1 deletion src/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ 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`

- Changed paragraphs:

- :p:`fls_2bkcn83smy2y`
- :p:`fls_iuzvtr3oax1o`
- :p:`fls_90hQvSh7Bfyg`
- :p:`fls_RUiFQ17bmRLt`

- `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 +58,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
24 changes: 16 additions & 8 deletions src/entities-and-resolution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,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`.
:t:`nesting import`, or the :t:`path` of a :t:`simple import`.

:dp:`fls_cw006jhlboa`
If a :t:`simple path` appears in a :t:`use import` and starts with a
Expand Down Expand Up @@ -1049,9 +1049,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 brings a :t:`simple path` into scope, optionally with a :t:`renaming`.

:dp:`fls_v3a6y2ze44v2`
A :t:`glob import` is a :t:`use import` that brings all :t:`entities <entity>`
Expand All @@ -1075,7 +1073,7 @@ 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`
Expand Down Expand Up @@ -1116,7 +1114,7 @@ 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
A :t:`simple import` with a single :t:`path segment` of
keyword ``self`` shall be subject to the following:

* :dp:`fls_hv3xT2CjZuxc`
Expand All @@ -1135,6 +1133,18 @@ 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_sUhnfV62HJrb`
When :t:`keyword` ``crate`` or :t:`keyword` ``$crate`` is used to import the current :t:`crate`, the keyword shall be subject to a :t:`renaming`.

:dp:`fls_QGdeRTe0H1Uc`
When :t:`keyword` ``super`` is used to import a parent :t:`module`, the keyword shall be subject to a :t:`renaming`.

:dp:`fls_aam34hsRmKU2`
An :t:`external prelude` cannot be imported.
Copy link
Copy Markdown
Contributor

@PLeVasseur PLeVasseur Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence reads too broadly. Rust 2021 still allows imports through extern-prelude crate names, such as use ::std::io;. The disallowed case is importing bare leading :: itself, for example use ::{self as root};.

As written, An external prelude cannot be imported. reads as though extern-prelude imports are disallowed wholesale.

Could this be restated in terms of :: as the extern-prelude root instead? If so, the earlier global-path rules probably also need a follow-on update so Rust 2021 no longer appears to permit ::self, ::super, ::crate, or ::$crate.

Support:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this wording:

A :t:global path shall not consist of a single :t:path segment expressed as :t:keyword crate, :t:keyword $crate, :t:keyword self, or :t:keyword super.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be restated in terms of :: as the extern-prelude root instead? If so, the earlier global-path rules probably also need a follow-on update so Rust 2021 no longer appears to permit ::self, ::super, ::crate, or ::$crate.

@PLeVasseur can you provide alternative wording... it's not clear to me what an extern prelude is (Reference does not make it clear either), and I also don't see how any rule appears to permit the import paths shown


: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 +1174,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