]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_typeck/src/check/fn_ctxt/mod.rs
New upstream version 1.65.0+dfsg1
[rustc.git] / compiler / rustc_typeck / src / check / fn_ctxt / mod.rs
index 05bcc710e16258977dad795ed29b2ba1b55ca9e7..0e22971d3aabd2982ca5231c3ebbed8caff617b2 100644 (file)
@@ -26,6 +26,17 @@ use rustc_trait_selection::traits::{ObligationCause, ObligationCauseCode};
 use std::cell::{Cell, RefCell};
 use std::ops::Deref;
 
+/// The `FnCtxt` stores type-checking context needed to type-check bodies of
+/// functions, closures, and `const`s, including performing type inference
+/// with [`InferCtxt`].
+///
+/// This is in contrast to [`ItemCtxt`], which is used to type-check item *signatures*
+/// and thus does not perform type inference.
+///
+/// See [`ItemCtxt`]'s docs for more.
+///
+/// [`ItemCtxt`]: crate::collect::ItemCtxt
+/// [`InferCtxt`]: infer::InferCtxt
 pub struct FnCtxt<'a, 'tcx> {
     pub(super) body_id: hir::HirId,
 
@@ -57,8 +68,6 @@ pub struct FnCtxt<'a, 'tcx> {
     /// any).
     pub(super) ret_coercion: Option<RefCell<DynamicCoerceMany<'tcx>>>,
 
-    pub(super) ret_type_span: Option<Span>,
-
     /// Used exclusively to reduce cost of advanced evaluation used for
     /// more helpful diagnostics.
     pub(super) in_tail_expr: bool,
@@ -131,7 +140,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             param_env,
             err_count_on_creation: inh.tcx.sess.err_count(),
             ret_coercion: None,
-            ret_type_span: None,
             in_tail_expr: false,
             ret_coercion_span: Cell::new(None),
             resume_yield_tys: None,