Skip to content

Commit ccba33c

Browse files
authored
Rollup merge of rust-lang#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
2 parents a069998 + 2b3eacb commit ccba33c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

core/src/primitive.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! const SOME_PROPERTY: bool = true;
1313
//! }
1414
//!
15-
//! # trait QueryId { const SOME_PROPERTY: core::primitive::bool; }
15+
//! # trait QueryId { const SOME_PROPERTY: ::core::primitive::bool; }
1616
//! ```
1717
//!
1818
//! Note that the `SOME_PROPERTY` associated constant would not compile, as its
@@ -25,11 +25,17 @@
2525
//! pub struct bool;
2626
//!
2727
//! impl QueryId for bool {
28-
//! const SOME_PROPERTY: core::primitive::bool = true;
28+
//! const SOME_PROPERTY: ::core::primitive::bool = true;
2929
//! }
3030
//!
31-
//! # trait QueryId { const SOME_PROPERTY: core::primitive::bool; }
31+
//! # trait QueryId { const SOME_PROPERTY: ::core::primitive::bool; }
3232
//! ```
33+
//!
34+
//! We also used `::core` instead of `core`, because `core` can be
35+
//! shadowed, too. Paths, starting with `::`, are searched in
36+
//! the [extern prelude] since Edition 2018.
37+
//!
38+
//! [extern prelude]: https://doc.rust-lang.org/nightly/reference/names/preludes.html#extern-prelude
3339
3440
#[stable(feature = "core_primitive", since = "1.43.0")]
3541
pub use bool;

0 commit comments

Comments
 (0)