Skip to content

Commit 58ec6c7

Browse files
committed
m
1 parent 1629332 commit 58ec6c7

File tree

1,994 files changed

+60490
-62061
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,994 files changed

+60490
-62061
lines changed

DynamoDbEncryption/runtimes/rust/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ readme = "README.md"
1616
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1717

1818
[dependencies]
19-
aws-config = "1.5.6"
20-
aws-lc-rs = "1.9.0"
21-
aws-lc-sys = "0.21.2"
22-
aws-sdk-dynamodb = "1.47.0"
23-
aws-sdk-kms = "1.44.0"
19+
aws-config = "1.5.8"
20+
aws-lc-rs = "1.10.0"
21+
aws-lc-sys = "0.22.0"
22+
aws-sdk-dynamodb = "1.50.0"
23+
aws-sdk-kms = "1.47.0"
2424
aws-smithy-runtime-api = {version = "1.7.2", features = ["client"] }
25-
aws-smithy-types = "1.2.6"
25+
aws-smithy-types = "1.2.7"
2626
chrono = "0.4.38"
2727
dafny_runtime = { path = "dafny_runtime_rust"}
2828
dashmap = "6.1.0"
2929
pem = "3.0.4"
30-
tokio = {version = "1.40.0", features = ["full"] }
31-
uuid = { version = "1.10.0", features = ["v4"] }
30+
tokio = {version = "1.41.0", features = ["full"] }
31+
uuid = { version = "1.11.0", features = ["v4"] }
3232

3333
[lib]
3434
path = "src/implementation_from_dafny.rs"

DynamoDbEncryption/runtimes/rust/dafny_runtime_rust/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
once_cell = "1.18.0"
8-
num = "0.4"
9-
itertools = "0.11.0"
7+
once_cell = "1.20.2"
8+
num = "0.4.3"
9+
itertools = "0.13.0"

releases/rust/db_esdk/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ readme = "README.md"
1616
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1717

1818
[dependencies]
19-
aws-config = "1.5.6"
20-
aws-lc-rs = "1.9.0"
21-
aws-lc-sys = "0.21.2"
22-
aws-sdk-dynamodb = "1.47.0"
23-
aws-sdk-kms = "1.44.0"
19+
aws-config = "1.5.8"
20+
aws-lc-rs = "1.10.0"
21+
aws-lc-sys = "0.22.0"
22+
aws-sdk-dynamodb = "1.50.0"
23+
aws-sdk-kms = "1.47.0"
2424
aws-smithy-runtime-api = {version = "1.7.2", features = ["client"] }
2525
aws-smithy-types = "1.2.7"
2626
chrono = "0.4.38"
2727
dafny_runtime = { path = "dafny_runtime_rust"}
2828
dashmap = "6.1.0"
2929
pem = "3.0.4"
30-
tokio = {version = "1.40.0", features = ["full"] }
31-
uuid = { version = "1.10.0", features = ["v4"] }
30+
tokio = {version = "1.41.0", features = ["full"] }
31+
uuid = { version = "1.11.0", features = ["v4"] }
3232

3333
[lib]
3434
path = "src/implementation_from_dafny.rs"
3535

3636
[[example]]
37-
name = "main"
37+
name = "main"

releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
once_cell = "1.18.0"
8-
num = "0.4"
9-
itertools = "0.11.0"
7+
once_cell = "1.20.2"
8+
num = "0.4.3"
9+
itertools = "0.13.0"

releases/rust/db_esdk/dafny_runtime_rust/src/lib.rs

Lines changed: 127 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,7 +1735,9 @@ impl<V: DafnyTypeEq> Multiset<V> {
17351735
}
17361736

17371737
pub fn iter(&self) -> impl Iterator<Item = V> + '_ {
1738-
self.data.iter().map(|(k, _v)| k).cloned()
1738+
self.data.iter().flat_map(
1739+
|(k, &ref v)|
1740+
::std::iter::repeat(k).take(v.clone().as_usize())).cloned()
17391741
}
17401742
}
17411743

@@ -3135,6 +3137,16 @@ macro_rules! update_field_nodrop {
31353137
};
31363138
}
31373139

