File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -933,12 +933,26 @@ trait RcBoxPtr<T> {
933
933
934
934
impl < T > RcBoxPtr < T > for Rc < T > {
935
935
#[ inline( always) ]
936
- fn inner ( & self ) -> & RcBox < T > { unsafe { & ( * * self . _ptr ) } }
936
+ fn inner ( & self ) -> & RcBox < T > {
937
+ unsafe {
938
+ // Safe to assume this here, as if it weren't true, we'd be breaking
939
+ // the contract anyway
940
+ assume ( !self . _ptr . is_null ( ) ) ;
941
+ & ( * * self . _ptr )
942
+ }
943
+ }
937
944
}
938
945
939
946
impl < T > RcBoxPtr < T > for Weak < T > {
940
947
#[ inline( always) ]
941
- fn inner ( & self ) -> & RcBox < T > { unsafe { & ( * * self . _ptr ) } }
948
+ fn inner ( & self ) -> & RcBox < T > {
949
+ unsafe {
950
+ // Safe to assume this here, as if it weren't true, we'd be breaking
951
+ // the contract anyway
952
+ assume ( !self . _ptr . is_null ( ) ) ;
953
+ & ( * * self . _ptr )
954
+ }
955
+ }
942
956
}
943
957
944
958
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments