@@ -144,29 +144,30 @@ impl LispFunc {
144144 let mut args = TokenStream2 :: new ( ) ;
145145 // Inlined references do not live long enough. We need bindings for them.
146146 let mut bindings = TokenStream2 :: new ( ) ;
147+ let env = Ident :: new ( "env" , Span :: call_site ( ) ) ;
147148 for arg in & self . args {
148149 match * arg {
149150 Arg :: Env { span } => {
150151 // TODO: Find a way not to define inner function, somehow, otherwise the reported
151152 // error is confusing (i.e expecting Env, found &Env).
152- args. append_all ( quote_spanned ! ( span=> & * * env, ) )
153+ args. append_all ( quote_spanned ! ( span=> & * * # env, ) )
153154 }
154155 Arg :: Val { span, access, nth, .. } => {
155156 let name = util:: arg ( "arg" , nth) ;
156157 // TODO: Create a slice of `emacs_value` once and iterate through it, instead of
157158 // using `get_arg`, which creates a slice each call.
158159 bindings. append_all ( match access {
159160 Access :: Owned => quote_spanned ! { span=>
160- let #name = env. get_arg( #nth) . into_rust( ) ?;
161+ let #name = # env. get_arg( #nth) . into_rust( ) ?;
161162 } ,
162163 // TODO: Support RwLock/Mutex (for the use case of sharing data with
163164 // background Rust threads).
164165 // TODO: Support direct access.
165166 Access :: Ref => quote_spanned ! { span=>
166- let #name = & * env. get_arg( #nth) . into_ref( ) ?;
167+ let #name = & * # env. get_arg( #nth) . into_ref( ) ?;
167168 } ,
168169 Access :: RefMut => quote_spanned ! { span=>
169- let #name = & mut * env. get_arg( #nth) . into_ref_mut( ) ?;
170+ let #name = & mut * # env. get_arg( #nth) . into_ref_mut( ) ?;
170171 } ,
171172 } ) ;
172173 args. append_all ( quote_spanned ! ( span=> #name, ) ) ;
@@ -193,12 +194,12 @@ impl LispFunc {
193194 // XXX: output can be (), but we can't easily know when.
194195 let into_lisp = quote_spanned ! { self . output_span=>
195196 #[ allow( clippy:: unit_arg) ]
196- :: emacs:: IntoLisp :: into_lisp( output, env)
197+ :: emacs:: IntoLisp :: into_lisp( output, # env)
197198 } ;
198199 let inner = & self . def . sig . ident ;
199200 let wrapper = self . wrapper_ident ( ) ;
200201 quote ! {
201- fn #wrapper( env: & :: emacs:: CallEnv ) -> :: emacs:: Result <:: emacs:: Value <' _>> {
202+ fn #wrapper( # env: & :: emacs:: CallEnv ) -> :: emacs:: Result <:: emacs:: Value <' _>> {
202203 #bindings
203204 let output = #inner( #args) ?;
204205 #maybe_embed
0 commit comments