3140+
// Same as update_field_nodrop but for mutable fields
3141+
#[macro_export]
3142+
macro_rules! update_field_mut_nodrop {
3143+
($ptr:expr, $field:ident, $value:expr) => {
3144+
let lhs = $ptr;
3145+
let value = $value;
3146+
unsafe { $crate::read!(lhs).$field.get().write(value) }
3147+
};
3148+
}
3149+
31383150
// When initializing an uninitialized field for the first time,
31393151
// we ensure we don't drop the previous content
31403152
#[macro_export]
@@ -3185,6 +3197,21 @@ macro_rules! update_field_uninit {
31853197
}};
31863198
}
31873199

3200+
// Same as update_field_uninit but for mutable fields
3201+
#[macro_export]
3202+
macro_rules! update_field_mut_uninit {
3203+
($t:expr, $field:ident, $field_assigned:expr, $value:expr) => {{
3204+
let computed_value = $value;
3205+
#[allow(unused_assignments)]
3206+
if $field_assigned {
3207+
$crate::modify_field!($crate::read!($t).$field, computed_value);
3208+
} else {
3209+
$crate::update_field_mut_nodrop!($t, $field, computed_value);
3210+
$field_assigned = true;
3211+
}
3212+
}};
3213+
}
3214+
31883215
// Macro to call at the end of the first new; constructor when not every field is guaranteed to be assigned.
31893216
#[macro_export]
31903217
macro_rules! update_field_if_uninit {
@@ -3197,6 +3224,18 @@ macro_rules! update_field_if_uninit {
31973224
}};
31983225
}
31993226

