diff options
| author | Askar Safin <safinaskar@gmail.com> | 2024-07-22 00:42:23 +0300 |
|---|---|---|
| committer | Askar Safin <safinaskar@gmail.com> | 2024-07-23 05:14:16 +0300 |
| commit | b2e5ccef5ed3947cfe06ec4ae1361fa9bfa5f2b9 (patch) | |
| tree | 0e736d4e5ab7b6f503f0a98aa9d5370a394a14c5 | |
| parent | 894f7a4ba6554d3797404bbf550d9919df060b97 (diff) | |
| download | rust-b2e5ccef5ed3947cfe06ec4ae1361fa9bfa5f2b9.tar.gz rust-b2e5ccef5ed3947cfe06ec4ae1361fa9bfa5f2b9.zip | |
Docs for core::primitive: mention that "core" can be shadowed, too, so we should write "::core"
| -rw-r--r-- | library/core/src/primitive.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/library/core/src/primitive.rs b/library/core/src/primitive.rs index e20b2c5c938..435e211bac8 100644 --- a/library/core/src/primitive.rs +++ b/library/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; |
