Update rust to 1.60.0 and min rust to 1.59.0 (#4904)

This commit is contained in:
Mark Hammond 2022-04-27 14:52:39 +10:00 коммит произвёл GitHub
Родитель 9cf7b7c965
Коммит 6e17d9154a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 49 добавлений и 45 удалений

Просмотреть файл

@ -3,7 +3,7 @@ version: 2.1
# ⚠️ If you add, rename or delete a job here, please also update .mergify.yml! ⚠️ # ⚠️ If you add, rename or delete a job here, please also update .mergify.yml! ⚠️
commands: commands:
# Our policy for updating rust versions is at https://github.com/mozilla/application-services/tree/main/docs/rust-versions.md # Our policy for updating rust versions is at https://github.com/mozilla/application-services/tree/main/docs/design/rust-versions.md
# See also rust-toolchain in the root of this repo, which is used to specify our official target version. # See also rust-toolchain in the root of this repo, which is used to specify our official target version.
setup-rust-target-version: setup-rust-target-version:
steps: steps:
@ -13,7 +13,7 @@ commands:
setup-rust-min-version: setup-rust-min-version:
steps: steps:
# https://searchfox.org/mozilla-central/source/python/mozboot/mozboot/util.py#20 # https://searchfox.org/mozilla-central/source/python/mozboot/mozboot/util.py#20
- run: rustup override set 1.57.0 - run: rustup override set 1.59.0
full-checkout: full-checkout:
steps: steps:

Просмотреть файл

@ -99,7 +99,6 @@ pub(crate) fn get_credit_card(conn: &Connection, guid: &Guid) -> Result<Internal
} }
pub(crate) fn get_all_credit_cards(conn: &Connection) -> Result<Vec<InternalCreditCard>> { pub(crate) fn get_all_credit_cards(conn: &Connection) -> Result<Vec<InternalCreditCard>> {
let credit_cards;
let sql = format!( let sql = format!(
"SELECT "SELECT
{common_cols}, {common_cols},
@ -109,7 +108,7 @@ pub(crate) fn get_all_credit_cards(conn: &Connection) -> Result<Vec<InternalCred
); );
let mut stmt = conn.prepare(&sql)?; let mut stmt = conn.prepare(&sql)?;
credit_cards = stmt let credit_cards = stmt
.query_map([], InternalCreditCard::from_row)? .query_map([], InternalCreditCard::from_row)?
.collect::<std::result::Result<Vec<InternalCreditCard>, _>>()?; .collect::<std::result::Result<Vec<InternalCreditCard>, _>>()?;
Ok(credit_cards) Ok(credit_cards)

Просмотреть файл

@ -2,16 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use crate::client::{http_client::*, SettingsClient};
use crate::{ use crate::{
Branch, BucketConfig, FeatureConfig, RandomizationUnit, Experiment, error::NimbusError, Branch, BucketConfig, Experiment, FeatureConfig, RandomizationUnit,
error::{NimbusError}, RemoteSettingsConfig, SCHEMA_VERSION, RemoteSettingsConfig, SCHEMA_VERSION,
};
use crate::client::{
SettingsClient, http_client::*,
}; };
use mockito::mock; use mockito::mock;
use std::time::{Duration, Instant};
use std::cell::Cell; use std::cell::Cell;
use std::time::{Duration, Instant};
#[test] #[test]
fn test_fetch_experiments_from_schema() { fn test_fetch_experiments_from_schema() {

Просмотреть файл

@ -6,7 +6,7 @@
use crate::{error::Result, Defaults, NimbusError::InternalError}; use crate::{error::Result, Defaults, NimbusError::InternalError};
use serde_json::{json, Value}; use serde_json::{json, Value};
use std::{array::IntoIter, collections::HashMap}; use std::collections::HashMap;
#[cfg(test)] #[cfg(test)]
impl Defaults for &str { impl Defaults for &str {
@ -55,26 +55,31 @@ fn test_defaults_optional() -> Result<()> {
#[test] #[test]
fn test_defaults_hashmap() -> Result<()> { fn test_defaults_hashmap() -> Result<()> {
let a = HashMap::<String, &str>::from_iter(IntoIter::new([ let a = HashMap::<String, &str>::from_iter(
("a".to_string(), "A from a"), [("a".to_string(), "A from a"), ("b".to_string(), "B from a")].into_iter(),
("b".to_string(), "B from a"), );
]));
let b = HashMap::<String, &str>::from_iter(IntoIter::new([ let b = HashMap::<String, &str>::from_iter(
[
("a".to_string(), "AA not replaced"), ("a".to_string(), "AA not replaced"),
("b".to_string(), "errBB merge failed, so omitting"), ("b".to_string(), "errBB merge failed, so omitting"),
("c".to_string(), "CC added"), ("c".to_string(), "CC added"),
("d".to_string(), "errDD not merged, but added"), ("d".to_string(), "errDD not merged, but added"),
])); ]
.into_iter(),
);
let exp = HashMap::<String, &str>::from_iter(IntoIter::new([ let exp = HashMap::<String, &str>::from_iter(
[
("a".to_string(), "A from a"), ("a".to_string(), "A from a"),
// we tried to merge the defaults, but it failed, so we // we tried to merge the defaults, but it failed, so we
// we keep the original (i.e. the experiment rather than the rollout) // we keep the original (i.e. the experiment rather than the rollout)
("b".to_string(), "B from a"), ("b".to_string(), "B from a"),
("c".to_string(), "CC added"), ("c".to_string(), "CC added"),
("d".to_string(), "errDD not merged, but added"), ("d".to_string(), "errDD not merged, but added"),
])); ]
.into_iter(),
);
assert_eq!(a.defaults(&b)?, exp); assert_eq!(a.defaults(&b)?, exp);

Просмотреть файл

@ -159,7 +159,7 @@ pub fn split_after_host_and_port(href: &str) -> (&str, &str) {
let (_, remainder) = split_after_prefix(href); let (_, remainder) = split_after_prefix(href);
let hp_definite_end = let hp_definite_end =
memchr::memchr3(b'/', b'?', b'#', remainder.as_bytes()).unwrap_or_else(|| remainder.len()); memchr::memchr3(b'/', b'?', b'#', remainder.as_bytes()).unwrap_or(remainder.len());
let (before_hp, after_hp) = remainder.split_at(hp_definite_end); let (before_hp, after_hp) = remainder.split_at(hp_definite_end);

Просмотреть файл

@ -2118,7 +2118,7 @@ mod tests {
} }
(true, false) => { (true, false) => {
assert!( assert!(
!fetch_visits(&db, &url, 0)?.is_some(), fetch_visits(&db, &url, 0)?.is_none(),
"Should delete synced page" "Should delete synced page"
); );
assert!( assert!(
@ -2147,7 +2147,7 @@ mod tests {
); );
} }
(false, false) => { (false, false) => {
assert!(!fetch_visits(&db, &url, 0)?.is_some(), "Should delete page"); assert!(fetch_visits(&db, &url, 0)?.is_none(), "Should delete page");
assert!( assert!(
!page_has_tombstone(&db, &info.guid)?, !page_has_tombstone(&db, &info.guid)?,
"Shouldn't insert tombstone for page" "Shouldn't insert tombstone for page"

Просмотреть файл

@ -1370,7 +1370,7 @@ mod tests {
// query by title // query by title
let meta = query(&conn, "child care", 10).expect("query should work"); let meta = query(&conn, "child care", 10).expect("query should work");
assert_eq!(1, meta.len(), "expected exactly one result"); assert_eq!(1, meta.len(), "expected exactly one result");
assert_history_metadata_record!(&meta[0], assert_history_metadata_record!(meta[0],
url "https://www.cbc.ca/news/politics/federal-budget-2021-freeland-zimonjic-1.5991021", url "https://www.cbc.ca/news/politics/federal-budget-2021-freeland-zimonjic-1.5991021",
total_time 20000, total_time 20000,
search_term Some("cbc federal budget 2021"), search_term Some("cbc federal budget 2021"),
@ -1383,7 +1383,7 @@ mod tests {
// query by search term // query by search term
let meta = query(&conn, "string format", 10).expect("query should work"); let meta = query(&conn, "string format", 10).expect("query should work");
assert_eq!(1, meta.len(), "expected exactly one result"); assert_eq!(1, meta.len(), "expected exactly one result");
assert_history_metadata_record!(&meta[0], assert_history_metadata_record!(meta[0],
url "https://stackoverflow.com/questions/37777675/how-to-create-a-formatted-string-out-of-a-literal-in-rust", url "https://stackoverflow.com/questions/37777675/how-to-create-a-formatted-string-out-of-a-literal-in-rust",
total_time 20000, total_time 20000,
search_term Some("rust string format"), search_term Some("rust string format"),
@ -1395,7 +1395,7 @@ mod tests {
// query by url // query by url
let meta = query(&conn, "instr", 10).expect("query should work"); let meta = query(&conn, "instr", 10).expect("query should work");
assert_history_metadata_record!(&meta[0], assert_history_metadata_record!(meta[0],
url "https://www.sqlite.org/lang_corefunc.html#instr", url "https://www.sqlite.org/lang_corefunc.html#instr",
total_time 20000, total_time 20000,
search_term Some("sqlite like"), search_term Some("sqlite like"),
@ -1407,7 +1407,7 @@ mod tests {
// by url, referrer domain is different // by url, referrer domain is different
let meta = query(&conn, "youtube", 10).expect("query should work"); let meta = query(&conn, "youtube", 10).expect("query should work");
assert_history_metadata_record!(&meta[0], assert_history_metadata_record!(meta[0],
url "https://www.youtube.com/watch?v=tpiyEe_CqB4", url "https://www.youtube.com/watch?v=tpiyEe_CqB4",
total_time 100000, total_time 100000,
search_term Some("cute cat"), search_term Some("cute cat"),

Просмотреть файл

@ -21,7 +21,7 @@ pub use crate::repeat::*;
/// https://www.sqlite.org/faq.html, the only character that must be escaped is /// https://www.sqlite.org/faq.html, the only character that must be escaped is
/// the single quote, which is escaped by placing two single quotes in a row. /// the single quote, which is escaped by placing two single quotes in a row.
pub fn escape_string_for_pragma(s: &str) -> String { pub fn escape_string_for_pragma(s: &str) -> String {
s.replace("'", "''") s.replace('\'', "''")
} }
#[cfg(test)] #[cfg(test)]

Просмотреть файл

@ -43,15 +43,15 @@ pub enum SyncEngineId {
impl SyncEngineId { impl SyncEngineId {
// Iterate over all possible engines // Iterate over all possible engines
pub fn iter() -> impl Iterator<Item = SyncEngineId> { pub fn iter() -> impl Iterator<Item = SyncEngineId> {
// Once we switch to the 2021 edition, this can just be [ ... ].into_iter() [
std::array::IntoIter::new([
Self::Passwords, Self::Passwords,
Self::History, Self::History,
Self::Bookmarks, Self::Bookmarks,
Self::Tabs, Self::Tabs,
Self::Addresses, Self::Addresses,
Self::CreditCards, Self::CreditCards,
]) ]
.into_iter()
} }
// Get the string identifier for this engine. This must match the strings in SyncEngineSelection. // Get the string identifier for this engine. This must match the strings in SyncEngineSelection.

Просмотреть файл

@ -20,8 +20,10 @@ but everything in the future is documented as "estimated".
Ultimately though, that page defines 2 Rust versions - "Uses" and "Requires", Ultimately though, that page defines 2 Rust versions - "Uses" and "Requires",
and our policy revolves around these. and our policy revolves around these.
There is a [Meta bug on Bugzilla](https://bugzilla.mozilla.org/show_bug.cgi?id=1504858) that keeps To discover the current, actual "Uses" version, 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. track of the latest versions as they are upgraded.
To discover the current, actual "Requires" version, [see searchfox](https://searchfox.org/mozilla-central/search?q=MINIMUM_RUST_VERSION&path=python/mozboot/mozboot/util.py)
# application-services Rust version policy # application-services Rust version policy

Просмотреть файл

@ -7,7 +7,7 @@
# supported and used in CI. # supported and used in CI.
[toolchain] [toolchain]
channel = "1.57.0" channel = "1.60.0"
targets = [ targets = [
"aarch64-linux-android", "aarch64-linux-android",
"armv7-linux-androideabi", "armv7-linux-androideabi",