diff options
| author | Boxy <supbscripter@gmail.com> | 2024-04-01 17:29:34 +0100 |
|---|---|---|
| committer | Boxy <supbscripter@gmail.com> | 2024-04-01 17:29:34 +0100 |
| commit | a91f6221b95dd21394fae4fd1ca45e56475b355f (patch) | |
| tree | f5cd74322e2b45853ad9ab3089e152798ecfb8bb | |
| parent | 805813650248c1a2f6f271460d728d1bb852d2a7 (diff) | |
| download | rust-a91f6221b95dd21394fae4fd1ca45e56475b355f.tar.gz rust-a91f6221b95dd21394fae4fd1ca45e56475b355f.zip | |
Update `ParamEnv` docs
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 99da981b9d6..d7c6bffe284 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1034,9 +1034,11 @@ impl PlaceholderLike for PlaceholderConst { } } -/// When type checking, we use the `ParamEnv` to track -/// details about the set of where-clauses that are in scope at this -/// particular point. +/// When interacting with the type system we must provide information about the +/// environment. `ParamEnv` is the type that represents this information. See the +/// [dev guide chapter](param_env_guide) for more information. +/// +/// [param_env_guide]: https://rustc-dev-guide.rust-lang.org/param_env/param_env_summary.html #[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct ParamEnv<'tcx> { /// This packs both caller bounds and the reveal enum into one pointer. @@ -1103,8 +1105,11 @@ impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for ParamEnv<'tcx> { impl<'tcx> ParamEnv<'tcx> { /// Construct a trait environment suitable for contexts where /// there are no where-clauses in scope. Hidden types (like `impl - /// Trait`) are left hidden, so this is suitable for ordinary - /// type-checking. + /// Trait`) are left hidden. In majority of cases it is incorrect + /// to use an empty environment. See the [dev guide section][param_env_guide] + /// for information on what a `ParamEnv` is and how to acquire one. + /// + /// [param_env_guide]: https://rustc-dev-guide.rust-lang.org/param_env/param_env_summary.html #[inline] pub fn empty() -> Self { Self::new(List::empty(), Reveal::UserFacing) |
