mirror of
https://github.com/openharmony/third_party_rust_syn.git
synced 2026-07-21 10:15:24 -04:00
009133d0d2
This follows through on the comments on the __TestExhaustive variants
promising that their purpose will be substituted with a deny(reachable)
rustc lint once one is available.
That lint is now landing as non_exhaustive_omitted_patterns in Rust 1.57.
The correct way to use it for checking exhaustivity of a match is:
match expr {
Expr::Array(e) => {...}
Expr::Assign(e) => {...}
...
Expr::Yield(e) => {...}
#[cfg_attr(test, deny(non_exhaustive_omitted_patterns))]
_ => { /* some sane fallback */ }
}
syn_codegen
This is an internal (not published on crates.io) crate which is used to generate
the files in the gen/ directory of syn. It is used to ensure that the
implementations for Fold, Visit, and VisitMut remain in sync with the
actual AST.
To run this program, run cargo run in this directory, and the gen/ folder
will be re-generated.
This program is slow, and is therefore not run when building syn as part of
the build script to save on compile time.