@@ -94,12 +94,26 @@ pub fn provide(providers: &mut Providers) {
94
94
///////////////////////////////////////////////////////////////////////////
95
95
96
96
/// Context specific to some particular item. This is what implements
97
- /// `AstConv`.
97
+ /// [ `AstConv`] .
98
98
///
99
- /// `ItemCtxt` is primarily used to type-check item signatures, in contrast to [`FnCtxt`],
100
- /// which is used to type-check function bodies.
99
+ /// # `ItemCtxt` vs `FnCtxt`
101
100
///
102
- /// It has information about the predicates that are defined
101
+ /// `ItemCtxt` is primarily used to type-check item signatures and lower them
102
+ /// from HIR to their [`ty::Ty`] representation, which is exposed using [`AstConv`].
103
+ /// It's also used for the bodies of items like structs where the body (the fields)
104
+ /// are just signatures.
105
+ ///
106
+ /// This is in contrast to [`FnCtxt`], which is used to type-check bodies of
107
+ /// functions, closures, and `const`s -- anywhere that expressions and statements show up.
108
+ ///
109
+ /// An important thing to note is that `ItemCtxt` does no inference -- it has no [`InferCtxt`] --
110
+ /// while `FnCtxt` does do inference.
111
+ ///
112
+ /// [`FnCtxt`]: crate::check::fn_ctxt::FnCtxt
113
+ ///
114
+ /// # Trait predicates
115
+ ///
116
+ /// `ItemCtxt` has information about the predicates that are defined
103
117
/// on the trait. Unfortunately, this predicate information is
104
118
/// available in various different forms at various points in the
105
119
/// process. So we can't just store a pointer to e.g., the AST or the
0 commit comments