Skip to content

Commit

Permalink
Update Rust to 1.63, MSR to 1.61.0
Browse files Browse the repository at this point in the history
As per our [Rust version policy](https://github.com/mozilla/uniffi-rs/blob/main/docs/policies/rust-versions.md)

Requires some clippy fixes. Also fixed some clippy complaints in nightly.
  • Loading branch information
mhammond committed Aug 30, 2022
1 parent 2808944 commit 8e00615
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 43 deletions.
14 changes: 9 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ commands:
# Our minimum supported rust version is specified here.
prepare-rust-min-version:
steps:
- run: rustup override set 1.59.0
- run: rustup override set 1.61.0
- run: rustup update
build-api-docs:
steps:
Expand Down Expand Up @@ -98,15 +98,19 @@ jobs:
- run:
name: "Print the Rust version, to help with debugging"
command: rustc --version
# Note "-j 1" here and below - we saw OOM errors which this tries to workaround and is
# hopefully a cheaper workaround than an "resource_class: xlarge".
# Probably https://github.com/rust-lang/rust/issues/97549 which is a 1.61 issue.
# We should revert this once we move past 1.61
- run:
name: Build all code
command: |
# Ensures that all examples are built and avaiable
cargo build
cargo build -j 1
# some tests fail on earlier rust versions and we want to ignore them:
# * trybuild_ui_tests - error message had a comma inserted! Can probably
# be re-enabled after the next rust version bump.
- run: cargo test -- --skip trybuild_ui_tests
# * trybuild_ui_tests - 1.61 vs 1.62 hits https://github.com/dtolnay/trybuild/issues/186
# (which was WONTFIXd, so this is the best we can do)
- run: cargo test -j 1 -- --skip trybuild_ui_tests
Deploy website:
docker:
- image: rfkelly/uniffi-ci:latest
Expand Down
2 changes: 1 addition & 1 deletion examples/sprites/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Sprite {

fn move_by(&self, direction: Vector) {
let mut current_position = self.current_position.write().unwrap();
*current_position = translate(&*current_position, direction)
*current_position = translate(&current_position, direction)
}
}

Expand Down
12 changes: 4 additions & 8 deletions fixtures/uitests/tests/ui/interface_not_sync_and_send.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,28 @@ error[E0277]: the trait bound `Arc<Counter>: FfiConverter` is not satisfied
| <std::sync::Arc<r#Counter> as uniffi::FfiConverter>::lower(_arc)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FfiConverter` is not implemented for `Arc<Counter>`
|
= help: the following implementations were found:
<Arc<T> as FfiConverter>
= help: the trait `FfiConverter` is implemented for `Arc<T>`

error[E0277]: the trait bound `Arc<Counter>: FfiConverter` is not satisfied
--> $OUT_DIR[uniffi_uitests]/counter.uniffi.rs
|
| <std::sync::Arc<r#Counter> as uniffi::FfiConverter>::lower(_arc)
| ^^^^ the trait `FfiConverter` is not implemented for `Arc<Counter>`
|
= help: the following implementations were found:
<Arc<T> as FfiConverter>
= help: the trait `FfiConverter` is implemented for `Arc<T>`

error[E0277]: the trait bound `Arc<Counter>: FfiConverter` is not satisfied
--> $OUT_DIR[uniffi_uitests]/counter.uniffi.rs
|
| match<std::sync::Arc<r#Counter> as uniffi::FfiConverter>::try_lift(r#ptr) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FfiConverter` is not implemented for `Arc<Counter>`
|
= help: the following implementations were found:
<Arc<T> as FfiConverter>
= help: the trait `FfiConverter` is implemented for `Arc<T>`

error[E0277]: the trait bound `Arc<Counter>: FfiConverter` is not satisfied
--> $OUT_DIR[uniffi_uitests]/counter.uniffi.rs
|
| match<std::sync::Arc<r#Counter> as uniffi::FfiConverter>::try_lift(r#ptr) {
| ^^^^^ the trait `FfiConverter` is not implemented for `Arc<Counter>`
|
= help: the following implementations were found:
<Arc<T> as FfiConverter>
= help: the trait `FfiConverter` is implemented for `Arc<T>`
64 changes: 40 additions & 24 deletions fixtures/uitests/tests/ui/non_hashable_record_key.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ error[E0277]: the trait bound `f32: std::cmp::Eq` is not satisfied
| uniffi::deps::static_assertions::assert_impl_all!(f32: ::std::cmp::Eq, ::std::hash::Hash); // record<f32, u64>
| ^^^ the trait `std::cmp::Eq` is not implemented for `f32`
|
= help: the following implementations were found:
<i128 as std::cmp::Eq>
<i16 as std::cmp::Eq>
<i32 as std::cmp::Eq>
<i64 as std::cmp::Eq>
and 8 others
= help: the following other types implement trait `std::cmp::Eq`:
i128
i16
i32
i64
i8
isize
u128
u16
and 4 others
note: required by a bound in `assert_impl_all`
--> $OUT_DIR[uniffi_uitests]/records.uniffi.rs
|
Expand All @@ -29,12 +33,16 @@ error[E0277]: the trait bound `f32: Hash` is not satisfied
| uniffi::deps::static_assertions::assert_impl_all!(f32: ::std::cmp::Eq, ::std::hash::Hash); // record<f32, u64>
| ^^^ the trait `Hash` is not implemented for `f32`
|
= help: the following implementations were found:
<i128 as Hash>
<i16 as Hash>
<i32 as Hash>
<i64 as Hash>
and 8 others
= help: the following other types implement trait `Hash`:
i128
i16
i32
i64
i8
isize
u128
u16
and 4 others
note: required by a bound in `assert_impl_all`
--> $OUT_DIR[uniffi_uitests]/records.uniffi.rs
|
Expand All @@ -48,12 +56,16 @@ error[E0277]: the trait bound `f32: Hash` is not satisfied
| <std::collections::HashMap<f32, u64> as uniffi::FfiConverter>::lower(r#get_dict())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Hash` is not implemented for `f32`
|
= help: the following implementations were found:
<i128 as Hash>
<i16 as Hash>
<i32 as Hash>
<i64 as Hash>
and 8 others
= help: the following other types implement trait `Hash`:
i128
i16
i32
i64
i8
isize
u128
u16
and 4 others
= note: required because of the requirements on the impl of `RustBufferFfiConverter` for `HashMap<f32, u64>`

error[E0277]: the trait bound `f32: std::cmp::Eq` is not satisfied
Expand All @@ -62,10 +74,14 @@ error[E0277]: the trait bound `f32: std::cmp::Eq` is not satisfied
| <std::collections::HashMap<f32, u64> as uniffi::FfiConverter>::lower(r#get_dict())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `f32`
|
= help: the following implementations were found:
<i128 as std::cmp::Eq>
<i16 as std::cmp::Eq>
<i32 as std::cmp::Eq>
<i64 as std::cmp::Eq>
and 8 others
= help: the following other types implement trait `std::cmp::Eq`:
i128
i16
i32
i64
i8
isize
u128
u16
and 4 others
= note: required because of the requirements on the impl of `RustBufferFfiConverter` for `HashMap<f32, u64>`
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# * ./.circleci/config.yml which also specifies the rust versions used in CI.

[toolchain]
channel = "1.60.0"
channel = "1.63.0"
targets = [
"aarch64-linux-android",
"armv7-linux-androideabi",
Expand Down
8 changes: 4 additions & 4 deletions uniffi_bindgen/src/interface/types/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl TypeResolver for &weedle::types::AttributedNonAnyType<'_> {
if self.attributes.is_some() {
bail!("type attributes are not supported yet");
}
(&self.type_).resolve_type_expression(types)
self.type_.resolve_type_expression(types)
}
}

Expand All @@ -80,7 +80,7 @@ impl TypeResolver for &weedle::types::AttributedType<'_> {
if self.attributes.is_some() {
bail!("type attributes are not supported yet");
}
(&self.type_).resolve_type_expression(types)
self.type_.resolve_type_expression(types)
}
}

