Skip to content

Commit

Permalink
update platform010 & platform010-aarch64 symlinks
Browse files Browse the repository at this point in the history
Summary: Upgrade toolchain to 1.83.0

Reviewed By: dtolnay

Differential Revision: D67041293

fbshipit-source-id: 6b8039d953e044d51ab61d3c5c4fadf442eb166b
  • Loading branch information
capickett authored and facebook-github-bot committed Dec 18, 2024
1 parent 42414d4 commit 35bce7d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
27 changes: 19 additions & 8 deletions ocamlrep_derive/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ decl_derive!([ToOcamlRep, attributes(rust_to_ocaml, ocamlrep)] => derive_to_ocam
decl_derive!([FromOcamlRep, attributes(rust_to_ocaml, ocamlrep)] => derive_from_ocamlrep);
decl_derive!([FromOcamlRepIn, attributes(rust_to_ocaml, ocamlrep)] => derive_from_ocamlrep_in);

fn workaround_non_local_def(impl_block: TokenStream) -> TokenStream {
// We need to upgrade synstructure to remove this warning, but doing so will also require upgrading
// to syn2 and rewriting to handle the API changes.
quote! {
#[allow(non_local_definitions)]
#impl_block
}
}

fn derive_to_ocamlrep(mut s: synstructure::Structure<'_>) -> TokenStream {
// remove #[ocamlrep(skip)]
for variant in s.variants_mut() {
Expand All @@ -47,7 +56,7 @@ fn derive_to_ocamlrep(mut s: synstructure::Structure<'_>) -> TokenStream {
s.add_bounds(synstructure::AddBounds::Generics);

let to_body = to_ocamlrep_body(&s);
s.gen_impl(quote! {
workaround_non_local_def(s.gen_impl(quote! {
gen impl ::ocamlrep::ToOcamlRep for @Self {
fn to_ocamlrep<'__ocamlrep_derive_allocator, Alloc: ::ocamlrep::Allocator>(
&'__ocamlrep_derive_allocator self,
Expand All @@ -57,21 +66,21 @@ fn derive_to_ocamlrep(mut s: synstructure::Structure<'_>) -> TokenStream {
match self { #to_body }
}
}
})
}))
}

fn derive_from_ocamlrep(mut s: synstructure::Structure<'_>) -> TokenStream {
s.add_bounds(synstructure::AddBounds::Generics);

let from_body = from_ocamlrep_body(&mut s);
s.gen_impl(quote! {
workaround_non_local_def(s.gen_impl(quote! {
gen impl ::ocamlrep::FromOcamlRep for @Self {
fn from_ocamlrep(value: ::ocamlrep::Value<'_>) -> ::std::result::Result<Self, ::ocamlrep::FromError> {
use ::ocamlrep::FromOcamlRep;
#from_body
}
}
})
}))
}

fn derive_from_ocamlrep_in(mut s: synstructure::Structure<'_>) -> TokenStream {
Expand All @@ -84,7 +93,7 @@ fn derive_from_ocamlrep_in(mut s: synstructure::Structure<'_>) -> TokenStream {
.map(|t| quote!(#t : ::ocamlrep::FromOcamlRep,))
.collect();
let from_body = from_ocamlrep_body(&mut s);
return s.gen_impl(quote! {
return workaround_non_local_def(s.gen_impl(quote! {
gen impl<'__ocamlrep_derive_allocator> ::ocamlrep::FromOcamlRepIn<'__ocamlrep_derive_allocator> for @Self
where #tparams_implement_from_ocamlrep
{
Expand All @@ -96,7 +105,7 @@ fn derive_from_ocamlrep_in(mut s: synstructure::Structure<'_>) -> TokenStream {
#from_body
}
}
});
}));
}

// Constrain the lifetime of `'__ocamlrep_derive_allocator` to be equal to
Expand All @@ -118,7 +127,7 @@ fn derive_from_ocamlrep_in(mut s: synstructure::Structure<'_>) -> TokenStream {
.collect();

let from_in_body = from_ocamlrep_in_body(&mut s);
s.gen_impl(quote! {
workaround_non_local_def(s.gen_impl(quote! {
gen impl<'__ocamlrep_derive_allocator> ::ocamlrep::FromOcamlRepIn<'__ocamlrep_derive_allocator> for @Self
where
#tparams_implement_trivialdrop #lifetimes
Expand All @@ -131,7 +140,7 @@ fn derive_from_ocamlrep_in(mut s: synstructure::Structure<'_>) -> TokenStream {
#from_in_body
}
}
})
}))
}

fn to_ocamlrep_body(s: &synstructure::Structure<'_>) -> TokenStream {
Expand Down Expand Up @@ -516,6 +525,7 @@ mod tests {
assert_pat_eq::<anyhow::Error>(
Ok(derive_to_ocamlrep(Structure::new(&syn::parse2(input)?))),
quote! {
#[allow(non_local_definitions)]
#[allow(non_upper_case_globals)]
const _DERIVE_ocamlrep_ToOcamlRep_FOR_A: () = {
impl ::ocamlrep::ToOcamlRep for A {
Expand Down Expand Up @@ -560,6 +570,7 @@ mod tests {
assert_pat_eq::<anyhow::Error>(
Ok(derive_from_ocamlrep(Structure::new(&syn::parse2(input)?))),
quote! {
#[allow(non_local_definitions)]
#[allow(non_upper_case_globals)]
const _DERIVE_ocamlrep_FromOcamlRep_FOR_A: () = {
impl ::ocamlrep::FromOcamlRep for A {
Expand Down
2 changes: 1 addition & 1 deletion ocamlrep_marshal/ocamlrep_marshal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

#![feature(new_uninit)]
#![feature(new_zeroed_alloc)]

mod deser; // deserialize; c.f 'runtime/intern.c'
mod intext; // c.f. 'runtime/caml/intext.h'
Expand Down

0 comments on commit 35bce7d

Please sign in to comment.