Skip to content

Commit

Permalink
Update docs to reflect review feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnkfelix committed Jul 12, 2019
1 parent e4b8af5 commit 3c8279a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/librustc/ty/util.rs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ impl<'tcx> TyCtxt<'tcx> {
/// Returns the deeply last field of nested structures, or the same type if /// 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, /// not a structure at all. Corresponds to the only possible unsized field,
/// and its type can be used to determine unsizing strategy. /// 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, pub fn struct_tail_erasing_lifetimes(self,
ty: Ty<'tcx>, ty: Ty<'tcx>,
param_env: ty::ParamEnv<'tcx>) param_env: ty::ParamEnv<'tcx>)
Expand All @@ -287,8 +291,8 @@ impl<'tcx> TyCtxt<'tcx> {
/// handle `<T as Trait>::Assoc` and `impl Trait`); pass the identity /// handle `<T as Trait>::Assoc` and `impl Trait`); pass the identity
/// function to indicate no normalization should take place. /// function to indicate no normalization should take place.
/// ///
/// See also `struct_tail_erasing_lifetimes`, which is what callers running /// See also `struct_tail_erasing_lifetimes`, which is suitable for use
/// after type checking should use. /// during codegen.
pub fn struct_tail_with_normalize(self, pub fn struct_tail_with_normalize(self,
mut ty: Ty<'tcx>, mut ty: Ty<'tcx>,
normalize: impl Fn(Ty<'tcx>) -> Ty<'tcx>) normalize: impl Fn(Ty<'tcx>) -> Ty<'tcx>)
Expand Down Expand Up @@ -337,7 +341,8 @@ impl<'tcx> TyCtxt<'tcx> {
/// For `(Foo<Foo<T>>, Foo<dyn Trait>)`, the result will be `(Foo<T>, Trait)`, /// For `(Foo<Foo<T>>, Foo<dyn Trait>)`, the result will be `(Foo<T>, Trait)`,
/// whereas struct_tail produces `T`, and `Trait`, respectively. /// 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. /// normalization attempt may cause compiler bugs.
pub fn struct_lockstep_tails_erasing_lifetimes(self, pub fn struct_lockstep_tails_erasing_lifetimes(self,
source: Ty<'tcx>, source: Ty<'tcx>,
Expand All @@ -356,8 +361,8 @@ impl<'tcx> TyCtxt<'tcx> {
/// For `(Foo<Foo<T>>, Foo<dyn Trait>)`, the result will be `(Foo<T>, Trait)`, /// For `(Foo<Foo<T>>, Foo<dyn Trait>)`, the result will be `(Foo<T>, Trait)`,
/// whereas struct_tail produces `T`, and `Trait`, respectively. /// whereas struct_tail produces `T`, and `Trait`, respectively.
/// ///
/// See also struct_lockstep_tails_erasing_lifetimes, which /// See also `struct_lockstep_tails_erasing_lifetimes`, which is suitable for use
/// is what callers running after type checking should use. /// during codegen.
pub fn struct_lockstep_tails_with_normalize(self, pub fn struct_lockstep_tails_with_normalize(self,
source: Ty<'tcx>, source: Ty<'tcx>,
target: Ty<'tcx>, target: Ty<'tcx>,
Expand Down

0 comments on commit 3c8279a

Please sign in to comment.