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> =
32 rustc_middle::ty::GenericPredicates<'tcx>;
33#[cfg(rapx_ge_100)]
34pub type GenericPredicatesC<'tcx> =
35 rustc_middle::ty::GenericClauses<'tcx>;
36
37#[cfg(not(rapx_ge_100))]
39#[inline]
40pub fn predicates_of<'tcx>(
41 tcx: TyCtxt<'tcx>,
42 def_id: DefId,
43) -> GenericPredicatesC<'tcx> {
44 tcx.predicates_of(def_id)
45}
46#[cfg(rapx_ge_100)]
47#[inline]
48pub fn predicates_of<'tcx>(
49 tcx: TyCtxt<'tcx>,
50 def_id: DefId,
51) -> GenericPredicatesC<'tcx> {
52 tcx.clauses_of(def_id)
53}
54
55#[cfg(not(rapx_ge_99))]
58pub fn args_get<'tcx>(
59 args: &rustc_middle::ty::GenericArgsRef<'tcx>,
60 index: usize,
61) -> Option<&'tcx rustc_middle::ty::GenericArg<'tcx>> {
62 args.get(index)
63}
64#[cfg(rapx_ge_99)]
65pub fn args_get<'tcx>(
66 args: &rustc_middle::ty::Binder<
67 'tcx,
68 &'tcx rustc_middle::ty::GenericArgs<'tcx>,
69 >,
70 index: usize,
71) -> Option<rustc_middle::ty::GenericArg<'tcx>> {
72 args.skip_binder().get(index).copied()
73}
74
75#[cfg(not(rapx_has_skip_norm_wip))]
81pub trait SkipNormWip: Sized {
82 fn skip_norm_wip(self) -> Self {
83 self
84 }
85}
86#[cfg(not(rapx_has_skip_norm_wip))]
87impl<T: Sized> SkipNormWip for T {}
88
89use rustc_hir::Attribute;
92
93#[allow(deprecated)]
94#[inline]
95pub fn get_all_attrs<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx [Attribute] {
96 tcx.get_all_attrs(def_id)
97}
98
99#[cfg(not(rapx_ge_99))]
100pub fn attribute_to_string<'tcx>(tcx: TyCtxt<'tcx>, attr: &rustc_hir::Attribute) -> String {
101 rustc_hir_pretty::attribute_to_string(&tcx, attr)
102}
103#[cfg(rapx_ge_99)]
104pub fn attribute_to_string(_tcx: TyCtxt<'_>, attr: &rustc_hir::Attribute) -> String {
105 struct Ann;
106 impl rustc_hir_pretty::PpAnn for Ann {}
107 rustc_hir_pretty::attribute_to_string(&Ann, attr)
108}