From 36ae51e12e519918946f88d1444454fc92543f2d Mon Sep 17 00:00:00 2001 From: Tarik Eshaq Date: Mon, 20 Dec 2021 10:48:14 -0700 Subject: [PATCH] Upgrade rust to 1.57 (#4723) * upgrades rust to 1.57 * fixes clippy * Document where to find the latest version moz-central uses * an attempt to fix broken cargo bench * Uses _ instead of dead_code where possible * runs cargo update --- .circleci/config.yml | 9 -- Cargo.lock | 85 ++++++++++--------- components/autofill/src/db/addresses.rs | 2 +- components/fxa-client/src/internal/push.rs | 3 + components/logins/src/error.rs | 2 +- components/nimbus/src/persistence.rs | 22 ++--- components/places/src/bookmark_sync/engine.rs | 46 +++++----- components/places/src/storage/bookmarks.rs | 44 +++++----- components/support/nimbus-fml/src/parser.rs | 4 +- .../support/rc_crypto/nss/src/pk11/types.rs | 3 + components/sync15/src/request.rs | 4 +- components/sync15/src/state.rs | 4 +- components/sync15/src/status.rs | 5 +- .../webext-storage/src/sync/incoming.rs | 4 +- components/webext-storage/src/sync/mod.rs | 6 +- docs/design/rust-versions.md | 3 + .../places-autocomplete/src/autocomplete.rs | 46 +++++----- megazords/ios-rust/build-xcframework.sh | 3 - rust-toolchain | 3 +- 19 files changed, 149 insertions(+), 149 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 06da12b5ef..29e1008897 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -364,15 +364,6 @@ jobs: - store_artifacts: path: raw_xcodebuild.log destination: logs/raw_xcodebuild.log - - run: - name: Install Rust Nightly - command: | - # For now we need the nightly toolchain to build for the M1 simulator. - rustup install nightly - # For now we need to build the Rust stdlib from source for the M1 simulator. - rustup component add rust-src --toolchain nightly-x86_64-apple-darwin - rustup toolchain add nightly --profile minimal - rustup target add aarch64-apple-ios-sim --toolchain nightly - run: name: Build XCFramework archive command: | diff --git a/Cargo.lock b/Cargo.lock index 6f389ecf13..b72858de8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -638,7 +638,7 @@ checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ "bstr", "csv-core", - "itoa", + "itoa 0.4.8", "ryu", "serde", ] @@ -1088,42 +1088,42 @@ checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" [[package]] name = "futures-channel" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27" +checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445" +checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" [[package]] name = "futures-io" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11" +checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" [[package]] name = "futures-sink" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af" +checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" [[package]] name = "futures-task" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12" +checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" [[package]] name = "futures-util" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e" +checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" dependencies = [ "futures-core", "futures-io", @@ -1374,7 +1374,7 @@ checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" dependencies = [ "bytes", "fnv", - "itoa", + "itoa 0.4.8", ] [[package]] @@ -1436,7 +1436,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa", + "itoa 0.4.8", "pin-project-lite", "socket2", "tokio", @@ -1546,6 +1546,12 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +[[package]] +name = "itoa" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" + [[package]] name = "jexl-eval" version = "0.1.7" @@ -1590,7 +1596,7 @@ dependencies = [ "fancy-regex", "fraction", "iso8601", - "itoa", + "itoa 0.4.8", "lazy_static", "num-cmp", "parking_lot 0.11.2", @@ -1645,9 +1651,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.111" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e167738f1866a7ec625567bae89ca0d44477232a4f7c52b1c7f2adc2c98804f" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "libsqlite3-sys" @@ -1981,9 +1987,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188" +checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" dependencies = [ "bitflags", "cc", @@ -2198,9 +2204,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" [[package]] name = "oorandom" @@ -2236,9 +2242,9 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-src" -version = "111.16.0+1.1.1l" +version = "111.17.0+1.1.1m" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab2173f69416cf3ec12debb5823d244127d23a9b127d5a5189aa97c5fa2859f" +checksum = "05d6a336abd10814198f66e2a91ccd7336611f30334119ca8ce300536666fcf4" dependencies = [ "cc", ] @@ -2592,9 +2598,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a" +checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1" dependencies = [ "unicode-xid", ] @@ -3182,9 +3188,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.131" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ad69dfbd3e45369132cc64e6748c2d65cdfb001a2b1c232d128b4ad60561c1" +checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008" dependencies = [ "serde_derive", ] @@ -3201,9 +3207,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.131" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b710a83c4e0dff6a3d511946b95274ad9ca9e5d3ae497b63fda866ac955358d2" +checksum = "ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276" dependencies = [ "proc-macro2", "quote", @@ -3212,20 +3218,20 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527" +checksum = "bcbd0344bc6533bc7ec56df11d42fb70f1b912351c0825ccb7211b59d8af7cf5" dependencies = [ - "itoa", + "itoa 1.0.1", "ryu", "serde", ] [[package]] name = "serde_test" -version = "1.0.131" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfaa01d46254ba300fb5920e781e9eae209daac68b68b26cdd678da7bd4fc5c4" +checksum = "b138b0ce2635ff4052c489bd0a2c9a7e10de455d6b67e4fa29b5455781121300" dependencies = [ "serde", ] @@ -3237,7 +3243,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" dependencies = [ "dtoa", - "itoa", + "itoa 0.4.8", "serde", "url", ] @@ -3249,7 +3255,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" dependencies = [ "form_urlencoded", - "itoa", + "itoa 0.4.8", "ryu", "serde", ] @@ -3677,11 +3683,10 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144" +checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" dependencies = [ - "autocfg", "bytes", "libc", "memchr", diff --git a/components/autofill/src/db/addresses.rs b/components/autofill/src/db/addresses.rs index d78dfc9474..fe9d2eb825 100644 --- a/components/autofill/src/db/addresses.rs +++ b/components/autofill/src/db/addresses.rs @@ -96,7 +96,7 @@ pub(crate) fn get_address(conn: &Connection, guid: &Guid) -> Result Error::NoSuchRecord(guid.to_string()), e => e.into(), diff --git a/components/fxa-client/src/internal/push.rs b/components/fxa-client/src/internal/push.rs index c0c77d7e5d..6823f2b075 100644 --- a/components/fxa-client/src/internal/push.rs +++ b/components/fxa-client/src/internal/push.rs @@ -124,6 +124,9 @@ pub enum PushPayload { Unknown, } +// Some of this structs fields are not read, except +// when deserialized, we mark them as dead_code +#[allow(dead_code)] #[derive(Debug, Deserialize)] pub struct CommandReceivedPushPayload { command: String, diff --git a/components/logins/src/error.rs b/components/logins/src/error.rs index 845ac540b7..8af8290cef 100644 --- a/components/logins/src/error.rs +++ b/components/logins/src/error.rs @@ -8,7 +8,7 @@ use std::ffi::OsString; // into `error_support`. macro_rules! throw { ($e:expr) => { - return Err(Into::into($e)); + return Err(Into::into($e)) }; } diff --git a/components/nimbus/src/persistence.rs b/components/nimbus/src/persistence.rs index 3102282e3a..6fa05f964c 100644 --- a/components/nimbus/src/persistence.rs +++ b/components/nimbus/src/persistence.rs @@ -141,24 +141,24 @@ impl SingleStore { pub fn put serde::Deserialize<'de>>( &self, - mut writer: &mut Writer, + writer: &mut Writer, key: &str, persisted_data: &T, ) -> Result<()> { let persisted_json = serde_json::to_string(persisted_data)?; self.store - .put(&mut writer, key, &rkv::Value::Json(&persisted_json))?; + .put(writer, key, &rkv::Value::Json(&persisted_json))?; Ok(()) } #[allow(dead_code)] - pub fn delete(&self, mut writer: &mut Writer, key: &str) -> Result<()> { - self.store.delete(&mut writer, key)?; + pub fn delete(&self, writer: &mut Writer, key: &str) -> Result<()> { + self.store.delete(writer, key)?; Ok(()) } - pub fn clear(&self, mut writer: &mut Writer) -> Result<()> { - self.store.clear(&mut writer)?; + pub fn clear(&self, writer: &mut Writer) -> Result<()> { + self.store.clear(writer)?; Ok(()) } @@ -336,7 +336,7 @@ impl Database { /// to assume that this is unrecoverable and wipe the database, removing /// people from any existing enrollments and blowing away their experiment /// history, so that they don't get left in an inconsistent state. - fn migrate_v1_to_v2(&self, mut writer: &mut Writer) -> Result<()> { + fn migrate_v1_to_v2(&self, writer: &mut Writer) -> Result<()> { log::info!("Upgrading from version 1 to version 2"); // use try_collect_all to read everything except records that serde @@ -392,16 +392,16 @@ impl Database { log::debug!("updated enrollments = {:?}", updated_enrollments); // rewrite both stores - self.experiment_store.clear(&mut writer)?; + self.experiment_store.clear(writer)?; for experiment in updated_experiments { self.experiment_store - .put(&mut writer, &experiment.slug, &experiment)?; + .put(writer, &experiment.slug, &experiment)?; } - self.enrollment_store.clear(&mut writer)?; + self.enrollment_store.clear(writer)?; for enrollment in updated_enrollments { self.enrollment_store - .put(&mut writer, &enrollment.slug, &enrollment)?; + .put(writer, &enrollment.slug, &enrollment)?; } log::debug!("exiting migrate_v1_to_v2"); diff --git a/components/places/src/bookmark_sync/engine.rs b/components/places/src/bookmark_sync/engine.rs index fbcb9cda75..ff02eb8e36 100644 --- a/components/places/src/bookmark_sync/engine.rs +++ b/components/places/src/bookmark_sync/engine.rs @@ -1929,36 +1929,36 @@ mod tests { let node = tree .node_for_guid(&"qqVTRWhLBOu3".into()) .expect("should exist"); - assert_eq!(node.needs_merge, true); + assert!(node.needs_merge); assert_eq!(node.validity, Validity::Valid); assert_eq!(node.level(), 2); - assert_eq!(node.is_syncable(), true); + assert!(node.is_syncable()); let node = tree .node_for_guid(&BookmarkRootGuid::Unfiled.as_guid().as_str().into()) .expect("should exist"); - assert_eq!(node.needs_merge, true); + assert!(node.needs_merge); assert_eq!(node.validity, Validity::Valid); assert_eq!(node.level(), 1); - assert_eq!(node.is_syncable(), true); + assert!(node.is_syncable()); let node = tree .node_for_guid(&BookmarkRootGuid::Menu.as_guid().as_str().into()) .expect("should exist"); - assert_eq!(node.needs_merge, false); + assert!(!node.needs_merge); assert_eq!(node.validity, Validity::Valid); assert_eq!(node.level(), 1); - assert_eq!(node.is_syncable(), true); + assert!(node.is_syncable()); let node = tree .node_for_guid(&BookmarkRootGuid::Root.as_guid().as_str().into()) .expect("should exist"); assert_eq!(node.validity, Validity::Valid); assert_eq!(node.level(), 0); - assert_eq!(node.is_syncable(), false); + assert!(!node.is_syncable()); // We should have changes. - assert_eq!(db_has_changes(&conn).unwrap(), true); + assert!(db_has_changes(&conn).unwrap()); Ok(()) } @@ -2003,38 +2003,38 @@ mod tests { let node = tree .node_for_guid(&"bookmark1___".into()) .expect("should exist"); - assert_eq!(node.needs_merge, true); + assert!(node.needs_merge); assert_eq!(node.level(), 2); - assert_eq!(node.is_syncable(), true); + assert!(node.is_syncable()); assert_eq!(node.age, 10000); let node = tree .node_for_guid(&BookmarkRootGuid::Unfiled.as_guid().as_str().into()) .expect("should exist"); - assert_eq!(node.needs_merge, true); + assert!(node.needs_merge); assert_eq!(node.level(), 1); - assert_eq!(node.is_syncable(), true); + assert!(node.is_syncable()); let node = tree .node_for_guid(&BookmarkRootGuid::Menu.as_guid().as_str().into()) .expect("should exist"); - assert_eq!(node.needs_merge, false); + assert!(!node.needs_merge); assert_eq!(node.level(), 1); - assert_eq!(node.is_syncable(), true); + assert!(node.is_syncable()); let node = tree .node_for_guid(&BookmarkRootGuid::Root.as_guid().as_str().into()) .expect("should exist"); - assert_eq!(node.needs_merge, false); + assert!(!node.needs_merge); assert_eq!(node.level(), 0); - assert_eq!(node.is_syncable(), false); + assert!(!node.is_syncable()); // hard to know the exact age of the root, but we know the max. let max_dur = SystemTime::now().duration_since(now).unwrap(); let max_age = max_dur.as_secs() as i64 * 1000 + i64::from(max_dur.subsec_millis()); assert!(node.age <= max_age); // We should have changes. - assert_eq!(db_has_changes(&syncer).unwrap(), true); + assert!(db_has_changes(&syncer).unwrap()); Ok(()) } @@ -2909,11 +2909,11 @@ mod tests { let info_for_a = get_raw_bookmark(&writer, &guid_for_a) .expect("Should fetch info for A") .unwrap(); - assert_eq!(info_for_a.sync_change_counter, 2); + assert_eq!(info_for_a._sync_change_counter, 2); let info_for_unfiled = get_raw_bookmark(&writer, &BookmarkRootGuid::Unfiled.as_guid()) .expect("Should fetch info for unfiled") .unwrap(); - assert_eq!(info_for_unfiled.sync_change_counter, 2); + assert_eq!(info_for_unfiled._sync_change_counter, 2); engine .sync_finished( @@ -2929,11 +2929,11 @@ mod tests { let info_for_a = get_raw_bookmark(&writer, &guid_for_a) .expect("Should fetch info for A") .unwrap(); - assert_eq!(info_for_a.sync_change_counter, 0); + assert_eq!(info_for_a._sync_change_counter, 0); let info_for_unfiled = get_raw_bookmark(&writer, &BookmarkRootGuid::Unfiled.as_guid()) .expect("Should fetch info for unfiled") .unwrap(); - assert_eq!(info_for_unfiled.sync_change_counter, 0); + assert_eq!(info_for_unfiled._sync_change_counter, 0); let mut tags_for_c = tags::get_tags_for_url( &writer, @@ -4322,8 +4322,8 @@ mod tests { let bm = get_raw_bookmark(&writer, &guid.into()) .expect("must work") .expect("must exist"); - assert_eq!(bm.sync_status, SyncStatus::Normal, "{}", guid); - assert_eq!(bm.sync_change_counter, 0, "{}", guid); + assert_eq!(bm._sync_status, SyncStatus::Normal, "{}", guid); + assert_eq!(bm._sync_change_counter, 0, "{}", guid); } // And bookmarkEEEE wasn't on the server, so should be outgoing, and // it's parent too. diff --git a/components/places/src/storage/bookmarks.rs b/components/places/src/storage/bookmarks.rs index ada5182d8a..fb558053f3 100644 --- a/components/places/src/storage/bookmarks.rs +++ b/components/places/src/storage/bookmarks.rs @@ -1119,11 +1119,11 @@ pub fn insert_tree(db: &PlacesDb, tree: &FolderNode) -> Result<()> { #[derive(Debug)] struct FetchedTreeRow { level: u32, - id: RowId, + _id: RowId, guid: SyncGuid, // parent and parent_guid are Option<> only to handle the root - we would // assert but they aren't currently used. - parent: Option, + _parent: Option, parent_guid: Option, node_type: BookmarkType, position: u32, @@ -1138,9 +1138,9 @@ impl FetchedTreeRow { let url = row.get::<_, Option>("url")?; Ok(Self { level: row.get("level")?, - id: row.get::<_, RowId>("id")?, + _id: row.get::<_, RowId>("id")?, guid: row.get::<_, String>("guid")?.into(), - parent: row.get::<_, Option>("parent")?, + _parent: row.get::<_, Option>("parent")?, parent_guid: row .get::<_, Option>("parentGuid")? .map(SyncGuid::from), @@ -1167,8 +1167,8 @@ fn inflate( .and_then(|guid| pseudo_tree.remove(guid)) { parent.children = children; - for mut child in &mut parent.children { - inflate(&mut child, pseudo_tree); + for child in &mut parent.children { + inflate(child, pseudo_tree); } } } @@ -1370,10 +1370,10 @@ pub(crate) struct RawBookmark { pub date_added: Timestamp, pub date_modified: Timestamp, pub guid: SyncGuid, - pub sync_status: SyncStatus, - pub sync_change_counter: u32, + pub _sync_status: SyncStatus, + pub _sync_change_counter: u32, pub child_count: u32, - pub grandparent_id: Option, + pub _grandparent_id: Option, } impl RawBookmark { @@ -1396,12 +1396,12 @@ impl RawBookmark { date_added: row.get("dateAdded")?, date_modified: row.get("lastModified")?, guid: row.get::<_, String>("guid")?.into(), - sync_status: SyncStatus::from_u8(row.get::<_, u8>("_syncStatus")?), - sync_change_counter: row + _sync_status: SyncStatus::from_u8(row.get::<_, u8>("_syncStatus")?), + _sync_change_counter: row .get::<_, Option>("syncChangeCounter")? .unwrap_or_default(), child_count: row.get("_childCount")?, - grandparent_id: row.get("_grandparentId")?, + _grandparent_id: row.get("_grandparentId")?, }) } } @@ -1674,14 +1674,14 @@ mod tests { assert_eq!(rb.position, 0); assert_eq!(rb.title, Some("the title".into())); assert_eq!(rb.url, Some(url)); - assert_eq!(rb.sync_status, SyncStatus::New); - assert_eq!(rb.sync_change_counter, 1); + assert_eq!(rb._sync_status, SyncStatus::New); + assert_eq!(rb._sync_change_counter, 1); assert!(global_change_tracker.changed()); assert_eq!(rb.child_count, 0); let unfiled = get_raw_bookmark(&conn, &BookmarkRootGuid::Unfiled.as_guid())? .expect("should get unfiled"); - assert_eq!(unfiled.sync_change_counter, 1); + assert_eq!(unfiled._sync_change_counter, 1); Ok(()) } @@ -2096,7 +2096,7 @@ mod tests { )?; let bm = get_raw_bookmark(&conn, &guid)?.expect("should exist"); assert_eq!(bm.title, Some("the bookmark".to_string())); - assert_eq!(bm.sync_change_counter, 0); + assert_eq!(bm._sync_change_counter, 0); // Update to the same value is still not a change. update_bookmark( @@ -2110,7 +2110,7 @@ mod tests { )?; let bm = get_raw_bookmark(&conn, &guid)?.expect("should exist"); assert_eq!(bm.title, Some("the bookmark".to_string())); - assert_eq!(bm.sync_change_counter, 0); + assert_eq!(bm._sync_change_counter, 0); // Update to an empty string sets it to null update_bookmark( @@ -2124,7 +2124,7 @@ mod tests { )?; let bm = get_raw_bookmark(&conn, &guid)?.expect("should exist"); assert_eq!(bm.title, None); - assert_eq!(bm.sync_change_counter, 1); + assert_eq!(bm._sync_change_counter, 1); Ok(()) } @@ -2569,15 +2569,15 @@ mod tests { let bmk = get_raw_bookmark(&conn, &"bookmarkAAAA".into())? .expect("Should fetch A before resetting"); - assert_eq!(bmk.sync_change_counter, 0); - assert_eq!(bmk.sync_status, SyncStatus::Normal); + assert_eq!(bmk._sync_change_counter, 0); + assert_eq!(bmk._sync_status, SyncStatus::Normal); bookmark_sync::reset(&conn, &EngineSyncAssociation::Disconnected)?; let bmk = get_raw_bookmark(&conn, &"bookmarkAAAA".into())? .expect("Should fetch A after resetting"); - assert_eq!(bmk.sync_change_counter, 1); - assert_eq!(bmk.sync_status, SyncStatus::New); + assert_eq!(bmk._sync_change_counter, 1); + assert_eq!(bmk._sync_status, SyncStatus::New); // Ensure we reset Sync metadata, too. let global = get_meta::(&conn, GLOBAL_SYNCID_META_KEY)?; diff --git a/components/support/nimbus-fml/src/parser.rs b/components/support/nimbus-fml/src/parser.rs index 4cdf3fc3e4..bb746c5871 100644 --- a/components/support/nimbus-fml/src/parser.rs +++ b/components/support/nimbus-fml/src/parser.rs @@ -463,7 +463,7 @@ pub struct Parser { enums: Vec, objects: Vec, features: Vec, - channels: Vec, + _channels: Vec, } impl Parser { @@ -480,7 +480,7 @@ impl Parser { enums, objects, features, - channels: manifest.channels, + _channels: manifest.channels, }) } diff --git a/components/support/rc_crypto/nss/src/pk11/types.rs b/components/support/rc_crypto/nss/src/pk11/types.rs index b6410616e5..32290b2242 100644 --- a/components/support/rc_crypto/nss/src/pk11/types.rs +++ b/components/support/rc_crypto/nss/src/pk11/types.rs @@ -58,6 +58,9 @@ unsafe fn pk11_destroy_context_true(context: *mut nss_sys::PK11Context) { // Trait for types that have PCKS#11 attributes that are readable. See // https://searchfox.org/mozilla-central/rev/8ed8474757695cdae047150a0eaf94a5f1c96dbe/security/nss/lib/pk11wrap/pk11pub.h#842-864 +/// # Safety +/// Unsafe since it needs to call [`nss_sys::PK11_ReadRawAttribute`] which is +/// a C NSS function, and thus inherently unsafe to call pub(crate) unsafe trait Pkcs11Object: ScopedPtr { const PK11_OBJECT_TYPE: nss_sys::PK11ObjectType; fn read_raw_attribute( diff --git a/components/sync15/src/request.rs b/components/sync15/src/request.rs index 2e21669e98..9a9305950a 100644 --- a/components/sync15/src/request.rs +++ b/components/sync15/src/request.rs @@ -548,7 +548,7 @@ mod test { #[derive(Debug, Clone)] struct PostedData { body: String, - xius: ServerTimestamp, + _xius: ServerTimestamp, batch: Option, commit: bool, payload_bytes: usize, @@ -609,7 +609,7 @@ mod test { let mut post = PostedData { body: String::from_utf8(body.into()).expect("Posted invalid utf8..."), batch: batch.clone(), - xius, + _xius: xius, commit, payload_bytes: 0, records: 0, diff --git a/components/sync15/src/state.rs b/components/sync15/src/state.rs index 247216e9c3..d0c9dd0cc0 100644 --- a/components/sync15/src/state.rs +++ b/components/sync15/src/state.rs @@ -873,7 +873,7 @@ mod tests { fn do_test( client: &dyn SetupStorageClient, root_key: &KeyBundle, - mut pgs: &mut PersistedGlobalState, + pgs: &mut PersistedGlobalState, engine_updates: Option<&HashMap>, old_state: GlobalState, expected_states: &[&str], @@ -881,7 +881,7 @@ mod tests { let mut state_machine = SetupStateMachine::for_full_sync( client, root_key, - &mut pgs, + pgs, engine_updates, &NeverInterrupts, ); diff --git a/components/sync15/src/status.rs b/components/sync15/src/status.rs index b88c710f02..df2de401cc 100644 --- a/components/sync15/src/status.rs +++ b/components/sync15/src/status.rs @@ -96,10 +96,7 @@ impl SyncResult { pub(crate) fn set_sync_after(&mut self, backoff_duration: Duration) { let now = SystemTime::now(); let toplevel = advance_backoff(now + backoff_duration, &self.result); - let sync_after = self - .engine_results - .values() - .fold(toplevel, |b, r| advance_backoff(b, r)); + let sync_after = self.engine_results.values().fold(toplevel, advance_backoff); if sync_after <= now { self.next_sync_after = None; } else { diff --git a/components/webext-storage/src/sync/incoming.rs b/components/webext-storage/src/sync/incoming.rs index 829d639df1..06bdc7d7f3 100644 --- a/components/webext-storage/src/sync/incoming.rs +++ b/components/webext-storage/src/sync/incoming.rs @@ -520,7 +520,7 @@ mod tests { key: $key.to_string(), old_value: Some(json!($old)), new_value: None, - }; + } }; ($key:literal, None, $new:tt) => { StorageValueChange { @@ -534,7 +534,7 @@ mod tests { key: $key.to_string(), old_value: Some(json!($old)), new_value: Some(json!($new)), - }; + } }; } macro_rules! changes { diff --git a/components/webext-storage/src/sync/mod.rs b/components/webext-storage/src/sync/mod.rs index f45ebb389e..42bb8ed53b 100644 --- a/components/webext-storage/src/sync/mod.rs +++ b/components/webext-storage/src/sync/mod.rs @@ -272,21 +272,21 @@ mod tests { key: $key.to_string(), old_value: Some(json!($old)), new_value: None, - }; + } }; ($key:literal, None, $new:tt) => { StorageValueChange { key: $key.to_string(), old_value: None, new_value: Some(json!($new)), - }; + } }; ($key:literal, $old:tt, $new:tt) => { StorageValueChange { key: $key.to_string(), old_value: Some(json!($old)), new_value: Some(json!($new)), - }; + } }; } macro_rules! changes { diff --git a/docs/design/rust-versions.md b/docs/design/rust-versions.md index 5061181b46..a012a8495f 100644 --- a/docs/design/rust-versions.md +++ b/docs/design/rust-versions.md @@ -20,6 +20,9 @@ but everything in the future is documented as "estimated". Ultimately though, that page defines 2 Rust versions - "Uses" and "Requires", and our policy revolves around these. +There is a [Meta bug on Bugzilla](https://bugzilla.mozilla.org/show_bug.cgi?id=1504858) that keeps +track of the latest versions mozilla-central uses as they are upgraded. + # application-services Rust version policy Our official Rust version policy is: diff --git a/examples/places-autocomplete/src/autocomplete.rs b/examples/places-autocomplete/src/autocomplete.rs index 6f9b85876a..263c477346 100644 --- a/examples/places-autocomplete/src/autocomplete.rs +++ b/examples/places-autocomplete/src/autocomplete.rs @@ -24,24 +24,24 @@ struct ImportPlacesOptions { #[derive(Default, Debug, Clone)] struct LegacyPlaceVisit { - id: i64, + _id: i64, date: i64, visit_type: u8, - from_visit: i64, + _from_visit: i64, } #[derive(Default, Debug, Clone)] struct LegacyPlace { id: i64, - guid: String, + _guid: String, url: String, - title: Option, - hidden: i64, - typed: i64, - last_visit_date: i64, - visit_count: i64, - description: Option, - preview_image_url: Option, + _title: Option, + _hidden: i64, + _typed: i64, + _last_visit_date: i64, + _visit_count: i64, + _description: Option, + _preview_image_url: Option, visits: Vec, } @@ -49,20 +49,20 @@ impl LegacyPlace { pub fn from_row(row: &rusqlite::Row<'_>) -> Self { Self { id: row.get_unwrap("place_id"), - guid: row.get_unwrap("place_guid"), - title: row.get_unwrap("place_title"), + _guid: row.get_unwrap("place_guid"), + _title: row.get_unwrap("place_title"), url: row.get_unwrap("place_url"), - description: row.get_unwrap("place_description"), - preview_image_url: row.get_unwrap("place_preview_image_url"), - typed: row.get_unwrap("place_typed"), - hidden: row.get_unwrap("place_hidden"), - visit_count: row.get_unwrap("place_visit_count"), - last_visit_date: row.get_unwrap("place_last_visit_date"), + _description: row.get_unwrap("place_description"), + _preview_image_url: row.get_unwrap("place_preview_image_url"), + _typed: row.get_unwrap("place_typed"), + _hidden: row.get_unwrap("place_hidden"), + _visit_count: row.get_unwrap("place_visit_count"), + _last_visit_date: row.get_unwrap("place_last_visit_date"), visits: vec![LegacyPlaceVisit { - id: row.get_unwrap("visit_id"), + _id: row.get_unwrap("visit_id"), date: row.get_unwrap("visit_date"), visit_type: row.get_unwrap("visit_type"), - from_visit: row.get_unwrap("visit_from_visit"), + _from_visit: row.get_unwrap("visit_from_visit"), }], } } @@ -74,7 +74,7 @@ impl LegacyPlace { VisitTransition::from_primitive(v.visit_type).unwrap_or(VisitTransition::Link), ) .with_at(types::Timestamp((v.date / 1000) as u64)) - .with_title(self.title.clone()) + .with_title(self._title.clone()) .with_is_remote(rand::random::() < options.remote_probability); places::storage::history::apply_observation_direct(db, obs)?; } @@ -158,10 +158,10 @@ fn import_places( let id: i64 = row.get("place_id")?; if current_place.id == id { current_place.visits.push(LegacyPlaceVisit { - id: row.get("visit_id")?, + _id: row.get("visit_id")?, date: row.get("visit_date")?, visit_type: row.get("visit_type")?, - from_visit: row.get("visit_from_visit")?, + _from_visit: row.get("visit_from_visit")?, }); continue; } diff --git a/megazords/ios-rust/build-xcframework.sh b/megazords/ios-rust/build-xcframework.sh index ddc98e76f9..630034f1e2 100755 --- a/megazords/ios-rust/build-xcframework.sh +++ b/megazords/ios-rust/build-xcframework.sh @@ -97,9 +97,6 @@ CFLAGS_x86_64_apple_ios="-target x86_64-apple-ios" \ cargo_build aarch64-apple-ios # M1 iOS simulator. -# It's currently in Nightly only and requires to build `libstd`. -# We hope this will be available by default in Rust 1.56.0. -BUILD_ARGS=(+nightly "${BUILD_ARGS[@]}" -Z build-std) cargo_build aarch64-apple-ios-sim # TODO: would it be useful to also include desktop builds here? diff --git a/rust-toolchain b/rust-toolchain index 2462f9532f..1465a5f968 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -7,7 +7,7 @@ # supported and used in CI. [toolchain] -channel = "1.55.0" +channel = "1.57.0" targets = [ "aarch64-linux-android", "armv7-linux-androideabi", @@ -15,6 +15,7 @@ targets = [ "x86_64-linux-android", "aarch64-apple-ios", "x86_64-apple-ios", + "aarch64-apple-ios-sim" ] # The "rust-src" component is currently required for building for the M1 iOS simulator. components = ["clippy", "rustfmt", "rust-src"]