Skip to content

Commit

Permalink
Merge branch 'main-1.x' into Golang/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ShubhamChaturvedi7 committed Sep 4, 2024
2 parents 4a80456 + 3c0a1ce commit 2c3f760
Show file tree
Hide file tree
Showing 409 changed files with 9,523 additions and 10,543 deletions.
1 change: 1 addition & 0 deletions .github/workflows/nightly_dafny.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
dafny-nightly-java,
dafny-nightly-net,
dafny-nightly-rust,
dafny-nightly-python,
]
if: ${{ always() && contains(needs.*.result, 'failure') }}
env:
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
steps:
- name: Populate Dafny versions list
id: populate-dafny-versions-list
run: echo "dafny-versions-list=['4.2.0', '4.4.0']" >> $GITHUB_OUTPUT
run: echo "dafny-versions-list=['4.2.0', '4.4.0', '4.8.0']" >> $GITHUB_OUTPUT
- name: Populate Dafny versions list for "only new versions" languages (Python)
id: populate-only-new-dafny-versions-list
run: echo "only-new-dafny-versions-list=['4.7.0']" >> $GITHUB_OUTPUT
run: echo "only-new-dafny-versions-list=['4.8.0']" >> $GITHUB_OUTPUT
outputs:
dafny-version-list: ${{ steps.populate-dafny-versions-list.outputs.dafny-versions-list }}
only-new-dafny-version-list: ${{ steps.populate-only-new-dafny-versions-list.outputs.only-new-dafny-versions-list }}
Expand Down Expand Up @@ -66,3 +66,18 @@ jobs:
uses: ./.github/workflows/test_models_python_tests.yml
with:
dafny: ${{ matrix.dafny-version }}

pr-ci-all-required:
if: always()
needs:
- pr-ci-verification
- pr-ci-java
- pr-ci-net
- pr-ci-rust
- pr-ci-python
runs-on: ubuntu-latest
steps:
- name: Verify all required jobs passed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
steps:
- name: Populate Dafny versions list
id: populate-dafny-versions-list
run: echo "dafny-versions-list=['4.2.0', '4.4.0']" >> $GITHUB_OUTPUT
run: echo "dafny-versions-list=['4.2.0', '4.4.0', '4.8.0']" >> $GITHUB_OUTPUT
- name: Populate Dafny versions list for "only new versions" languages (Python)
id: populate-only-new-dafny-versions-list
run: echo "only-new-dafny-versions-list=['4.7.0']" >> $GITHUB_OUTPUT
run: echo "only-new-dafny-versions-list=['4.8.0']" >> $GITHUB_OUTPUT
outputs:
dafny-version-list: ${{ steps.populate-dafny-versions-list.outputs.dafny-versions-list }}
only-new-dafny-version-list: ${{ steps.populate-only-new-dafny-versions-list.outputs.only-new-dafny-versions-list }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_models_rust_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "1.76.0"
toolchain: "1.80.0"
rustflags: ""
components: rustfmt

Expand Down
80 changes: 80 additions & 0 deletions TestModels/Aggregate/runtimes/rust/src/standard_library_externs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Annotation to ignore the case of this module
use crate::r#_Wrappers_Compile;
use crate::UTF8;

impl crate::UTF8::_default {
pub fn Encode(
s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
) -> ::std::rc::Rc<
r#_Wrappers_Compile::Result<
UTF8::ValidUTF8Bytes,
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
>,
> {
let v = s.to_array();
let mut _accumulator: Vec<u8> = vec![];
// Use of .encode_utf8 method.
let mut surrogate: Option<u16> = None;
for c in v.iter() {
let s = if let Some(s) = surrogate {
String::from_utf16(&[s, c.0])
} else {
String::from_utf16(&[c.0])
};
surrogate = None;
match s {
Ok(value) => {
_accumulator.extend(value.as_bytes());
continue;
}
Err(e) => {
if 0xD800 <= c.0 && c.0 <= 0xDFFF {
surrogate = Some(c.0);
continue;
}
return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<UTF8::ValidUTF8Bytes, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure {
error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(
&e.to_string())
});
}
}
}
if let Some(s) = surrogate {
return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<UTF8::ValidUTF8Bytes, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure {
error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(
&format!("Surrogate pair missing: 0x{:04x}", s))
});
}
::std::rc::Rc::new(r#_Wrappers_Compile::Result::<
UTF8::ValidUTF8Bytes,
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
>::Success {
value: ::dafny_runtime::Sequence::from_array_owned(_accumulator),
})
}
pub fn Decode(
b: &::dafny_runtime::Sequence<u8>,
) -> ::std::rc::Rc<
r#_Wrappers_Compile::Result<
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
>,
> {
let b = String::from_utf8(b.to_array().as_ref().clone());
match b {
Ok(s) => {
::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success {
value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s)
})
},
Err(e) => {
return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure {
error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(
&e.to_string())
})
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Annotation to ignore the case of this module
use crate::r#_Wrappers_Compile;
use crate::UTF8;

impl crate::UTF8::_default {
pub fn Encode(
s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
) -> ::std::rc::Rc<
r#_Wrappers_Compile::Result<
UTF8::ValidUTF8Bytes,
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
>,
> {
let v = s.to_array();
let mut _accumulator: Vec<u8> = vec![];
// Use of .encode_utf8 method.
let mut surrogate: Option<u16> = None;
for c in v.iter() {
let s = if let Some(s) = surrogate {
String::from_utf16(&[s, c.0])
} else {
String::from_utf16(&[c.0])
};
surrogate = None;
match s {
Ok(value) => {
_accumulator.extend(value.as_bytes());
continue;
}
Err(e) => {
if 0xD800 <= c.0 && c.0 <= 0xDFFF {
surrogate = Some(c.0);
continue;
}
return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<UTF8::ValidUTF8Bytes, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure {
error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(
&e.to_string())
});
}
}
}
if let Some(s) = surrogate {
return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<UTF8::ValidUTF8Bytes, ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure {
error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(
&format!("Surrogate pair missing: 0x{:04x}", s))
});
}
::std::rc::Rc::new(r#_Wrappers_Compile::Result::<
UTF8::ValidUTF8Bytes,
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
>::Success {
value: ::dafny_runtime::Sequence::from_array_owned(_accumulator),
})
}
pub fn Decode(
b: &::dafny_runtime::Sequence<u8>,
) -> ::std::rc::Rc<
r#_Wrappers_Compile::Result<
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
>,
> {
let b = String::from_utf8(b.to_array().as_ref().clone());
match b {
Ok(s) => {
::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success {
value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s)
})
},
Err(e) => {
return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>,
::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure {
error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(
&e.to_string())
})
}
}
}
}
8 changes: 3 additions & 5 deletions TestModels/Errors/runtimes/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
aws-smithy-runtime = {version = "1.7.1", features=["client"]}
aws-smithy-runtime-api = {version = "1.7.2", features=["client"]}
aws-smithy-types = "1.2.4"
dafny_runtime = { path = "../../../dafny-dependencies/dafny_runtime_rust"}
[dependencies.aws-smithy-runtime]
features = ["client"]
[dependencies.aws-smithy-runtime-api]
features = ["client"]
[dependencies.aws-smithy-types]

[dev-dependencies.tokio]
version = "1.26.0"
Expand Down
Loading

0 comments on commit 2c3f760

Please sign in to comment.