Skip to content

Commit 3be42c8

Browse files
authored
RUST-2191 Fix type propagation for Aggregate::session (#1353)
1 parent 33772e2 commit 3be42c8

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/action/aggregate.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<'a, T> Aggregate<'a, ImplicitSession, T> {
166166
pub fn session(
167167
self,
168168
value: impl Into<&'a mut ClientSession>,
169-
) -> Aggregate<'a, ExplicitSession<'a>> {
169+
) -> Aggregate<'a, ExplicitSession<'a>, T> {
170170
Aggregate {
171171
target: self.target,
172172
pipeline: self.pipeline,
@@ -265,3 +265,20 @@ impl AggregateTargetRef<'_> {
265265
}
266266
}
267267
}
268+
269+
#[test]
270+
fn aggregate_session_type() {
271+
// Assert that this code compiles but do not actually run it.
272+
#[allow(
273+
unreachable_code,
274+
unused_variables,
275+
dead_code,
276+
clippy::diverging_sub_expression
277+
)]
278+
fn compile_ok() {
279+
let agg: Aggregate = todo!();
280+
let typed: Aggregate<'_, _, ()> = agg.with_type::<()>();
281+
let mut session: ClientSession = todo!();
282+
let typed_session: Aggregate<'_, _, ()> = typed.session(&mut session);
283+
}
284+
}

0 commit comments

Comments
 (0)