File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -5693,6 +5693,18 @@ impl<'db> Type<'db> {
56935693 matches ! ( self . ty. kind( ) , TyKind :: RawPtr ( ..) )
56945694 }
56955695
5696+ pub fn is_mutable_raw_ptr ( & self ) -> bool {
5697+ // Used outside of rust-analyzer (e.g. by `ra_ap_hir` consumers).
5698+ matches ! ( self . ty. kind( ) , TyKind :: RawPtr ( .., hir_ty:: next_solver:: Mutability :: Mut ) )
5699+ }
5700+
5701+ pub fn as_raw_ptr ( & self ) -> Option < ( Type < ' db > , Mutability ) > {
5702+ // Used outside of rust-analyzer (e.g. by `ra_ap_hir` consumers).
5703+ let TyKind :: RawPtr ( ty, m) = self . ty . kind ( ) else { return None } ;
5704+ let m = Mutability :: from_mutable ( matches ! ( m, hir_ty:: next_solver:: Mutability :: Mut ) ) ;
5705+ Some ( ( self . derived ( ty) , m) )
5706+ }
5707+
56965708 pub fn remove_raw_ptr ( & self ) -> Option < Type < ' db > > {
56975709 if let TyKind :: RawPtr ( ty, _) = self . ty . kind ( ) { Some ( self . derived ( ty) ) } else { None }
56985710 }
You can’t perform that action at this time.
0 commit comments