Skip to content

Commit eaab5f0

Browse files
authored
chore: deps upgrade (#242)
1 parent 63a7684 commit eaab5f0

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ categories = ["api-bindings"]
1212
exclude = ["/.github", "/.crates", "/guide"]
1313

1414
[dependencies]
15-
bitflags = "1.2.1"
16-
parking_lot = "0.12.1"
15+
bitflags = "2"
16+
parking_lot = "0.12"
1717
cfg-if = "1.0"
18-
once_cell = "1.8.0"
18+
once_cell = "1.17"
1919
anyhow = { version = "1", optional = true }
2020
ext-php-rs-derive = { version = "=0.10.0", path = "./crates/macros" }
2121

src/flags.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use crate::error::{Error, Result};
2828

2929
bitflags! {
3030
/// Flags used for setting the type of Zval.
31+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
3132
pub struct ZvalTypeFlags: u32 {
3233
const Undef = IS_UNDEF;
3334
const Null = IS_NULL;
@@ -45,13 +46,13 @@ bitflags! {
4546
const Void = IS_VOID;
4647
const Ptr = IS_PTR;
4748

48-
const InternedStringEx = Self::String.bits;
49-
const StringEx = Self::String.bits | Self::RefCounted.bits;
50-
const ArrayEx = Self::Array.bits | Self::RefCounted.bits | Self::Collectable.bits;
51-
const ObjectEx = Self::Object.bits | Self::RefCounted.bits | Self::Collectable.bits;
52-
const ResourceEx = Self::Resource.bits | Self::RefCounted.bits;
53-
const ReferenceEx = Self::Reference.bits | Self::RefCounted.bits;
54-
const ConstantAstEx = Self::ConstantExpression.bits | Self::RefCounted.bits;
49+
const InternedStringEx = Self::String.bits();
50+
const StringEx = Self::String.bits() | Self::RefCounted.bits();
51+
const ArrayEx = Self::Array.bits() | Self::RefCounted.bits() | Self::Collectable.bits();
52+
const ObjectEx = Self::Object.bits() | Self::RefCounted.bits() | Self::Collectable.bits();
53+
const ResourceEx = Self::Resource.bits() | Self::RefCounted.bits();
54+
const ReferenceEx = Self::Reference.bits() | Self::RefCounted.bits();
55+
const ConstantAstEx = Self::ConstantExpression.bits() | Self::RefCounted.bits();
5556

5657
const RefCounted = (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT);
5758
const Collectable = (IS_TYPE_COLLECTABLE << Z_TYPE_FLAGS_SHIFT);
@@ -60,6 +61,7 @@ bitflags! {
6061

6162
bitflags! {
6263
/// Flags for building classes.
64+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
6365
pub struct ClassFlags: u32 {
6466
const Final = ZEND_ACC_FINAL;
6567
const Abstract = ZEND_ACC_ABSTRACT;
@@ -91,6 +93,7 @@ bitflags! {
9193

9294
bitflags! {
9395
/// Flags for building methods.
96+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
9497
pub struct MethodFlags: u32 {
9598
const Public = ZEND_ACC_PUBLIC;
9699
const Protected = ZEND_ACC_PROTECTED;
@@ -126,6 +129,7 @@ bitflags! {
126129

127130
bitflags! {
128131
/// Flags for building properties.
132+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
129133
pub struct PropertyFlags: u32 {
130134
const Public = ZEND_ACC_PUBLIC;
131135
const Protected = ZEND_ACC_PROTECTED;
@@ -138,6 +142,7 @@ bitflags! {
138142

139143
bitflags! {
140144
/// Flags for building constants.
145+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
141146
pub struct ConstantFlags: u32 {
142147
const Public = ZEND_ACC_PUBLIC;
143148
const Protected = ZEND_ACC_PROTECTED;
@@ -148,6 +153,7 @@ bitflags! {
148153

149154
bitflags! {
150155
/// Flags for building module global constants.
156+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
151157
pub struct GlobalConstantFlags: u32 {
152158
const CaseSensitive = CONST_CS;
153159
const Persistent = CONST_PERSISTENT;
@@ -158,6 +164,7 @@ bitflags! {
158164

159165
bitflags! {
160166
/// Represents the result of a function.
167+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
161168
pub struct ZendResult: i32 {
162169
const Success = 0;
163170
const Failure = -1;

src/types/zval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ impl Zval {
555555
// SAFETY: If the value if refcounted (`self.u1.type_info & Z_TYPE_FLAGS_MASK`)
556556
// then it is valid to dereference `self.value.counted`.
557557
unsafe {
558-
let flags = ZvalTypeFlags::from_bits_unchecked(self.u1.type_info);
558+
let flags = ZvalTypeFlags::from_bits_retain(self.u1.type_info);
559559
if flags.contains(ZvalTypeFlags::RefCounted) {
560560
(*self.value.counted).gc.refcount += 1;
561561
}

0 commit comments

Comments
 (0)