From c734db08b707c2d6d54804284b63930b676ec795 Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Fri, 26 Feb 2016 01:04:10 +0100 Subject: [PATCH] Add links to how to disable the default prelude Running `grep -r no_implicit_prelude doc src/{libstd,libcore}` resulted in only the one hit in the reference. Added links from the documentation for `std::prelude` and `core::prelude::v1` to make it easier to find. --- src/libcore/prelude/v1.rs | 5 ++++- src/libstd/prelude/mod.rs | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/libcore/prelude/v1.rs b/src/libcore/prelude/v1.rs index 75db6fceab9b7..098d5eff05010 100644 --- a/src/libcore/prelude/v1.rs +++ b/src/libcore/prelude/v1.rs @@ -12,7 +12,10 @@ //! //! This module is intended for users of libcore which do not link to libstd as //! well. This module is imported by default when `#![no_std]` is used in the -//! same manner as the standard library's prelude. +//! same manner as the standard library's prelude (so not at all if the +//! [`no_implicit_prelude` attribute][module-only-attributes] is used). +//! +//! [module-only-attributes]: ../../../reference.html#module-only-attributes #![stable(feature = "core_prelude", since = "1.4.0")] diff --git a/src/libstd/prelude/mod.rs b/src/libstd/prelude/mod.rs index ebd299efa78db..f69f92611b589 100644 --- a/src/libstd/prelude/mod.rs +++ b/src/libstd/prelude/mod.rs @@ -47,6 +47,15 @@ //! are not automatically `use`'d, and must be imported manually. This is still //! easier than importing all of their constituent components. //! +//! # Disabling +//! +//! To disable automatic inclusion of the standard prelude you can use the +//! [`no_implicit_prelude` attribute][module-only-attributes]. This should be +//! rarely used, but can be useful if you have a need for very careful control +//! of what parts of `std` are included. +//! +//! [module-only-attributes]: ../../reference.html#module-only-attributes +//! //! # Prelude contents //! //! The current version of the prelude (version 1) lives in