]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726
authorMatthias Krüger <matthias.krueger@famsik.de>
Mon, 31 Jan 2022 05:58:26 +0000 (06:58 +0100)
committerGitHub <noreply@github.com>
Mon, 31 Jan 2022 05:58:26 +0000 (06:58 +0100)
Improve terminology around "after typeck"

Closes #70258.

13 files changed:
compiler/rustc_infer/src/infer/mod.rs
compiler/rustc_lint/src/context.rs
compiler/rustc_middle/src/mir/mod.rs
compiler/rustc_middle/src/ty/context.rs
compiler/rustc_middle/src/ty/normalize_erasing_regions.rs
compiler/rustc_middle/src/ty/sty.rs
compiler/rustc_save_analysis/src/lib.rs
compiler/rustc_target/src/asm/mod.rs
compiler/rustc_trait_selection/src/traits/codegen.rs
compiler/rustc_trait_selection/src/traits/mod.rs
compiler/rustc_trait_selection/src/traits/project.rs
compiler/rustc_trait_selection/src/traits/query/normalize.rs
compiler/rustc_ty_utils/src/ty.rs

index 266eec08cebf57ec7fed15994cbf0998db03b961..d1b24b332bdcc65b2cef56a189b3f05cdeff0f53 100644 (file)
@@ -195,7 +195,7 @@ pub struct InferCtxtInner<'tcx> {
     // Opaque types found in explicit return types and their
     // associated fresh inference variable. Writeback resolves these
     // variables to get the concrete type, which can be used to
-    // 'de-opaque' OpaqueTypeDecl, after typeck is done with all functions.
+    // 'de-opaque' OpaqueTypeDecl outside of type inference.
     pub opaque_types: OpaqueTypeMap<'tcx>,
 
     /// A map from inference variables created from opaque
index 21c25a2fd989dd02600a1277ade8c3b27450a3a2..cb08e95258678ce3aa29cb9d9460b2079e76bd4b 100644 (file)
@@ -524,7 +524,7 @@ fn check_tool_name_for_backwards_compat(
     }
 }
 
-/// Context for lint checking after type checking.
+/// Context for lint checking outside of type inference.
 pub struct LateContext<'tcx> {
     /// Type context we're checking in.
     pub tcx: TyCtxt<'tcx>,
index c7b1e25b9938269c95dee39eb163c0e0791248fd..b1ab0f5b533dd95eb47b5ab17c186cbc078f9c0c 100644 (file)
@@ -894,7 +894,7 @@ pub struct LocalDecl<'tcx> {
     /// across a suspension point against the type components of the generator
     /// which type checking knows are live across a suspension point. We need to
     /// flag drop flags to avoid triggering this check as they are introduced
-    /// after typeck.
+    /// outside of type inference.
     ///
     /// This should be sound because the drop flags are fully algebraic, and
     /// therefore don't affect the auto-trait or outlives properties of the
index 6c8573805cb9485f045cb147b3ed8fc39ceead05..d063494f2bcb7926d39728227b30512731fc93ae 100644 (file)
@@ -220,7 +220,7 @@ pub struct CommonLifetimes<'tcx> {
     /// `ReStatic`
     pub re_static: Region<'tcx>,
 
-    /// Erased region, used after type-checking
+    /// Erased region, used outside of type inference.
     pub re_erased: Region<'tcx>,
 }
 
@@ -360,7 +360,7 @@ pub struct TypeckResults<'tcx> {
     field_indices: ItemLocalMap<usize>,
 
     /// Stores the types for various nodes in the AST. Note that this table
-    /// is not guaranteed to be populated until after typeck. See
+    /// is not guaranteed to be populated outside inference. See
     /// typeck::check::fn_ctxt for details.
     node_types: ItemLocalMap<Ty<'tcx>>,
 
