Skip to content

Commit 0025710

Browse files
committed
rename reference counter ref to refs
to avoid confusion with Rust's keyword `ref mut` etc
1 parent 4f4fcd3 commit 0025710

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

qmetaobject/src/future.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ static QT_WAKER_VTABLE: std::task::RawWakerVTable = unsafe {
88
|s: *const ()| {
99
std::task::RawWaker::new(
1010
cpp!([s as "Waker*"] -> *const() as "Waker*" {
11-
s->ref++;
11+
s->refs++;
1212
return s;
1313
}),
1414
&QT_WAKER_VTABLE,
@@ -38,7 +38,7 @@ cpp! {{
3838
TraitObject future;
3939
bool woken = false;
4040
bool completed = false;
41-
QAtomicInt ref = 0;
41+
QAtomicInt refs = 0;
4242
void customEvent(QEvent *e) override {
4343
Q_UNUSED(e);
4444
woken = false;
@@ -57,7 +57,7 @@ cpp! {{
5757
}
5858
}
5959
void deref() {
60-
if (!--ref) {
60+
if (!--refs) {
6161
deleteLater();
6262
}
6363
}
@@ -89,7 +89,7 @@ pub fn execute_async(f: impl Future<Output = ()> + 'static) {
8989
unsafe {
9090
let waker = cpp!([f as "TraitObject"] -> *const() as "Waker*" {
9191
auto w = new Waker;
92-
w->ref++;
92+
w->refs++;
9393
w->future = f;
9494
return w;
9595
});
@@ -99,7 +99,7 @@ pub fn execute_async(f: impl Future<Output = ()> + 'static) {
9999

100100
// SAFETY: caller must ensure that given future hasn't returned Poll::Ready earlier.
101101
unsafe fn poll_with_qt_waker(waker: *const (), future: Pin<&mut dyn Future<Output = ()>>) -> bool {
102-
cpp!([waker as "Waker*"] { waker->ref++; });
102+
cpp!([waker as "Waker*"] { waker->refs++; });
103103
let waker = std::task::RawWaker::new(waker, &QT_WAKER_VTABLE);
104104
let waker = std::task::Waker::from_raw(waker);
105105
let mut context = std::task::Context::from_waker(&waker);

0 commit comments

Comments
 (0)