From 8be45a9e6a76791daf8fdd278b09291851138a03 Mon Sep 17 00:00:00 2001 From: Askar Safin Date: Mon, 22 Jul 2024 00:42:23 +0300 Subject: [PATCH 1/2] Docs for core::primitive: mention that "core" can be shadowed, too, so we should write "::core" --- core/src/primitive.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/src/primitive.rs b/core/src/primitive.rs index e20b2c5c9382a..435e211bac8fb 100644 --- a/core/src/primitive.rs +++ b/core/src/primitive.rs @@ -12,7 +12,7 @@ //! const SOME_PROPERTY: bool = true; //! } //! -//! # trait QueryId { const SOME_PROPERTY: core::primitive::bool; } +//! # trait QueryId { const SOME_PROPERTY: ::core::primitive::bool; } //! ``` //! //! Note that the `SOME_PROPERTY` associated constant would not compile, as its @@ -25,11 +25,17 @@ //! pub struct bool; //! //! impl QueryId for bool { -//! const SOME_PROPERTY: core::primitive::bool = true; +//! const SOME_PROPERTY: ::core::primitive::bool = true; //! } //! -//! # trait QueryId { const SOME_PROPERTY: core::primitive::bool; } +//! # trait QueryId { const SOME_PROPERTY: ::core::primitive::bool; } //! ``` +//! +//! We also used `::core` instead of `core`, because `core` can be +//! shadowed, too. Paths, starting with `::`, are searched in +//! [extern prelude]. +//! +//! [extern prelude]: https://doc.rust-lang.org/nightly/reference/names/preludes.html#extern-prelude #[stable(feature = "core_primitive", since = "1.43.0")] pub use bool; From 2b3eacb22c6af08f0c4d3cae8f698eea848aa809 Mon Sep 17 00:00:00 2001 From: Askar Safin Date: Tue, 23 Jul 2024 23:11:26 +0300 Subject: [PATCH 2/2] library/core/src/primitive.rs: small doc fix Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com> --- core/src/primitive.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/primitive.rs b/core/src/primitive.rs index 435e211bac8fb..81a72118614dd 100644 --- a/core/src/primitive.rs +++ b/core/src/primitive.rs @@ -33,7 +33,7 @@ //! //! We also used `::core` instead of `core`, because `core` can be //! shadowed, too. Paths, starting with `::`, are searched in -//! [extern prelude]. +//! the [extern prelude] since Edition 2018. //! //! [extern prelude]: https://doc.rust-lang.org/nightly/reference/names/preludes.html#extern-prelude