Skip to content

Commit 0cffa32

Browse files
committed
Add detailed note about Substs to ty_enum
1 parent c630d96 commit 0cffa32

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librustc/middle/ty.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,13 @@ pub enum sty {
790790
ty_int(ast::IntTy),
791791
ty_uint(ast::UintTy),
792792
ty_float(ast::FloatTy),
793+
/// Substs here, possibly against intuition, *may* contain `ty_param`s.
794+
/// That is, even after substitution it is possible that there are type
795+
/// variables. This happens when the `ty_enum` corresponds to an enum
796+
/// definition and not a concerete use of it. To get the correct `ty_enum`
797+
/// from the tcx, use the `NodeId` from the `ast::Ty` and look it up in
798+
/// the `ast_ty_to_ty_cache`. This is probably true for `ty_struct` as
799+
/// well.`
793800
ty_enum(DefId, Substs),
794801
ty_box(t),
795802
ty_uniq(t),

0 commit comments

Comments
 (0)