Skip to content

Commit fa0d0fd

Browse files
committed
Update Rust to 1.77.1, min supported Rust to 1.74
1 parent 8b98ca7 commit fa0d0fd

File tree

15 files changed

+250
-45
lines changed

15 files changed

+250
-45
lines changed

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ commands:
2525
# Our minimum supported rust version is specified here.
2626
prepare-rust-min-version:
2727
steps:
28-
- run: rustup override set 1.66.0
28+
- run: rustup override set 1.74.0
2929
- run: rustup update
3030
build-api-docs:
3131
steps:
@@ -42,7 +42,7 @@ orbs:
4242
jobs:
4343
Check Rust formatting:
4444
docker:
45-
- image: cimg/rust:1.72
45+
- image: cimg/rust:1.77.1
4646
resource_class: small
4747
steps:
4848
- checkout
@@ -52,7 +52,7 @@ jobs:
5252
- run: cargo fmt -- --check
5353
Lint Rust with clippy:
5454
docker:
55-
- image: cimg/rust:1.72
55+
- image: cimg/rust:1.77.1
5656
resource_class: small
5757
steps:
5858
- checkout
@@ -62,7 +62,7 @@ jobs:
6262
- run: cargo clippy --all --all-targets -- -D warnings
6363
Lint Rust Docs:
6464
docker:
65-
- image: cimg/rust:1.72
65+
- image: cimg/rust:1.77.1
6666
resource_class: small
6767
steps:
6868
- checkout
@@ -120,7 +120,7 @@ jobs:
120120
- run: cargo test -- --skip trybuild_ui_tests
121121
Deploy website:
122122
docker:
123-
- image: cimg/rust:1.72
123+
- image: cimg/rust:1.77.1
124124
resource_class: small
125125
steps:
126126
- checkout

docs/policies/rust-versions.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,7 @@ Our official Rust version policy is:
3939
* This policy only applies to the "major" and "minor" versions - a different
4040
patch level is still considered compliant with this policy.
4141

