about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2019-07-12 11:34:23 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2019-07-12 11:45:02 +0200
commit3c8279a2246c8bbb63f7d6aeac144b3a8adbe755 (patch)
tree23bfa38d40884f0d12f10493cd4c506d458aeaee /src
parente4b8af5d607b465f11615abefb5bbae20486887e (diff)
Update docs to reflect review feedback.
Diffstat (limited to 'src')
-rw-r--r--src/librustc/ty/util.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs
index 871aeb78af5..635845a65c2 100644
--- a/src/librustc/ty/util.rs
+++ b/src/librustc/ty/util.rs
@@ -270,6 +270,10 @@ impl<'tcx> TyCtxt<'tcx> {
     /// Returns the deeply last field of nested structures, or the same type if
     /// not a structure at all. Corresponds to the only possible unsized field,
     /// and its type can be used to determine unsizing strategy.
+    ///
+    /// Should only be called if `ty` has no inference variables and does not
+    /// need its lifetimes preserved (e.g. as part of codegen); otherwise
+    /// normalization attempt may cause compiler bugs.
     pub fn struct_tail_erasing_lifetimes(self,
                                          ty: Ty<'tcx>,
                                          param_env: ty::ParamEnv<'tcx>)
@@ -287,8 +291,8 @@ impl<'tcx> TyCtxt<'tcx> {
     /// handle `<T as Trait>::Assoc` and `impl Trait`); pass the identity
     /// function to indicate no normalization should take place.
     ///
-    /// See also `struct_tail_erasing_lifetimes`, which is what callers running
-    /// after type checking should use.
+    /// See also `struct_tail_erasing_lifetimes`, which is suitable for use
+    /// during codegen.
     pub fn struct_tail_with_normalize(self,
                                       mut ty: Ty<'tcx>,
                                       normalize: impl Fn(Ty<'tcx>) -> Ty<'tcx>)
@@ -337,7 +341,8 @@ impl<'tcx> TyCtxt<'tcx> {
     /// For `(Foo<Foo<T>>, Foo<dyn Trait>)`, the result will be `(Foo<T>, Trait)`,
     /// whereas struct_tail produces `T`, and `Trait`, respectively.
     ///
-    /// Must only be called after type-checking is complete; otherwise
+    /// Should only be called if the types have no inference variables and do
+    /// not need their lifetimes preserved (e.g. as part of codegen); otherwise
     /// normalization attempt may cause compiler bugs.
     pub fn struct_lockstep_tails_erasing_lifetimes(self,
                                                    source: Ty<'tcx>,
@@ -356,8 +361,8 @@ impl<'tcx> TyCtxt<'tcx> {
     /// For `(Foo<Foo<T>>, Foo<dyn Trait>)`, the result will be `(Foo<T>, Trait)`,
     /// whereas struct_tail produces `T`, and `Trait`, respectively.
     ///
-    /// See also struct_lockstep_tails_erasing_lifetimes, which
-    /// is what callers running after type checking should use.
+    /// See also `struct_lockstep_tails_erasing_lifetimes`, which is suitable for use
+    /// during codegen.
     pub fn struct_lockstep_tails_with_normalize(self,
                                                 source: Ty<'tcx>,
                                                 target: Ty<'tcx>,