Skip to content

Commit

Permalink
Support 32bits targets (#1811)
Browse files Browse the repository at this point in the history
* Replace AtomicU64 with AtomicUsize to prevent compilation issues on 32 bits platforms.

* Make sure that Rust tests compile on MacOS.

* Add CHANGELOG next entry.
  • Loading branch information
LukeMathWalker authored Oct 6, 2022
1 parent d953a44 commit 1b2b42d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@
# meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"}
# author = "rcoh"

[[smithy-rs]]
message = """
Replace all usages of `AtomicU64` with `AtomicUsize` to support 32bit targets.
"""
references = ["smithy-rs#1811"]
meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "server"}
author = "LukeMathWalker"

[[smithy-rs]]
message = """
Replace all usages of `AtomicU64` with `AtomicUsize` to support 32bit targets.
"""
references = ["smithy-rs#1811"]
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client"}
author = "LukeMathWalker"

[[smithy-rs]]
message = """
Mark `operation` and `operation_handler` modules as private in the generated server crate.
Expand Down
6 changes: 3 additions & 3 deletions rust-runtime/aws-smithy-client/src/never.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use http::Uri;
use aws_smithy_async::future::never::Never;

use std::marker::PhantomData;
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;

use std::task::{Context, Poll};
Expand All @@ -27,7 +27,7 @@ use tower::BoxError;
#[derive(Debug)]
pub struct NeverService<Req, Resp, Err> {
_resp: PhantomData<(Req, Resp, Err)>,
invocations: Arc<AtomicU64>,
invocations: Arc<AtomicUsize>,
}

impl<Req, Resp, Err> Clone for NeverService<Req, Resp, Err> {
Expand Down Expand Up @@ -55,7 +55,7 @@ impl<Req, Resp, Err> NeverService<Req, Resp, Err> {
}

/// Returns the number of invocations made to this service
pub fn num_calls(&self) -> u64 {
pub fn num_calls(&self) -> usize {
self.invocations.load(Ordering::SeqCst)
}
}
Expand Down
8 changes: 8 additions & 0 deletions rust-runtime/aws-smithy-http-server-python/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ impl PySocket {
}

#[cfg(test)]
// `is_listener` on `Socket` is only available on certain platforms.
// In particular, this fails to compile on MacOS.
#[cfg(any(
target_os = "android",
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
))]
mod tests {
use super::*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use std::{
collections::HashMap,
convert::TryInto,
sync::{atomic::AtomicU64, Arc},
sync::{atomic::AtomicUsize, Arc},
};

use async_stream::stream;
Expand Down Expand Up @@ -108,7 +108,7 @@ struct PokemonTranslations {
#[derive(Debug)]
pub struct State {
pokemons_translations: HashMap<String, PokemonTranslations>,
call_count: AtomicU64,
call_count: AtomicUsize,
}

impl Default for State {
Expand Down

0 comments on commit 1b2b42d

Please sign in to comment.