rapx/compat.rs
1/// Centralized compatibility shims for compiler API differences across nightly
2/// versions.
3///
4/// When a type or function moves between modules or changes interface across
5/// rustc versions, add a re-export here (gated by `#[cfg]`). All other
6/// modules import from this crate instead of writing their own `#[cfg]` blocks.
7///
8/// # How to add a new compat item
9///
10/// 1. Add a cfg flag in `build.rs` (e.g. `rustc_foo_moved`).
11/// 2. Register it with `emit_check_cfg` in `build.rs`.
12/// 3. Add the re-export below.
13/// 4. Update call-sites to `use crate::compat::Foo;`.
14pub use rustc_hash::FxHashMap;
15pub use rustc_hash::FxHashSet;
16
17/// `Spanned` was moved from `rustc_span::source_map` to `rustc_span` root
18/// in rustc 1.97.
19#[cfg(rustc_spanned_at_root)]
20pub use rustc_span::Spanned;
21#[cfg(not(rustc_spanned_at_root))]
22pub use rustc_span::source_map::Spanned;