42-
## Implications of this
43-
44-
All CI for this project will try and pin itself to this same version. At
45-
time of writing, this means that [our circle CI integration
46-
](https://github.com/mozilla/uniffi-rs/blob/main/.circleci/config.yml) and
47-
[rust-toolchain configuration](https://github.com/mozilla/uniffi-rs/blob/main/rust-toolchain.toml)
48-
will specify the version (and where possible, the CI configuration file will
49-
avoid duplicating the information in `rust-toolchain.toml`)
50-
51-
We should maintain CI to ensure we still build with the "Requires" version.
42+
# Updating these versions
5243

5344
As versions inside mozilla-central change, we will bump the UniFI versions
5445
accordingly. While newer versions of Rust can be expected to work correctly
@@ -57,6 +48,22 @@ with the new version. Thus, a PR to bump the minimum version is likely to also
5748
require a PR to make changes which keep clippy happy.
5849

5950
In the interests of avoiding redundant information which will inevitably
60-
become stale, the circleci and rust-toolchain configuration links above
51+
become stale, the circleci and rust-toolchain configuration links below
6152
should be considered the canonical source of truth for the currently supported
6253
official Rust version.
54+
55+
Unfortunately these versions are spread out over a few places.
56+
57+
## Updating the "Uses" version
58+
59+
* Update the version specified in [`rust-toolchain.toml`](https://github.com/mozilla/uniffi-rs/blob/main/rust-toolchain.toml)
60+
* In [our circle CI integration](https://github.com/mozilla/uniffi-rs/blob/main/.circleci/config.yml)
61+
you will find a number of docker references similar to `cimg/rust:1.XX` - all of these
62+
should be updated; while some tasks, such as publishing the docs, are largely indepdenent of
63+
the requirements in this policy, we should keep them all consistent where we can.
64+
65+
## Updating the "Minimum Supported Version
66+
67+
* In [our circle CI integration](https://github.com/mozilla/uniffi-rs/blob/main/.circleci/config.yml)
68+
you will find a task `prepare-rust-min-version` which specifies this version via executing
69+
`rustup update` with the version. This is the version to update.

fixtures/coverall/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ fn get_complex_error(e: Option<ComplexError>) -> ComplexError {
158158

159159
#[uniffi::export]
160160
fn get_error_dict(d: Option<ErrorDict>) -> ErrorDict {
161-
d.unwrap_or(Default::default())
161+
d.unwrap_or_default()
162162
}
163163

164164
#[derive(Default, Debug, uniffi::Record)]
@@ -417,7 +417,7 @@ impl Coveralls {
417417
}
418418

419419
fn get_other(&self) -> Option<Arc<Self>> {
420-
(*self.other.lock().unwrap()).as_ref().map(Arc::clone)
420+
(*self.other.lock().unwrap()).clone()
421421
}
422422

423423
fn take_other_fallible(self: Arc<Self>) -> Result<()> {

fixtures/coverall/src/traits.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl NodeTrait for Trait1 {
179179
}
180180

181181
fn get_parent(&self) -> Option<Arc<dyn NodeTrait>> {
182-
(*self.parent.lock().unwrap()).as_ref().map(Arc::clone)
182+
(*self.parent.lock().unwrap()).clone()
183183
}
184184
}
185185

@@ -197,7 +197,7 @@ impl NodeTrait for Trait2 {
197197
}
198198

199199
fn get_parent(&self) -> Option<Arc<dyn NodeTrait>> {
200-
(*self.parent.lock().unwrap()).as_ref().map(Arc::clone)
200+
(*self.parent.lock().unwrap()).clone()
201201
}
202202
}
203203

fixtures/metadata/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ pub trait Logger {
9393
}
9494

9595
pub use calc::Calculator;
96-
pub use error::{ComplexError, FlatError};
96+
pub use error::FlatError;
9797
pub use person::Person;
9898
pub use state::State;
99-
pub use uniffi_traits::Special;
99+
100100
pub use weapon::Weapon;
101101

102102
mod test_type_ids {

fixtures/uitests/tests/ui/interface_not_sync_and_send.stderr

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,27 @@ error[E0277]: `Cell<u32>` cannot be shared between threads safely
44
| struct r#Counter { }
55
| ^^^^^^^^^ `Cell<u32>` cannot be shared between threads safely
66
|
7-
= help: within `Counter`, the trait `Sync` is not implemented for `Cell<u32>`
7+
= help: within `Counter`, the trait `Sync` is not implemented for `Cell<u32>`, which is required by `Counter: Sync`
8+
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU32` instead
9+
note: required because it appears within the type `Counter`
10+
--> tests/ui/interface_not_sync_and_send.rs:9:12
11+
|
12+
9 | pub struct Counter {
13+
| ^^^^^^^
14+
note: required by a bound in `_::{closure#0}::assert_impl_all`
15+
--> $OUT_DIR[uniffi_uitests]/counter.uniffi.rs
16+
|
17+
| #[::uniffi::derive_object_for_udl]
18+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
19+
= note: this error originates in the macro `uniffi::deps::static_assertions::assert_impl_all` which comes from the expansion of the attribute macro `::uniffi::derive_object_for_udl` (in Nightly builds, run with -Z macro-backtrace for more info)
20+
21+
error[E0277]: `Cell<u32>` cannot be shared between threads safely
22+
--> $OUT_DIR[uniffi_uitests]/counter.uniffi.rs
23+
|
24+
| struct r#Counter { }
25+
| ^^^^^^^^^ `Cell<u32>` cannot be shared between threads safely
26+
|
27+
= help: within `Counter`, the trait `Sync` is not implemented for `Cell<u32>`, which is required by `Counter: Sync`
828
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU32` instead
929
note: required because it appears within the type `Counter`
1030
--> tests/ui/interface_not_sync_and_send.rs:9:12
@@ -23,7 +43,27 @@ error[E0277]: `Cell<u32>` cannot be shared between threads safely
2343
27 | pub struct ProcMacroCounter {
2444
| ^^^^^^^^^^^^^^^^ `Cell<u32>` cannot be shared between threads safely
2545
|
26-
= help: within `ProcMacroCounter`, the trait `Sync` is not implemented for `Cell<u32>`
46+
= help: within `ProcMacroCounter`, the trait `Sync` is not implemented for `Cell<u32>`, which is required by `ProcMacroCounter: Sync`
47+
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU32` instead
48+
note: required because it appears within the type `ProcMacroCounter`
49+
--> tests/ui/interface_not_sync_and_send.rs:27:12
50+
|
51+
27 | pub struct ProcMacroCounter {
52+
| ^^^^^^^^^^^^^^^^
53+
note: required by a bound in `_::{closure#0}::assert_impl_all`
54+
--> tests/ui/interface_not_sync_and_send.rs:26:10
55+
|
56+
26 | #[derive(uniffi::Object)]
57+
| ^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
58+
= note: this error originates in the macro `uniffi::deps::static_assertions::assert_impl_all` which comes from the expansion of the derive macro `uniffi::Object` (in Nightly builds, run with -Z macro-backtrace for more info)
59+
60+
error[E0277]: `Cell<u32>` cannot be shared between threads safely
61+
--> tests/ui/interface_not_sync_and_send.rs:27:12
62+
|
63+
27 | pub struct ProcMacroCounter {
64+
| ^^^^^^^^^^^^^^^^ `Cell<u32>` cannot be shared between threads safely
65+
|
66+
= help: within `ProcMacroCounter`, the trait `Sync` is not implemented for `Cell<u32>`, which is required by `ProcMacroCounter: Sync`
2767
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU32` instead
2868
note: required because it appears within the type `ProcMacroCounter`
2969
--> tests/ui/interface_not_sync_and_send.rs:27:12

fixtures/uitests/tests/ui/interface_trait_not_sync_and_send.stderr

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
error[E0277]: `dyn Trait` cannot be shared between threads safely
2+
--> $OUT_DIR[uniffi_uitests]/trait.uniffi.rs
3+
|
4+
| #[::uniffi::export_for_udl]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Trait` cannot be shared between threads safely
6+
|
7+
= help: the trait `Sync` is not implemented for `dyn Trait`
8+
note: required by a bound in `_::{closure#0}::assert_impl_all`
9+
--> $OUT_DIR[uniffi_uitests]/trait.uniffi.rs
10+
|
11+
| #[::uniffi::export_for_udl]
12+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
13+
= note: this error originates in the attribute macro `::uniffi::export_for_udl` (in Nightly builds, run with -Z macro-backtrace for more info)
14+
15+
error[E0277]: `dyn Trait` cannot be sent between threads safely
16+
--> $OUT_DIR[uniffi_uitests]/trait.uniffi.rs
17+
|
18+
| #[::uniffi::export_for_udl]
19+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Trait` cannot be sent between threads safely
20+
|
21+
= help: the trait `Send` is not implemented for `dyn Trait`
22+
note: required by a bound in `_::{closure#0}::assert_impl_all`
23+
--> $OUT_DIR[uniffi_uitests]/trait.uniffi.rs
24+
|
25+
| #[::uniffi::export_for_udl]
26+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
27+
= note: this error originates in the attribute macro `::uniffi::export_for_udl` (in Nightly builds, run with -Z macro-backtrace for more info)
28+
129
error[E0277]: `(dyn Trait + 'static)` cannot be shared between threads safely
230
--> $OUT_DIR[uniffi_uitests]/trait.uniffi.rs
331
|
@@ -26,6 +54,34 @@ note: required by a bound in `FfiConverterArc`
2654
| ^^^^ required by this bound in `FfiConverterArc`
2755
= note: this error originates in the attribute macro `::uniffi::export_for_udl` (in Nightly builds, run with -Z macro-backtrace for more info)
2856

57+
error[E0277]: `dyn ProcMacroTrait` cannot be shared between threads safely
58+
--> tests/ui/interface_trait_not_sync_and_send.rs:11:1
59+
|
60+
11 | #[uniffi::export]
61+
| ^^^^^^^^^^^^^^^^^ `dyn ProcMacroTrait` cannot be shared between threads safely
62+
|
63+
= help: the trait `Sync` is not implemented for `dyn ProcMacroTrait`
64+
note: required by a bound in `_::{closure#0}::assert_impl_all`
65+
--> tests/ui/interface_trait_not_sync_and_send.rs:11:1
66+
|
67+
11 | #[uniffi::export]
68+
| ^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
69+
= note: this error originates in the attribute macro `uniffi::export` (in Nightly builds, run with -Z macro-backtrace for more info)
70+
71+
error[E0277]: `dyn ProcMacroTrait` cannot be sent between threads safely
72+
--> tests/ui/interface_trait_not_sync_and_send.rs:11:1
73+
|
74+
11 | #[uniffi::export]
75+
| ^^^^^^^^^^^^^^^^^ `dyn ProcMacroTrait` cannot be sent between threads safely
76+
|
77+
= help: the trait `Send` is not implemented for `dyn ProcMacroTrait`
78+
note: required by a bound in `_::{closure#0}::assert_impl_all`
79+
--> tests/ui/interface_trait_not_sync_and_send.rs:11:1
80+
|
81+
11 | #[uniffi::export]
82+
| ^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
83+
= note: this error originates in the attribute macro `uniffi::export` (in Nightly builds, run with -Z macro-backtrace for more info)
84+
2985
error[E0277]: `(dyn ProcMacroTrait + 'static)` cannot be shared between threads safely
3086
--> tests/ui/interface_trait_not_sync_and_send.rs:11:1
3187
|

fixtures/uitests/tests/ui/invalid_types_in_signatures.stderr

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,28 @@ error[E0277]: the trait bound `Result<(), ErrorType>: Lift<UniFfiTag>` is not sa
1616
and $N others
1717
= note: this error originates in the attribute macro `uniffi::export` (in Nightly builds, run with -Z macro-backtrace for more info)
1818

19+
error[E0277]: the trait bound `Result<(), ErrorType>: Lift<UniFfiTag>` is not satisfied
20+
--> tests/ui/invalid_types_in_signatures.rs:18:25
21+
|
22+
18 | pub fn input_result(_r: Result<(), ErrorType>) { }
23+
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Lift<UniFfiTag>` is not implemented for `Result<(), ErrorType>`
24+
|
25+
= help: the following other types implement trait `Lift<UT>`:
26+
bool
27+
i8
28+
i16
29+
i32
30+
i64
31+
u8
32+
u16
33+
u32
34+
and $N others
35+
1936
error[E0277]: the trait bound `Result<(), ErrorType>: Lower<UniFfiTag>` is not satisfied
2037
--> tests/ui/invalid_types_in_signatures.rs:20:1
2138
|
2239
20 | #[uniffi::export]
23-
| ^^^^^^^^^^^^^^^^^ the trait `Lower<UniFfiTag>` is not implemented for `Result<(), ErrorType>`
40+
| ^^^^^^^^^^^^^^^^^ the trait `Lower<UniFfiTag>` is not implemented for `Result<(), ErrorType>`, which is required by `Option<Result<(), ErrorType>>: LowerReturn<UniFfiTag>`
2441
|
2542
= help: the following other types implement trait `Lower<UT>`:
2643
bool
@@ -35,3 +52,22 @@ error[E0277]: the trait bound `Result<(), ErrorType>: Lower<UniFfiTag>` is not s
3552
= note: required for `Option<Result<(), ErrorType>>` to implement `Lower<UniFfiTag>`
3653
= note: required for `Option<Result<(), ErrorType>>` to implement `LowerReturn<UniFfiTag>`
3754
= note: this error originates in the attribute macro `uniffi::export` (in Nightly builds, run with -Z macro-backtrace for more info)
55+
56+
error[E0277]: the trait bound `Result<(), ErrorType>: Lower<UniFfiTag>` is not satisfied
57+
--> tests/ui/invalid_types_in_signatures.rs:21:34
58+
|
59+
21 | pub fn return_option_result() -> Option<Result<(), ErrorType>> {
60+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Lower<UniFfiTag>` is not implemented for `Result<(), ErrorType>`, which is required by `Option<Result<(), ErrorType>>: LowerReturn<UniFfiTag>`
61+
|
62+
= help: the following other types implement trait `Lower<UT>`:
63+
bool
64+
i8
65+
i16
66+
i32
67+
i64
68+
u8
69+
u16
70+
u32
71+
and $N others
72+
= note: required for `Option<Result<(), ErrorType>>` to implement `Lower<UniFfiTag>`
73+
= note: required for `Option<Result<(), ErrorType>>` to implement `LowerReturn<UniFfiTag>`

fixtures/uitests/tests/ui/non_hashable_record_key.stderr

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,54 @@
1+
error[E0277]: the trait bound `f32: std::cmp::Eq` is not satisfied
2+
--> $OUT_DIR[uniffi_uitests]/records.uniffi.rs
3+
|
4+
| uniffi::deps::static_assertions::assert_impl_all!(f32: ::std::cmp::Eq, ::std::hash::Hash); // record<f32, u64>
5+
| ^^^ the trait `std::cmp::Eq` is not implemented for `f32`
6+
|
7+
= help: the following other types implement trait `std::cmp::Eq`:
8+
isize
9+
i8
10+
i16
11+
i32
12+
i64
13+
i128
14+
usize
15+
u8
16+
and $N others
17+
note: required by a bound in `assert_impl_all`
18+
--> $OUT_DIR[uniffi_uitests]/records.uniffi.rs
19+
|
20+
| uniffi::deps::static_assertions::assert_impl_all!(f32: ::std::cmp::Eq, ::std::hash::Hash); // record<f32, u64>
21+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
22+
= note: this error originates in the macro `uniffi::deps::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
23+
24+
error[E0277]: the trait bound `f32: Hash` is not satisfied
25+
--> $OUT_DIR[uniffi_uitests]/records.uniffi.rs
26+
|
27+
| uniffi::deps::static_assertions::assert_impl_all!(f32: ::std::cmp::Eq, ::std::hash::Hash); // record<f32, u64>
28+
| ^^^ the trait `Hash` is not implemented for `f32`
29+
|
30+
= help: the following other types implement trait `Hash`:
31+
isize
32+
i8
33+
i16
34+
i32
35+
i64
36+
i128
37+
usize
38+
u8
39+
and $N others
40+
note: required by a bound in `assert_impl_all`
41+
--> $OUT_DIR[uniffi_uitests]/records.uniffi.rs
42+
|
43+
| uniffi::deps::static_assertions::assert_impl_all!(f32: ::std::cmp::Eq, ::std::hash::Hash); // record<f32, u64>
44+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
45+
= note: this error originates in the macro `uniffi::deps::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
46+
147
error[E0277]: the trait bound `f32: Hash` is not satisfied
248
--> $OUT_DIR[uniffi_uitests]/records.uniffi.rs
349
|
450
| #[::uniffi::export_for_udl]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Hash` is not implemented for `f32`
51+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Hash` is not implemented for `f32`, which is required by `HashMap<f32, u64>: LowerReturn<UniFfiTag>`
652
|
753
= help: the following other types implement trait `Hash`:
854
isize
@@ -22,7 +68,7 @@ error[E0277]: the trait bound `f32: std::cmp::Eq` is not satisfied
2268
--> $OUT_DIR[uniffi_uitests]/records.uniffi.rs
2369
|
2470
| #[::uniffi::export_for_udl]
25-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `f32`
71+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `f32`, which is required by `HashMap<f32, u64>: LowerReturn<UniFfiTag>`
2672
|
2773
= help: the following other types implement trait `std::cmp::Eq`:
2874
isize

fixtures/uitests/tests/ui/trait_methods_no_trait.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ error[E0277]: `TraitMethods` doesn't implement `std::fmt::Display`
1919
| #[uniffi::export(Display)]
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `TraitMethods` cannot be formatted with the default formatter
2121
|
22-
= help: the trait `std::fmt::Display` is not implemented for `TraitMethods`
22+
= help: the trait `std::fmt::Display` is not implemented for `TraitMethods`, which is required by `&TraitMethods: std::fmt::Display`
2323
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
2424
= note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the attribute macro `uniffi::export` (in Nightly builds, run with -Z macro-backtrace for more info)

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# * ./.circleci/config.yml which also specifies the rust versions used in CI.
66

77
[toolchain]
8-
channel = "1.72.0"
8+
channel = "1.77.1"
99
targets = [
1010
"aarch64-linux-android",
1111
"armv7-linux-androideabi",

0 commit comments

Comments
 (0)