diff options
| author | bors <bors@rust-lang.org> | 2021-06-19 12:41:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-06-19 12:41:10 +0000 |
| commit | 29cd70d40722930e66a8b726fe58a7bd1d64a22b (patch) | |
| tree | 8c743529f92ba82c4c6f51689762a9d80e2b0944 /compiler/rustc_middle | |
| parent | 39260f6d4994db191f2fca9f12b4930eb3a3c122 (diff) | |
| parent | 831759a4438736980574478b29a3e9ab6e837f3f (diff) | |
| download | rust-29cd70d40722930e66a8b726fe58a7bd1d64a22b.tar.gz rust-29cd70d40722930e66a8b726fe58a7bd1d64a22b.zip | |
Auto merge of #86437 - nikomatsakis:tait-docs, r=oli-obk
add various coments to explain how the TAIT code works r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_middle')
| -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 |
