Skip to content

Commit a91f622

Browse files
committedApr 1, 2024
Update ParamEnv docs
1 parent 8058136 commit a91f622

File tree

1 file changed

+10
-5
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+10
-5
lines changed
 

Diff for: ‎compiler/rustc_middle/src/ty/mod.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,11 @@ impl PlaceholderLike for PlaceholderConst {
10341034
}
10351035
}
10361036

1037-
/// When type checking, we use the `ParamEnv` to track
1038-
/// details about the set of where-clauses that are in scope at this
1039-
/// particular point.
1037+
/// When interacting with the type system we must provide information about the
1038+
/// environment. `ParamEnv` is the type that represents this information. See the
1039+
/// [dev guide chapter](param_env_guide) for more information.
1040+
///
1041+
/// [param_env_guide]: https://rustc-dev-guide.rust-lang.org/param_env/param_env_summary.html
10401042
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
10411043
pub struct ParamEnv<'tcx> {
10421044
/// This packs both caller bounds and the reveal enum into one pointer.
@@ -1103,8 +1105,11 @@ impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for ParamEnv<'tcx> {
11031105
impl<'tcx> ParamEnv<'tcx> {
11041106
/// Construct a trait environment suitable for contexts where
11051107
/// there are no where-clauses in scope. Hidden types (like `impl
1106-
/// Trait`) are left hidden, so this is suitable for ordinary
1107-
/// type-checking.
1108+
/// Trait`) are left hidden. In majority of cases it is incorrect
1109+
/// to use an empty environment. See the [dev guide section][param_env_guide]
1110+
/// for information on what a `ParamEnv` is and how to acquire one.
1111+
///
1112+
/// [param_env_guide]: https://rustc-dev-guide.rust-lang.org/param_env/param_env_summary.html
11081113
#[inline]
11091114
pub fn empty() -> Self {
11101115
Self::new(List::empty(), Reveal::UserFacing)

0 commit comments

Comments
 (0)