From 7b937b9d6d3b1ddde53bb37b7748d7e844c15156 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Sat, 15 Aug 2026 11:29:24 +0200 Subject: [PATCH 1/3] items.use.restrictions.extern-prelude: be more clear example succeeds only in 2015 edition See `Ok` in example made me expect the example to succeed in later editions --- src/items/use-declarations.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/items/use-declarations.md b/src/items/use-declarations.md index 855f27ba85..e52186654d 100644 --- a/src/items/use-declarations.md +++ b/src/items/use-declarations.md @@ -443,11 +443,13 @@ r[items.use.restrictions.extern-prelude] > ``` > [!EDITION-2018] -> In the 2015 edition, the prefix `::` refers to the crate root, so `use ::{self as root};` is allowed because it is same as `use crate::{self as root};`. Starting with the 2018 edition the `::` prefix refers to the extern prelude, which cannot be directly imported. +> In the 2015 edition, the prefix `::` refers to the crate root, so `use ::{self as root};` is allowed because it is same as `use crate::{self as root};`. > > ```rust,edition2015 -> use ::{self as root}; //~ Ok +> use ::{self as root}; //~ Ok in 2015 edition > ``` +> +> Starting with the 2018 edition, the `::` prefix refers to the extern prelude, which cannot be directly imported. r[items.use.restrictions.duplicate-name] As with any item definition, `use` imports cannot create duplicate bindings of the same name in the same namespace in a module or block. From 4aca71b9c25083d573b6470343090cfff5d09259 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Tue, 25 Aug 2026 21:20:07 +0200 Subject: [PATCH 2/3] match code comment style elsewhere Co-authored-by: Travis Cross --- src/items/use-declarations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/items/use-declarations.md b/src/items/use-declarations.md index e52186654d..cd219e83c2 100644 --- a/src/items/use-declarations.md +++ b/src/items/use-declarations.md @@ -446,7 +446,7 @@ r[items.use.restrictions.extern-prelude] > In the 2015 edition, the prefix `::` refers to the crate root, so `use ::{self as root};` is allowed because it is same as `use crate::{self as root};`. > > ```rust,edition2015 -> use ::{self as root}; //~ Ok in 2015 edition +> use ::{self as root}; //~ OK in the 2015 edition. > ``` > > Starting with the 2018 edition, the `::` prefix refers to the extern prelude, which cannot be directly imported. From bff84ff20b82ffd74417fafe16cb3d52533898a6 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Tue, 25 Aug 2026 21:22:57 +0200 Subject: [PATCH 3/3] remove extraneous whitespace --- src/items/use-declarations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/items/use-declarations.md b/src/items/use-declarations.md index cd219e83c2..6f1dc3c2e1 100644 --- a/src/items/use-declarations.md +++ b/src/items/use-declarations.md @@ -448,7 +448,7 @@ r[items.use.restrictions.extern-prelude] > ```rust,edition2015 > use ::{self as root}; //~ OK in the 2015 edition. > ``` -> +> > Starting with the 2018 edition, the `::` prefix refers to the extern prelude, which cannot be directly imported. r[items.use.restrictions.duplicate-name]