diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-07-24 05:05:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-24 05:05:33 +0200 |
| commit | e56e8867968f8565e3cf6242610f1344ce16be23 (patch) | |
| tree | b9568e97872a46852f907f45e514c49e75ae0977 | |
| parent | 6f696257cb5cbd782854af9f445dd6baab9a0cd7 (diff) | |
| parent | b8f7ed239495ae9b6d043365e19965006f007572 (diff) | |
| download | rust-e56e8867968f8565e3cf6242610f1344ce16be23.tar.gz rust-e56e8867968f8565e3cf6242610f1344ce16be23.zip | |
Rollup merge of #128043 - safinaskar:primitive, r=workingjubilee
Docs for core::primitive: mention that "core" can be shadowed, too, so we should write "::core" ``@rustbot`` label +A-docs
| -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..81a72118614 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 +//! the [extern prelude] since Edition 2018. +//! +//! [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; |