index 84ab42a760b933a785b9482949f539c9c7aa6c30..b3b2bb4459f7df376a5aeb6c07b2f8332956e879 100644 (file)
@@ -34,8 +34,8 @@ impl<'tcx> TyCtxt<'tcx> {
     /// Erase the regions in `value` and then fully normalize all the
     /// types found within. The result will also have regions erased.
     ///
-    /// This is appropriate to use only after type-check: it assumes
-    /// that normalization will succeed, for example.
+    /// This should only be used outside of type inference. For example,
+    /// it assumes that normalization will succeed.
     pub fn normalize_erasing_regions<T>(self, param_env: ty::ParamEnv<'tcx>, value: T) -> T
     where
         T: TypeFoldable<'tcx>,
index f70fde2a040a15f1c8240ff9291c12682498f111..7d4af6cfa405257088c8e41bb3c1ed5cc89151b7 100644 (file)
@@ -1464,11 +1464,11 @@ pub enum RegionKind {
     /// Static data that has an "infinite" lifetime. Top in the region lattice.
     ReStatic,
 
-    /// A region variable. Should not exist after typeck.
+    /// A region variable. Should not exist outside of type inference.
     ReVar(RegionVid),
 
     /// A placeholder region -- basically, the higher-ranked version of `ReFree`.
-    /// Should not exist after typeck.
+    /// Should not exist outside of type inference.
     RePlaceholder(ty::PlaceholderRegion),
 
     /// Empty lifetime is for data that is never accessed.  We tag the
index b95fe1b0549bd68232e4dc96374d42c49e66dcf7..570fa873a23da287200195edcd7c58e173109372 100644 (file)
@@ -984,7 +984,7 @@ pub fn process_crate<'l, 'tcx, H: SaveHandler>(
         tcx.dep_graph.with_ignore(|| {
             info!("Dumping crate {}", cratename);
 
-            // Privacy checking requires and is done after type checking; use a
+            // Privacy checking must be done outside of type inference; use a
             // fallback in case the access levels couldn't have been correctly computed.
             let access_levels = match tcx.sess.compile_status() {
                 Ok(..) => tcx.privacy_access_levels(()),
index 8046267a59da6ca8d5c3471de366b8f4db5eecb1..a84410d0f3c46510a13349bf0e3461a84f3d130f 100644 (file)
@@ -444,7 +444,7 @@ pub fn name(self) -> Symbol {
     }
 
     /// Returns a suggested register class to use for this type. This is called
-    /// after type checking via `supported_types` fails to give a better error
+    /// when `supported_types` fails to give a better error
     /// message to the user.
     pub fn suggest_class(self, arch: InlineAsmArch, ty: InlineAsmType) -> Option<Self> {
         match self {
index 848aba7c912896dead92698357967eca538b9080..759bc696981676162f708c376ee9f0406f649c1f 100644 (file)
@@ -18,7 +18,6 @@
 /// that type check should guarantee to us that all nested
 /// obligations *could be* resolved if we wanted to.
 ///
-/// Assumes that this is run after the entire crate has been successfully type-checked.
 /// This also expects that `trait_ref` is fully normalized.
 pub fn codegen_fulfill_obligation<'tcx>(
     tcx: TyCtxt<'tcx>,
@@ -101,7 +100,7 @@ pub fn codegen_fulfill_obligation<'tcx>(
 /// Finishes processes any obligations that remain in the
 /// fulfillment context, and then returns the result with all type
 /// variables removed and regions erased. Because this is intended
-/// for use after type-check has completed, if any errors occur,
+/// for use outside of type inference, if any errors occur,
 /// it will panic. It is used during normalization and other cases
 /// where processing the obligations in `fulfill_cx` may cause
 /// type inference variables that appear in `result` to be
@@ -124,7 +123,10 @@ fn drain_fulfillment_cx_or_panic<'tcx, T>(
     if !errors.is_empty() {
         infcx.tcx.sess.delay_span_bug(
             rustc_span::DUMMY_SP,
-            &format!("Encountered errors `{:?}` resolving bounds after type-checking", errors),
+            &format!(
+                "Encountered errors `{:?}` resolving bounds outside of type inference",
+                errors
+            ),
         );
     }
 
index 23f534858b82a865436661d444580391cdf59fd0..2927e64f705fea57da73753c66ee33a8b4685261 100644 (file)
@@ -291,7 +291,7 @@ pub fn normalize_param_env_or_error<'tcx>(
     //
     // In any case, in practice, typeck constructs all the
     // parameter environments once for every fn as it goes,
-    // and errors will get reported then; so after typeck we
+    // and errors will get reported then; so outside of type inference we
     // can be sure that no errors should occur.
 
     debug!(
index e8b46e88a42285656c2b65850c1ba5ef05fdd3d2..087fc6034d98f9a567ec66f1dd09fd6438424ecf 100644 (file)
@@ -391,7 +391,7 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
             // severe performance implications for large opaque types with
             // late-bound regions. See `issue-88862` benchmark.
             ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
-                // Only normalize `impl Trait` after type-checking, usually in codegen.
+                // Only normalize `impl Trait` outside of type inference, usually in codegen.
                 match self.param_env.reveal() {
                     Reveal::UserFacing => ty.super_fold_with(self),
 
index 81ee22c1de4d93dae3f52dcd22f6c00926f1bc9c..3c9e1bbcef26deffa1783a25ed9f7078065e5901 100644 (file)
@@ -200,7 +200,7 @@ fn try_fold_ty(&mut self, ty: Ty<'tcx>) -> Result<Ty<'tcx>, Self::Error> {
             // severe performance implications for large opaque types with
             // late-bound regions. See `issue-88862` benchmark.
             ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
-                // Only normalize `impl Trait` after type-checking, usually in codegen.
+                // Only normalize `impl Trait` outside of type inference, usually in codegen.
                 match self.param_env.reveal() {
                     Reveal::UserFacing => ty.try_super_fold_with(self),
 
index fef83190468196c32ee0257fb33c36aadd889724..b882a940d40c3609eb82ea6afb5f93296b0ca0ad 100644 (file)
@@ -149,7 +149,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
     // kind of an "idempotent" action, but I'm not sure where would be
     // a better place. In practice, we construct environments for
     // every fn once during type checking, and we'll abort if there
-    // are any errors at that point, so after type checking you can be
+    // are any errors at that point, so outside of type inference you can be
     // sure that this will succeed without errors anyway.
 
     if tcx.sess.opts.debugging_opts.chalk {