Skip to content

Commit 4fbd767

Browse files
committed
m
1 parent 8c2140e commit 4fbd767

File tree

3 files changed

+22
-23
lines changed

3 files changed

+22
-23
lines changed

DynamoDbEncryption/runtimes/rust/dafny_runtime_rust/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ update-system-module: build-system-module
1818
cp $(GENERATED_SYSTEM_MODULE_SOURCE) $(GENERATED_SYSTEM_MODULE_TARGET)
1919

2020
test:
21-
cargo test
21+
cargo test
22+
(cd ../../DafnyRuntime.Tests/DafnyRuntimeRustTest; cargo test)

DynamoDbEncryption/runtimes/rust/dafny_runtime_rust/src/lib.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod system;
55
pub use mem::MaybeUninit;
66
use num::{bigint::ParseBigIntError, Integer, Num, One, Signed};
77
pub use once_cell::unsync::Lazy;
8-
pub use std::{
8+
use std::{
99
any::Any,
1010
borrow::Borrow,
1111
boxed::Box,
@@ -322,7 +322,7 @@ impl AsRef<BigInt> for DafnyInt {
322322
#[macro_export]
323323
macro_rules! truncate {
324324
($x:expr, $t:ty) => {
325-
<$crate::DafnyInt as $crate::Into<$t>>::into($x)
325+
<$crate::DafnyInt as ::std::convert::Into<$t>>::into($x)
326326
};
327327
}
328328

@@ -594,10 +594,10 @@ impl DafnyInt {
594594
macro_rules! impl_dafnyint_from {
595595
() => {};
596596
($type:ident) => {
597-
impl $crate::From<$type> for $crate::DafnyInt {
597+
impl ::std::convert::From<$type> for $crate::DafnyInt {
598598
fn from(n: $type) -> Self {
599599
$crate::DafnyInt {
600-
data: $crate::Rc::new(n.into()),
600+
data: ::std::rc::Rc::new(n.into()),
601601
}
602602
}
603603
}
@@ -1990,7 +1990,7 @@ impl<A: DafnyPrint> DafnyPrint for LazyFieldWrapper<A> {
19901990
// Convert the DafnyPrint above into a macro so that we can create it for functions of any input arity
19911991
macro_rules! dafny_print_function {
19921992
($($n:tt)*) => {
1993-
impl <B, $($n),*> $crate::DafnyPrint for $crate::Rc<dyn $crate::Fn($($n),*) -> B> {
1993+
impl <B, $($n),*> $crate::DafnyPrint for ::std::rc::Rc<dyn ::std::ops::Fn($($n),*) -> B> {
19941994
fn fmt_print(&self, f: &mut ::std::fmt::Formatter<'_>, _in_seq: bool) -> ::std::fmt::Result {
19951995
write!(f, "<function>")
19961996
}
@@ -2557,14 +2557,14 @@ macro_rules! ARRAY_GETTER_LENGTH {
25572557
#[macro_export]
25582558
macro_rules! array {
25592559
($($x:expr), *) => {
2560-
$crate::array::from_native($crate::Box::new([$($x), *]))
2560+
$crate::array::from_native(::std::boxed::Box::new([$($x), *]))
25612561
}
25622562
}
25632563

25642564
macro_rules! ARRAY_INIT {
25652565
{$length: ident, $inner: expr} => {
25662566
$crate::array::initialize_box_usize($length, {
2567-
$crate::Rc::new(move |_| { $inner })
2567+
::std::rc::Rc::new(move |_| { $inner })
25682568
})
25692569
}
25702570
}
@@ -2579,10 +2579,10 @@ macro_rules! ARRAY_INIT_INNER {
25792579
// Box<[Box<[Box<[T]>]>]>
25802580
macro_rules! ARRAY_DATA_TYPE {
25812581
($length:ident) => {
2582-
$crate::Box<[T]>
2582+
::std::boxed::Box<[T]>
25832583
};
25842584
($length:ident, $($rest_length:ident),+) => {
2585-
$crate::Box<[ARRAY_DATA_TYPE!($($rest_length),+)]>
2585+
::std::boxed::Box<[ARRAY_DATA_TYPE!($($rest_length),+)]>
25862586
};
25872587
}
25882588

@@ -2606,8 +2606,8 @@ macro_rules! ARRAY_METHODS {
26062606
pub fn placebos_box_usize(
26072607
$length0: usize,
26082608
$($length: usize),+
2609-
) -> $crate::Box<$ArrayType<$crate::MaybeUninit<T>>> {
2610-
$crate::Box::new($ArrayType {
2609+
) -> ::std::boxed::Box<$ArrayType<$crate::MaybeUninit<T>>> {
2610+
::std::boxed::Box::new($ArrayType {
26112611
$($length: $length),+,
26122612
data: INIT_ARRAY_DATA!($ArrayType, $length0, $($length),+),
26132613
})
@@ -2676,15 +2676,15 @@ macro_rules! ARRAY_TO_VEC_LOOP {
26762676
};
26772677
(@inner $self: ident, $outerTmp: ident, $data: expr $(, $rest_length_usize: ident)*) => {
26782678
{
2679-
let mut tmp = $crate::Vec::new();
2679+
let mut tmp = ::std::vec::Vec::new();
26802680
ARRAY_TO_VEC_LOOP!(@for $self, tmp, $data $(, $rest_length_usize)*);
26812681
$outerTmp.push(tmp);
26822682
}
26832683
};
26842684

26852685
($self: ident, $data: expr $(, $rest_length_usize: ident)*) => {
26862686
{
2687-
let mut tmp = $crate::Vec::new();
2687+
let mut tmp = ::std::vec::Vec::new();
26882688
ARRAY_TO_VEC_LOOP!(@for $self, tmp, $data $(, $rest_length_usize)*);
26892689
tmp
26902690
}
@@ -2693,10 +2693,10 @@ macro_rules! ARRAY_TO_VEC_LOOP {
26932693

26942694
macro_rules! ARRAY_TO_VEC_TYPE {
26952695
($length0: ident) => {
2696-
$crate::Vec<T>
2696+
::std::vec::Vec<T>
26972697
};
26982698
($length0: ident $(, $res_length: ident)*) => {
2699-
$crate::Vec<ARRAY_TO_VEC_TYPE!($($res_length), *)>
2699+
::std::vec::Vec<ARRAY_TO_VEC_TYPE!($($res_length), *)>
27002700
}
27012701
}
27022702

@@ -2751,7 +2751,7 @@ macro_rules! ARRAY_DEF {
27512751
$(($length, $length_usize)), +
27522752
}
27532753
}
2754-
impl<T: $crate::Clone> $ArrayType<T> {
2754+
impl<T: ::std::clone::Clone> $ArrayType<T> {
27552755
ARRAY_TO_VEC_WRAPPER!{
27562756
$(($length, $length_usize)), +
27572757
}
@@ -3111,15 +3111,15 @@ macro_rules! is_object {
31113111
#[macro_export]
31123112
macro_rules! cast_any {
31133113
($raw:expr) => {
3114-
$crate::Upcast::<dyn $crate::Any>::upcast($crate::read!($raw))
3114+
$crate::Upcast::<dyn ::std::any::Any>::upcast($crate::read!($raw))
31153115
};
31163116
}
31173117
// cast_any_object is meant to be used on references only, to convert any references (classes or traits)*
31183118
// to an Any reference trait
31193119
#[macro_export]
31203120
macro_rules! cast_any_object {
31213121
($obj:expr) => {
3122-
$crate::UpcastObject::<dyn $crate::Any>::upcast($crate::md!($obj))
3122+
$crate::UpcastObject::<dyn ::std::any::Any>::upcast($crate::md!($obj))
31233123
};
31243124
}
31253125

@@ -3555,7 +3555,7 @@ macro_rules! rd {
35553555
#[macro_export]
35563556
macro_rules! refcount {
35573557
($x:expr) => {
3558-
$crate::Rc::strong_count(unsafe { $crate::rcmut::as_rc($x.0.as_ref().unwrap()) })
3558+
::std::rc::Rc::strong_count(unsafe { $crate::rcmut::as_rc($x.0.as_ref().unwrap()) })
35593559
};
35603560
}
35613561

DynamoDbEncryption/runtimes/rust/dafny_runtime_rust/src/tests/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -853,9 +853,7 @@ mod tests {
853853
let o: Object<InternalOpaqueError> = Object::new(s);
854854
let n: Object<dyn ::std::any::Any> = upcast_object::<InternalOpaqueError, dyn ::std::any::Any>()(o);
855855
let x = cast_object!(n, InternalOpaqueError);
856-
let s2 = unsafe {
857-
crate::dafny_runtime_conversions::object::dafny_class_to_struct(x)
858-
};
856+
let s2 = crate::dafny_runtime_conversions::object::dafny_class_to_struct(x);
859857
assert_eq!(s2.message, "Hello, World!");
860858
}
861859
}

0 commit comments

Comments
 (0)