Dummy tweaks (attempt 2) by nnethercote · Pull Request #121829 · rust-lang/rust (original) (raw)
DummyAstNode
and DummyResult
are quite different if you look closely.
DummyAstNode
is a trait, butDummyResult
is a type.- For expressions,
DummyAstNode
usesExprKind::Dummy
, butDummyResult
usesExprKind::Err
or an emptyExprKind::Tup
- For types,
DummyAstNode
usesTyKind::Dummy
, butDummyResult
uses an emptyTyKind::Tup
. DummyAstNode
can handle a singleItem
,Stmt
,Block
, orCrate
, butDummyResult
cannot.DummyResult
can produce multiple items, statements, field, etc., butDummyAstNode
cannot.
So the purpose is much the same, but the details vary greatly. This is why I removed the interdependency. You could probably frankenstein them into a single thing (trait? type?) that can be used in both cases, by adding extra parameters, but I think that would end up being less clear.