File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5818,6 +5818,18 @@ impl<'db> Type<'db> {
58185818 matches ! ( self . ty. kind( ) , TyKind :: RawPtr ( ..) )
58195819 }
58205820
5821+ pub fn is_mutable_raw_ptr ( & self ) -> bool {
5822+ // Used outside of rust-analyzer (e.g. by `ra_ap_hir` consumers).
5823+ matches ! ( self . ty. kind( ) , TyKind :: RawPtr ( .., hir_ty:: next_solver:: Mutability :: Mut ) )
5824+ }
5825+
5826+ pub fn as_raw_ptr ( & self ) -> Option < ( Type < ' db > , Mutability ) > {
5827+ // Used outside of rust-analyzer (e.g. by `ra_ap_hir` consumers).
5828+ let TyKind :: RawPtr ( ty, m) = self . ty . kind ( ) else { return None } ;
5829+ let m = Mutability :: from_mutable ( matches ! ( m, hir_ty:: next_solver:: Mutability :: Mut ) ) ;
5830+ Some ( ( self . derived ( ty) , m) )
5831+ }
5832+
58215833 pub fn remove_raw_ptr ( & self ) -> Option < Type < ' db > > {
58225834 if let TyKind :: RawPtr ( ty, _) = self . ty . kind ( ) { Some ( self . derived ( ty) ) } else { None }
58235835 }
You can’t perform that action at this time.
0 commit comments