Expand Down Expand Up @@ -132,8 +132,8 @@ impl TypeResolver for weedle::types::RecordKeyType<'_> {

impl TypeResolver for weedle::types::RecordType<'_> {
fn resolve_type_expression(&self, types: &mut TypeUniverse) -> Result<Type> {
let key_type = (&self.generics.body.0).resolve_type_expression(types)?;
let value_type = (&self.generics.body.2).resolve_type_expression(types)?;
let key_type = self.generics.body.0.resolve_type_expression(types)?;
let value_type = self.generics.body.2.resolve_type_expression(types)?;
types.add_known_type(Type::Map(Box::new(key_type), Box::new(value_type)))
}
}
Expand Down
1 change: 1 addition & 0 deletions uniffi_bindgen/src/scaffolding/templates/ObjectTemplate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub extern "C" fn {{ ffi_free.name() }}(ptr: *const std::os::raw::c_void, call_s
{%- for meth in obj.methods() %}
#[doc(hidden)]
#[no_mangle]
#[allow(clippy::let_unit_value)] // Sometimes we generate code that binds `_retval` to `()`.
pub extern "C" fn r#{{ meth.ffi_func().name() }}(
{%- call rs::arg_list_ffi_decl(meth.ffi_func()) %}
) {% call rs::return_signature(meth) %} {
Expand Down

0 comments on commit 8e00615

Please sign in to comment.