3227+
// Same as update_field_if_uninit but for mutable fields
3228+
#[macro_export]
3229+
macro_rules! update_field_mut_if_uninit {
3230+
($t:expr, $field:ident, $field_assigned:expr, $value:expr) => {{
3231+
let computed_value = $value;
3232+
if !$field_assigned {
3233+
$crate::update_field_mut_nodrop!($t, $field, computed_value);
3234+
$field_assigned = true;
3235+
}
3236+
}};
3237+
}
3238+
32003239
/////////////////
32013240
// Raw pointers (require wrapping because of equality)
32023241
/////////////////
@@ -3358,6 +3397,7 @@ macro_rules! cast {
33583397
pub struct Object<T: ?Sized>(pub Option<rcmut::RcMut<T>>);
33593398

33603399
impl <T: ?Sized> Object<T> {
3400+
// For safety, it requires the Rc to have been created with Rc::new()
33613401
pub unsafe fn from_rc(rc: Rc<T>) -> Object<T> {
33623402
Object(Some(rcmut::from_rc(rc)))
33633403
}
@@ -3395,17 +3435,34 @@ impl <T: ?Sized>Default for Object<T> {
33953435
}
33963436
}
33973437

3398-
impl<T: ?Sized> Debug for Object<T> {
3438+
impl<T: ?Sized + UpcastObject<dyn Any>> Debug for Object<T> {
33993439
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
34003440
self.fmt_print(f, false)
34013441
}
34023442
}
3403-
impl <T: ?Sized> DafnyPrint for Object<T> {
3443+
impl <T: ?Sized + UpcastObject<dyn Any>> DafnyPrint for Object<T> {
3444+
fn fmt_print(&self, f: &mut Formatter<'_>, _in_seq: bool) -> std::fmt::Result {
3445+
let obj_any = UpcastObject::<dyn Any>::upcast(self.as_ref());
3446+
let option_string = obj_any.as_ref().downcast_ref::<String>();
3447+
match option_string {
3448+
Some(s) => write!(f, "{}", s),
3449+
None => write!(f, "<object>"),
3450+
}
3451+
}
3452+
}
3453+
3454+
impl <T: DafnyType> DafnyPrint for Object<[T]> {
34043455
fn fmt_print(&self, f: &mut Formatter<'_>, _in_seq: bool) -> std::fmt::Result {
34053456
write!(f, "<object>")
34063457
}
34073458
}
34083459

3460+
impl UpcastObject<dyn Any> for String {
3461+
fn upcast(&self) -> Object<dyn Any> {
3462+
// SAFETY: RC was just created
3463+
unsafe { Object::from_rc(Rc::new(self.clone()) as Rc<dyn Any>) }
3464+
}
3465+
}
34093466

34103467
impl <T: ?Sized, U: ?Sized> PartialEq<Object<U>> for Object<T> {
34113468
fn eq(&self, other: &Object<U>) -> bool {
@@ -3499,6 +3556,14 @@ macro_rules! update_field_nodrop_object {
34993556
};
35003557
}
35013558

3559+
// Same but for mutable fields
3560+
#[macro_export]
3561+
macro_rules! update_field_mut_nodrop_object {
3562+
($ptr:expr, $field: ident, $value:expr) => {
3563+
unsafe { ($crate::rcmut::borrow_mut(&mut $ptr.0.clone().unwrap())).$field.get().write($value) }
3564+
};
3565+
}
3566+
35023567
// Equivalent of update_nodrop but for rcmut
35033568
#[macro_export]
35043569
macro_rules! update_nodrop_object {
@@ -3511,15 +3576,28 @@ macro_rules! update_nodrop_object {
35113576
#[macro_export]
35123577
macro_rules! update_field_if_uninit_object {
35133578
($t:expr, $field:ident, $field_assigned:expr, $value:expr) => {{
3514-
let computed_value = $value;
35153579
#[allow(unused_assignments)]
35163580
if !$field_assigned {
3581+
let computed_value = $value;
35173582
$crate::update_field_nodrop_object!($t, $field, computed_value);
35183583
$field_assigned = true;
35193584
}
35203585
}};
35213586
}
35223587

3588+
// Same for mutable fields
3589+
#[macro_export]
3590+
macro_rules! update_field_mut_if_uninit_object {
3591+
($t:expr, $field:ident, $field_assigned:expr, $value:expr) => {{
3592+
#[allow(unused_assignments)]
3593+
if !$field_assigned {
3594+
let computed_value = $value;
3595+
$crate::update_field_mut_nodrop_object!($t, $field, computed_value);
3596+
$field_assigned = true;
3597+
}
3598+
}};
3599+
}
3600+
35233601
// Equivalent of update_field_uninit but for rcmut
35243602
#[macro_export]
35253603
macro_rules! update_field_uninit_object {
@@ -3535,6 +3613,22 @@ macro_rules! update_field_uninit_object {
35353613
}};
35363614
}
35373615

3616+
// Same but for mutable fields
3617+
#[macro_export]
3618+
macro_rules! update_field_mut_uninit_object {
3619+
($t:expr, $field:ident, $field_assigned:expr, $value:expr) => {{
3620+
let computed_value = $value;
3621+
#[allow(unused_assignments)]
3622+
if $field_assigned {
3623+
$crate::modify_field!($crate::rd!($t).$field, computed_value);
3624+
} else {
3625+
$crate::update_field_mut_nodrop_object!($t, $field, computed_value);
3626+
$field_assigned = true;
3627+
}
3628+
}};
3629+
}
3630+
3631+
35383632
// Equivalent of modify but for rcmut
35393633
#[macro_export]
35403634
macro_rules! md {
@@ -3551,6 +3645,34 @@ macro_rules! rd {
35513645
};
35523646
}
35533647

3648+
// To use when modifying a mutable field that is wrapped with UnsafeCell
3649+
#[macro_export]
3650+
macro_rules! modify_field {
3651+
($pointer:expr, $rhs:expr) => {
3652+
{
3653+
let lhs = $pointer.get();
3654+
let rhs = $rhs;
3655+
unsafe {*lhs = rhs}
3656+
}
3657+
};
3658+
}
3659+
3660+
// To use when reading a mutable field that is wrapped with UnsafeCell
3661+
#[macro_export]
3662+
macro_rules! read_field {
3663+
($pointer:expr) => {
3664+
{
3665+
let lhs = $pointer.get();
3666+
unsafe {(*lhs).clone()}
3667+
}
3668+
};
3669+
}
3670+
3671+
pub type Field<T> = UnsafeCell<T>;
3672+
pub fn new_field<T>(t: T) -> Field<T> {
3673+
UnsafeCell::new(t)
3674+
}
3675+
35543676
// Count the number of references to the given object
35553677
#[macro_export]
35563678
macro_rules! refcount {
@@ -3923,4 +4045,4 @@ impl<K: DafnyTypeEq, U: DafnyTypeEq> Map<K, U>
39234045
Map::from_hashmap_owned(new_map)
39244046
})
39254047
}
3926-
}
4048+
}

0 commit comments

Comments
 (0)