diff options
| author | David Wood <david@davidtw.co> | 2018-03-23 17:48:03 +0000 |
|---|---|---|
| committer | David Wood <david@davidtw.co> | 2018-03-23 17:50:33 +0000 |
| commit | 4161ae747740e9d61426d26da3e9f3f74fbabaca (patch) | |
| tree | c2906ed2f6794169f291e72aa3d7c4a703c6522f | |
| parent | 3a0162b7cb7f23236a23ef7747cc0ea5374bbb33 (diff) | |
Improved comments for UserAssertTy statement.
| -rw-r--r-- | src/librustc/mir/mod.rs | 8 | ||||
| -rw-r--r-- | src/librustc/ty/context.rs | 3 | ||||
| -rw-r--r-- | src/librustc_mir/build/block.rs | 6 |
3 files changed, 13 insertions, 4 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 9229724f094..9ed4e6a8e00 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1260,6 +1260,14 @@ pub enum StatementKind<'tcx> { /// /// Here we would insert a `UserAssertTy<(T, U)>(y)` instruction to check that the type of `y` /// is the right thing. + /// + /// `CanonicalTy` is used to capture "inference variables" from the user's types. For example: + /// + /// let x: Vec<_> = ...; + /// let y: &u32 = ...; + /// + /// would result in `Vec<?0>` and `&'?0 u32` respectively (where `?0` is a canonicalized + /// variable). UserAssertTy(CanonicalTy<'tcx>, Local), /// No-op. Useful for deleting instructions without affecting statement indices. diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 573d2771322..55e695bb18c 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -345,7 +345,8 @@ pub struct TypeckTables<'tcx> { /// method calls, including those of overloaded operators. type_dependent_defs: ItemLocalMap<Def>, - /// Stores the canonicalized types provided by the user. + /// Stores the canonicalized types provided by the user. See also `UserAssertTy` statement in + /// MIR. user_provided_tys: ItemLocalMap<CanonicalTy<'tcx>>, /// Stores the types for various nodes in the AST. Note that this table diff --git a/src/librustc_mir/build/block.rs b/src/librustc_mir/build/block.rs index b2ab23024a8..94702927d26 100644 --- a/src/librustc_mir/build/block.rs +++ b/src/librustc_mir/build/block.rs @@ -125,9 +125,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { }) })); } else { - // FIXME: We currently only insert `UserAssertTy` statements for patterns - // that are bindings, this is as we do not want to deconstruct the type - // being assertion to match the pattern. + // FIXME(#47184): We currently only insert `UserAssertTy` statements for + // patterns that are bindings, this is as we do not want to deconstruct + // the type being assertion to match the pattern. if let PatternKind::Binding { var, .. } = *pattern.kind { if let Some(ty) = ty { this.user_assert_ty(block, ty, var, span); |
