diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2021-06-18 11:44:56 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2021-06-18 11:44:56 -0400 |
| commit | f6adaedd9b0696c559df352652bdd8da8ea47d91 (patch) | |
| tree | 0c506d3ef287d224ea75f30f0fbb7a805066375e /compiler/rustc_middle/src | |
| parent | 1989b9a0b5f176d84cb736dbe5ba95787d5a9937 (diff) | |
| download | rust-f6adaedd9b0696c559df352652bdd8da8ea47d91.tar.gz rust-f6adaedd9b0696c559df352652bdd8da8ea47d91.zip | |
add various coments to explain how the code works
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 73991436b7b..a74070100f4 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -392,6 +392,34 @@ pub struct TypeckResults<'tcx> { /// (including late-bound regions) are replaced with free /// equivalents. This table is not used in codegen (since regions /// are erased there) and hence is not serialized to metadata. + /// + /// This table also contains the "revealed" values for any `impl Trait` + /// that appear in the signature and whose values are being inferred + /// by this function. + /// + /// # Example + /// + /// ```rust + /// fn foo(x: &u32) -> impl Debug { *x } + /// ``` + /// + /// The function signature here would be: + /// + /// ``` + /// for<'a> fn(&'a u32) -> Foo + /// ``` + /// + /// where `Foo` is an opaque type created for this function. + /// + /// + /// The *liberated* form of this would be + /// + /// ``` + /// fn(&'a u32) -> u32 + /// ``` + /// + /// Note that `'a` is not bound (it would be an `ReFree`) and + /// that the `Foo` opaque type is replaced by its hidden type. liberated_fn_sigs: ItemLocalMap<ty::FnSig<'tcx>>, /// For each FRU expression, record the normalized types of the fields |
