Skip to content

Commit

Permalink
Upgrade MSRV to Rust 1.72.1 (#3298)
Browse files Browse the repository at this point in the history
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
  • Loading branch information
jdisanti authored Dec 14, 2023
1 parent 1e1ed4c commit 9aa0b53
Show file tree
Hide file tree
Showing 31 changed files with 238 additions and 182 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
required: false

env:
rust_version: 1.70.0
rust_version: 1.72.0
rust_toolchain_components: clippy,rustfmt
ENCRYPTED_DOCKER_PASSWORD: ${{ secrets.ENCRYPTED_DOCKER_PASSWORD }}
DOCKER_LOGIN_TOKEN_PASSPHRASE: ${{ secrets.DOCKER_LOGIN_TOKEN_PASSPHRASE }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/claim-crate-names.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true

env:
rust_version: 1.70.0
rust_version: 1.72.1

name: Claim unpublished crate names on crates.io
run-name: ${{ github.workflow }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
name: Update GitHub Pages

env:
rust_version: 1.70.0
rust_version: 1.72.1

# Allow only one doc pages build to run at a time for the entire smithy-rs repo
concurrency:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true

env:
rust_version: 1.70.0
rust_version: 1.72.1

name: Release smithy-rs
run-name: ${{ inputs.dry_run && 'Dry run' || 'Prod run' }} - ${{ github.workflow }} ${{ inputs.stable_semantic_version }}/${{ inputs.unstable_semantic_version }} (${{ inputs.commit_sha }})
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-sdk-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.70.0
toolchain: 1.72.1
- name: Delete old SDK
run: |
- name: Generate a fresh SDK
Expand Down
2 changes: 2 additions & 0 deletions aws/rust-runtime/aws-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
unreachable_pub
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// Allow disallowed methods in tests
#![cfg_attr(test, allow(clippy::disallowed_methods))]

//! `aws-config` provides implementations of region and credential resolution.
//!
Expand Down
4 changes: 3 additions & 1 deletion aws/rust-runtime/aws-inlineable/src/glacier_interceptors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ impl Intercept for GlacierApiVersionInterceptor {

/// Adds a glacier tree hash checksum to the HTTP Request
#[derive(Debug, Default)]
pub(crate) struct GlacierTreeHashHeaderInterceptor;
pub(crate) struct GlacierTreeHashHeaderInterceptor {
_priv: (),
}

impl Intercept for GlacierTreeHashHeaderInterceptor {
fn name(&self) -> &'static str {
Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-runtime/src/invocation_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ mod test_util {
impl NoInvocationIdGenerator {
/// Create a new [`NoInvocationIdGenerator`].
pub fn new() -> Self {
Self::default()
Self
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ object TestWorkspace {
// help rust select the right version when we run cargo test
// TODO(https://github.com/smithy-lang/smithy-rs/issues/2048): load this from the msrv property using a
// method as we do for runtime crate versions
"[toolchain]\nchannel = \"1.70.0\"\n",
"[toolchain]\nchannel = \"1.72.1\"\n",
)
// ensure there at least an empty lib.rs file to avoid broken crates
newProject.resolve("src").mkdirs()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

# Rust MSRV (entered into the generated README)
rust.msrv=1.70.0
rust.msrv=1.72.1

# To enable debug, swap out the two lines below.
# When changing this value, be sure to run `./gradlew --stop` to kill the Gradle daemon.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ mod tests {

impl Debug for TestDebugMap {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
f.debug_map().entries(self.0.into_iter()).finish()
f.debug_map().entries(self.0).finish()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ where
if let Some(greedy_label) = &self.greedy_label {
// Calculate the byte index of the start of the greedy label and whether it was reached while writing the
// normal labels.
// TODO(clippy): Switch from fold to try_fold
#[allow(clippy::manual_try_fold)]
let (greedy_start, greedy_hit) = self
.path
.split('/')
Expand Down
8 changes: 4 additions & 4 deletions rust-runtime/aws-smithy-json/src/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ mod test {
assert_eq!("foo", escape_string("foo").as_ref());
assert_eq!("foo\\r\\n", escape_string("foo\r\n").as_ref());
assert_eq!("foo\\r\\nbar", escape_string("foo\r\nbar").as_ref());
assert_eq!(r#"foo\\bar"#, escape_string(r#"foo\bar"#).as_ref());
assert_eq!(r#"\\foobar"#, escape_string(r#"\foobar"#).as_ref());
assert_eq!(r"foo\\bar", escape_string(r"foo\bar").as_ref());
assert_eq!(r"\\foobar", escape_string(r"\foobar").as_ref());
assert_eq!(
r#"\bf\fo\to\r\n"#,
r"\bf\fo\to\r\n",
escape_string("\u{08}f\u{0C}o\to\r\n").as_ref()
);
assert_eq!("\\\"test\\\"", escape_string("\"test\"").as_ref());
Expand All @@ -247,7 +247,7 @@ mod test {
fn unescape() {
assert_eq!(
"\x08f\x0Co\to\r\n",
unescape_string(r#"\bf\fo\to\r\n"#).unwrap()
unescape_string(r"\bf\fo\to\r\n").unwrap()
);
assert_eq!("\"test\"", unescape_string(r#"\"test\""#).unwrap());
assert_eq!("\x00", unescape_string("\\u0000").unwrap());
Expand Down
6 changes: 3 additions & 3 deletions rust-runtime/aws-smithy-runtime-api/src/client/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ mod tests {
})
.build();

assert_eq!(connection_metadata.is_proxied, true);
assert!(connection_metadata.is_proxied);
assert_eq!(connection_metadata.remote_addr(), Some(TEST_SOCKET_ADDR));
assert_eq!(connection_metadata.local_addr(), Some(TEST_SOCKET_ADDR));
assert_eq!(*mutable_flag.lock().unwrap(), false);
assert!(!(*mutable_flag.lock().unwrap()));
connection_metadata.poison();
assert_eq!(*mutable_flag.lock().unwrap(), true);
assert!(*mutable_flag.lock().unwrap());
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ where
/// Disable an interceptor with a given cause
pub fn disable_interceptor<T: Intercept>(cause: &'static str) -> DisableInterceptor<T> {
DisableInterceptor {
_t: PhantomData::default(),
_t: PhantomData,
cause,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ mod timeout_middleware {

#[tokio::test]
async fn http_read_timeout_works() {
let tcp_connector = NeverReplies::default();
let tcp_connector = NeverReplies;
let connector_settings = HttpConnectorSettings::builder()
.connect_timeout(Duration::from_secs(1))
.read_timeout(Duration::from_secs(2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct RecordingClient {
pub(crate) inner: SharedHttpConnector,
}

#[cfg(all(feature = "tls-rustls"))]
#[cfg(feature = "tls-rustls")]
impl RecordingClient {
/// Construct a recording connection wrapping a default HTTPS implementation without any timeouts.
pub fn https() -> Self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ macro_rules! assert_str_contains {
mod tests {
use std::panic::{catch_unwind, UnwindSafe};

fn expect_panic(f: impl FnOnce() -> () + UnwindSafe) -> String {
fn expect_panic(f: impl FnOnce() + UnwindSafe) -> String {
*catch_unwind(f)
.expect_err("it should fail")
.downcast::<String>()
Expand Down
8 changes: 6 additions & 2 deletions rust-runtime/aws-smithy-types/src/config_bag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,11 @@ impl ConfigBag {
// this code looks weird to satisfy the borrow checker—we can't keep the result of `get_mut`
// alive (even in a returned branch) and then call `store_put`. So: drop the borrow immediately
// store, the value, then pull it right back
if matches!(self.interceptor_state.get_mut::<StoreReplace<T>>(), None) {
if self
.interceptor_state
.get_mut::<StoreReplace<T>>()
.is_none()
{
let new_item = match self.tail.iter().find_map(|b| b.load::<T>()) {
Some(item) => item.clone(),
None => return None,
Expand Down Expand Up @@ -710,7 +714,7 @@ impl ConfigBag {
pub fn sourced_get<T: Store>(&self) -> T::ReturnedType<'_> {
let stored_type_iter = ItemIter {
inner: self.layers(),
t: PhantomData::default(),
t: PhantomData,
};
T::merge_iter(stored_type_iter)
}
Expand Down
2 changes: 1 addition & 1 deletion rust-runtime/inlineable/src/endpoint_lib/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static VIRTUAL_HOSTABLE_SEGMENT: Lazy<Regex> =

static IPV4: Lazy<Regex> = Lazy::new(|| Regex::new("^(\\d+\\.){3}\\d+$").unwrap());

static DOTS_AND_DASHES: Lazy<Regex> = Lazy::new(|| Regex::new(r#"^.*((\.-)|(-\.)).*$"#).unwrap());
static DOTS_AND_DASHES: Lazy<Regex> = Lazy::new(|| Regex::new(r"^.*((\.-)|(-\.)).*$").unwrap());

/// Evaluates whether a string is a DNS-compatible bucket name that can be used with virtual hosted-style addressing.
pub(crate) fn is_virtual_hostable_s3_bucket(
Expand Down
2 changes: 1 addition & 1 deletion rust-runtime/inlineable/src/endpoint_lib/substring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ mod test {
}

#[test]
fn substring_correct_length(s in r#"[\x00-\xFF]*"#, start in 0..10usize, stop in 0..10usize, reverse in proptest::bool::ANY) {
fn substring_correct_length(s in r"[\x00-\xFF]*", start in 0..10usize, stop in 0..10usize, reverse in proptest::bool::ANY) {
prop_assume!(start < s.len());
prop_assume!(stop < s.len());
prop_assume!(start < stop);
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.70.0"
channel = "1.72.1"
2 changes: 1 addition & 1 deletion tools/ci-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# This is the base Docker build image used by CI

ARG base_image=public.ecr.aws/amazonlinux/amazonlinux:2023
ARG rust_stable_version=1.70.0
ARG rust_stable_version=1.72.1
ARG rust_nightly_version=nightly-2023-10-10

FROM ${base_image} AS bare_base_image
Expand Down
4 changes: 2 additions & 2 deletions tools/ci-build/crate-hasher/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ fn test_against_aws_smithy_async_with_ignored_files() -> Result<()> {
let mut archive = Archive::new(tar);
archive.unpack(&dir)?;

std::fs::create_dir(&dir.as_path().join("target"))?;
std::fs::create_dir(dir.as_path().join("target"))?;
std::fs::write(
&dir.as_path().join("target/something"),
dir.as_path().join("target/something"),
b"some data that should be excluded",
)?;

Expand Down
2 changes: 1 addition & 1 deletion tools/ci-build/publisher/src/cargo/get_owners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl ShellOperation for GetOwners {

let mut result = Vec::new();
let (stdout, _) = output_text(&output);
let line_re = Regex::new(r#"^([\w\d\-_:]+)\s+\([\w\d\s\-_]+\)$"#).unwrap();
let line_re = Regex::new(r"^([\w\d\-_:]+)\s+\([\w\d\s\-_]+\)$").unwrap();
for line in stdout.lines() {
if let Some(captures) = line_re.captures(line) {
let user_id = captures.get(1).unwrap().as_str();
Expand Down
7 changes: 3 additions & 4 deletions tools/ci-build/publisher/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,9 @@ fn read_package(path: &Path, manifest_bytes: &[u8]) -> Result<Option<Package>> {
};

let mut local_dependencies = BTreeSet::new();
local_dependencies.extend(read_dependencies(path, &manifest.dependencies)?.into_iter());
local_dependencies.extend(read_dependencies(path, &manifest.dev_dependencies)?.into_iter());
local_dependencies
.extend(read_dependencies(path, &manifest.build_dependencies)?.into_iter());
local_dependencies.extend(read_dependencies(path, &manifest.dependencies)?);
local_dependencies.extend(read_dependencies(path, &manifest.dev_dependencies)?);
local_dependencies.extend(read_dependencies(path, &manifest.build_dependencies)?);
Ok(Some(Package::new(
handle,
path,
Expand Down
2 changes: 1 addition & 1 deletion tools/ci-build/publisher/src/subcommand/fix_manifests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ mod tests {
(
name.to_string(),
VersionWithMetadata {
version: Version::parse(&version).unwrap(),
version: Version::parse(version).unwrap(),
publish,
stability: *stability,
},
Expand Down
6 changes: 3 additions & 3 deletions tools/ci-build/smithy-rs-tool-common/src/changelog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ impl Changelog {
}

pub fn merge(&mut self, other: Changelog) {
self.smithy_rs.extend(other.smithy_rs.into_iter());
self.aws_sdk_rust.extend(other.aws_sdk_rust.into_iter());
self.sdk_models.extend(other.sdk_models.into_iter());
self.smithy_rs.extend(other.smithy_rs);
self.aws_sdk_rust.extend(other.aws_sdk_rust);
self.sdk_models.extend(other.sdk_models);
}

pub fn parse_str(value: &str) -> Result<Changelog> {
Expand Down
1 change: 1 addition & 0 deletions tools/ci-cdk/canary-lambda/src/canary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ macro_rules! mk_canary {
sdk_config: &aws_config::SdkConfig,
env: &CanaryEnv,
) -> Option<(&'static str, $crate::canary::CanaryFuture)> {
#[allow(clippy::redundant_closure_call)]
Some(($name, Box::pin($run_canary(sdk_config, env))))
}
};
Expand Down
37 changes: 26 additions & 11 deletions tools/ci-cdk/canary-runner/src/build_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,38 @@ fn write_dependencies(
None => required_crate,
};
let crate_path = path.join(path_name);
writeln!(
write!(
output,
r#"{required_crate} = {{ path = "{path}" }}"#,
r#"{required_crate} = {{ path = "{path}""#,
path = crate_path.to_string_lossy()
)
.unwrap()
.unwrap();
if required_crate == "aws-config" {
write!(output, r#", features = ["behavior-version-latest"]"#).unwrap();
}
writeln!(output, " }}").unwrap();
}
CrateSource::VersionsManifest {
versions,
release_tag,
} => match versions.crates.get(required_crate) {
Some(version) => writeln!(
output,
r#"{required_crate} = "{version}""#,
version = version.version
)
.unwrap(),
Some(version) => {
if required_crate == "aws-config" {
writeln!(
output,
r#"{required_crate} = {{ version = "{version}", features = ["behavior-version-latest"] }}"#,
version = version.version
)
.unwrap();
} else {
writeln!(
output,
r#"{required_crate} = "{version}""#,
version = version.version
)
.unwrap();
}
}
None => {
bail!("Couldn't find `{required_crate}` in versions.toml for `{release_tag}`")
}
Expand Down Expand Up @@ -436,7 +451,7 @@ uuid = { version = "0.8", features = ["v4"] }
tokio-stream = "0"
tracing-texray = "0.1.1"
reqwest = { version = "0.11.14", features = ["rustls-tls"], default-features = false }
aws-config = { path = "some/sdk/path/aws-config" }
aws-config = { path = "some/sdk/path/aws-config", features = ["behavior-version-latest"] }
aws-sdk-s3 = { path = "some/sdk/path/s3" }
aws-sdk-ec2 = { path = "some/sdk/path/ec2" }
aws-sdk-transcribestreaming = { path = "some/sdk/path/transcribestreaming" }
Expand Down Expand Up @@ -500,7 +515,7 @@ uuid = { version = "0.8", features = ["v4"] }
tokio-stream = "0"
tracing-texray = "0.1.1"
reqwest = { version = "0.11.14", features = ["rustls-tls"], default-features = false }
aws-config = "0.46.0"
aws-config = { version = "0.46.0", features = ["behavior-version-latest"] }
aws-sdk-s3 = "0.20.0"
aws-sdk-ec2 = "0.19.0"
aws-sdk-transcribestreaming = "0.16.0"
Expand Down
Loading

0 comments on commit 9aa0b53

Please sign in to comment.