Skip to content

Commit fe17584

Browse files
fix gate-ing of atomic64 in tests
1 parent 35740de commit fe17584

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tower-http/src/request_id.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,19 +483,19 @@ mod tests {
483483
use crate::test_helpers::Body;
484484
use crate::ServiceBuilderExt as _;
485485
use http::Response;
486+
#[cfg(target_has_atomic = "64")]
487+
use std::sync::atomic::AtomicU64;
486488
use std::{
487489
convert::Infallible,
488-
sync::{
489-
atomic::{AtomicU64, Ordering},
490-
Arc,
491-
},
490+
sync::{atomic::Ordering, Arc},
492491
};
493492
use tower::{ServiceBuilder, ServiceExt};
494493

495494
#[allow(unused_imports)]
496495
use super::*;
497496

498497
#[tokio::test]
498+
#[cfg(target_has_atomic = "64")]
499499
async fn basic() {
500500
let svc = ServiceBuilder::new()
501501
.set_x_request_id(Counter::default())
@@ -526,6 +526,7 @@ mod tests {
526526
}
527527

528528
#[tokio::test]
529+
#[cfg(target_has_atomic = "64")]
529530
async fn other_middleware_setting_request_id() {
530531
let svc = ServiceBuilder::new()
531532
.override_request_header(
@@ -554,6 +555,7 @@ mod tests {
554555
}
555556

556557
#[tokio::test]
558+
#[cfg(target_has_atomic = "64")]
557559
async fn other_middleware_setting_request_id_on_response() {
558560
let svc = ServiceBuilder::new()
559561
.set_x_request_id(Counter::default())
@@ -574,8 +576,10 @@ mod tests {
574576
}
575577

576578
#[derive(Clone, Default)]
579+
#[cfg(target_has_atomic = "64")]
577580
struct Counter(Arc<AtomicU64>);
578581

582+
#[cfg(target_has_atomic = "64")]
579583
impl MakeRequestId for Counter {
580584
fn make_request_id<B>(&mut self, _request: &Request<B>) -> Option<RequestId> {
581585
let id =

0 commit comments

Comments
 (0)