Skip to content

Commit 9bb4081

Browse files
committed
remove reverse_{encode, decode}!
1 parent 7af913f commit 9bb4081

File tree

3 files changed

+2
-22
lines changed

3 files changed

+2
-22
lines changed

library/proc_macro/src/bridge/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ macro_rules! define_client_side {
144144

145145
buf.clear();
146146
api_tags::Method::$name(api_tags::$name::$method).encode(&mut buf, &mut ());
147-
reverse_encode!(buf; $($arg),*);
147+
$($arg.encode(&mut buf, &mut ());)*
148148

149149
buf = bridge.dispatch.call(buf);
150150

library/proc_macro/src/bridge/mod.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -119,26 +119,6 @@ macro_rules! with_api_handle_types {
119119
};
120120
}
121121

122-
// FIXME(eddyb) this calls `encode` for each argument, but in reverse,
123-
// to match the ordering in `reverse_decode`.
124-
macro_rules! reverse_encode {
125-
($writer:ident;) => {};
126-
($writer:ident; $first:ident $(, $rest:ident)*) => {
127-
reverse_encode!($writer; $($rest),*);
128-
$first.encode(&mut $writer, &mut ());
129-
}
130-
}
131-
132-
// FIXME(eddyb) this calls `decode` for each argument, but in reverse,
133-
// to avoid borrow conflicts from borrows started by `&mut` arguments.
134-
macro_rules! reverse_decode {
135-
($reader:ident, $s:ident;) => {};
136-
($reader:ident, $s:ident; $first:ident: $first_ty:ty $(, $rest:ident: $rest_ty:ty)*) => {
137-
reverse_decode!($reader, $s; $($rest: $rest_ty),*);
138-
let $first = <$first_ty>::decode(&mut $reader, $s);
139-
}
140-
}
141-
142122
#[allow(unsafe_code)]
143123
mod arena;
144124
#[allow(unsafe_code)]

library/proc_macro/src/bridge/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ macro_rules! define_dispatcher_impl {
178178
$(api_tags::Method::$name(m) => match m {
179179
$(api_tags::$name::$method => {
180180
let mut call_method = || {
181-
reverse_decode!(reader, handle_store; $($arg: $arg_ty),*);
181+
$(let $arg = <$arg_ty>::decode(&mut reader, handle_store);)*
182182
$name::$method(server, $($arg),*)
183183
};
184184
// HACK(eddyb) don't use `panic::catch_unwind` in a panic.

0 commit comments

Comments
 (0)