Skip to content

Commit 6f3e671

Browse files
committed
Signals: test connect_self(|this: &mut C| ...) closure syntax
1 parent ab02ad0 commit 6f3e671

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

itest/rust/src/builtin_tests/containers/signal_test.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,13 @@ fn signal_symbols_external() {
9696
});
9797
}
9898

99-
// Self-modifying method.
100-
sig.connect_self(Emitter::self_receive);
99+
// Self-modifying method. Have 2 branches just to ensure they compile.
100+
if std::hint::black_box(true) {
101+
sig.connect_self(Emitter::self_receive);
102+
} else {
103+
// Needs explicit type here.
104+
sig.connect_self(|this: &mut Emitter, i| this.self_receive(i));
105+
}
101106

102107
// Connect to other object.
103108
let receiver = Receiver::new_alloc();

0 commit comments

Comments
 (0)