diff --git a/CHANGES.md b/CHANGES.md index 3419ce818..86e022409 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ * Add `TrailingSlash::MergeOnly` behaviour to `NormalizePath`, which allow `NormalizePath` to keep the trailing slash's existance as it is. [#1695] * Fix `ResourceMap` recursive references when printing/debugging. [#1708] +* Remove bound `std::marker::Sized` from `web::Data` to support storing `Arc` via `web::Data::from` [#1710] [#1708]: https://github.com/actix/actix-web/pull/1708 diff --git a/src/data.rs b/src/data.rs index 9559071a5..6405fd901 100644 --- a/src/data.rs +++ b/src/data.rs @@ -300,17 +300,17 @@ mod tests { fn get_num(&self) -> i32; } struct A {} - impl TestTrait for A{ + impl TestTrait for A { fn get_num(&self) -> i32 { 42 } } // This works when Sized is required - let dyn_arc_box: Arc> = Arc::new(Box::new(A{})); + let dyn_arc_box: Arc> = Arc::new(Box::new(A {})); let data_arc_box = Data::from(dyn_arc_box); // This works when Data Sized Bound is removed - let dyn_arc: Arc = Arc::new(A{}); + let dyn_arc: Arc = Arc::new(A {}); let data_arc = Data::from(dyn_arc); assert_eq!(data_arc_box.get_num(), data_arc.get_num()) - } + } }