• N
    Clean up THIR patterns. · 053874ee
    Nicholas Nethercote 提交于
    `thir::Pat::kind` is a `Box<PatKind>`, which doesn't follow the usual
    pattern in AST/HIR/THIR which is that the "kind" enum for a node is
    stored inline within the parent struct.
    
    This commit makes the `PatKind` directly inline within the `Pat`. This
    requires using `Box<Pat>` in all the types that hold a `Pat.
    
    Ideally, `Pat` would be stored in `Thir` like `Expr` and `Stmt` and
    referred to with a `PatId` rather than `Box<Pat>`. But this is hard to
    do because lots of `Pat`s get created after the destruction of the `Cx`
    that does normal THIR building. But this does get us a step closer to
    `PatId`, because all the `Box<Pat>` occurrences would be replaced with
    `PatId` if `PatId` ever happened.
    
    At 128 bytes, `Pat` is large. Subsequent commits will shrink it.
    053874ee
visit.rs 9.3 KB