1pub use rustc_hash::FxHashMap;
15pub use rustc_hash::FxHashSet;
16
17#[cfg(rapx_ge_99)]
20pub use rustc_span::Spanned;
21#[cfg(not(rapx_ge_99))]
22pub use rustc_span::source_map::Spanned;
23
24use rustc_hir::def_id::DefId;
27use rustc_middle::ty::TyCtxt;
28
29#[cfg(not(rapx_ge_100))]
31pub type GenericPredicatesC<'tcx> = rustc_middle::ty::GenericPredicates<'tcx>;
32#[cfg(rapx_ge_100)]
33pub type GenericPredicatesC<'tcx> = rustc_middle::ty::GenericClauses<'tcx>;
34
35#[cfg(not(rapx_ge_100))]
37#[inline]
38pub fn predicates_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> GenericPredicatesC<'tcx> {
39 tcx.predicates_of(def_id)
40}
41#[cfg(rapx_ge_100)]
42#[inline]
43pub fn predicates_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> GenericPredicatesC<'tcx> {
44 tcx.clauses_of(def_id)
45}
46
47#[cfg(not(rapx_ge_99))]
50pub fn args_get<'tcx>(
51 args: &rustc_middle::ty::GenericArgsRef<'tcx>,
52 index: usize,
53) -> Option<&'tcx rustc_middle::ty::GenericArg<'tcx>> {
54 args.get(index)
55}
56#[cfg(rapx_ge_99)]
57pub fn args_get<'tcx>(
58 args: &rustc_middle::ty::Binder<'tcx, &'tcx rustc_middle::ty::GenericArgs<'tcx>>,
59 index: usize,
60) -> Option<rustc_middle::ty::GenericArg<'tcx>> {
61 args.skip_binder().get(index).copied()
62}
63
64#[cfg(not(rapx_has_skip_norm_wip))]
70pub trait SkipNormWip: Sized {
71 fn skip_norm_wip(self) -> Self {
72 self
73 }
74}
75#[cfg(not(rapx_has_skip_norm_wip))]
76impl<T: Sized> SkipNormWip for T {}
77
78#[cfg(rapx_has_attr_ir)]
81use rustc_attr_ir::Attribute;
82#[cfg(not(rapx_has_attr_ir))]
83use rustc_hir::Attribute;
84
85#[allow(deprecated)]
86#[inline]
87pub fn get_all_attrs<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx [Attribute] {
88 tcx.get_all_attrs(def_id)
89}
90
91#[cfg(not(rapx_ge_99))]
92pub fn attribute_to_string<'tcx>(tcx: TyCtxt<'tcx>, attr: &Attribute) -> String {
93 rustc_hir_pretty::attribute_to_string(&tcx, attr)
94}
95#[cfg(rapx_ge_99)]
96pub fn attribute_to_string(_tcx: TyCtxt<'_>, attr: &Attribute) -> String {
97 struct Ann;
98 impl rustc_hir_pretty::PpAnn for Ann {}
99 rustc_hir_pretty::attribute_to_string(&Ann, attr)
100}