Skip to content

Commit 1b2b42d

Browse files
Support 32bits targets (#1811)
* Replace AtomicU64 with AtomicUsize to prevent compilation issues on 32 bits platforms. * Make sure that Rust tests compile on MacOS. * Add CHANGELOG next entry.
1 parent d953a44 commit 1b2b42d

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

CHANGELOG.next.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@
1111
# meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"}
1212
# author = "rcoh"
1313

14+
[[smithy-rs]]
15+
message = """
16+
Replace all usages of `AtomicU64` with `AtomicUsize` to support 32bit targets.
17+
"""
18+
references = ["smithy-rs#1811"]
19+
meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "server"}
20+
author = "LukeMathWalker"
21+
22+
[[smithy-rs]]
23+
message = """
24+
Replace all usages of `AtomicU64` with `AtomicUsize` to support 32bit targets.
25+
"""
26+
references = ["smithy-rs#1811"]
27+
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client"}
28+
author = "LukeMathWalker"
29+
1430
[[smithy-rs]]
1531
message = """
1632
Mark `operation` and `operation_handler` modules as private in the generated server crate.

rust-runtime/aws-smithy-client/src/never.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use http::Uri;
1010
use aws_smithy_async::future::never::Never;
1111

1212
use std::marker::PhantomData;
13-
use std::sync::atomic::{AtomicU64, Ordering};
13+
use std::sync::atomic::{AtomicUsize, Ordering};
1414
use std::sync::Arc;
1515

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

3333
impl<Req, Resp, Err> Clone for NeverService<Req, Resp, Err> {
@@ -55,7 +55,7 @@ impl<Req, Resp, Err> NeverService<Req, Resp, Err> {
5555
}
5656

5757
/// Returns the number of invocations made to this service
58-
pub fn num_calls(&self) -> u64 {
58+
pub fn num_calls(&self) -> usize {
5959
self.invocations.load(Ordering::SeqCst)
6060
}
6161
}

rust-runtime/aws-smithy-http-server-python/src/socket.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ impl PySocket {
7373
}
7474

7575
#[cfg(test)]
76+
// `is_listener` on `Socket` is only available on certain platforms.
77+
// In particular, this fails to compile on MacOS.
78+
#[cfg(any(
79+
target_os = "android",
80+
target_os = "freebsd",
81+
target_os = "fuchsia",
82+
target_os = "linux",
83+
))]
7684
mod tests {
7785
use super::*;
7886

rust-runtime/aws-smithy-http-server/examples/pokemon-service/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use std::{
1111
collections::HashMap,
1212
convert::TryInto,
13-
sync::{atomic::AtomicU64, Arc},
13+
sync::{atomic::AtomicUsize, Arc},
1414
};
1515

1616
use async_stream::stream;
@@ -108,7 +108,7 @@ struct PokemonTranslations {
108108
#[derive(Debug)]
109109
pub struct State {
110110
pokemons_translations: HashMap<String, PokemonTranslations>,
111-
call_count: AtomicU64,
111+
call_count: AtomicUsize,
112112
}
113113

114114
impl Default for State {

0 commit comments

Comments
 (0)