Skip to content

Commit

Permalink
fix: use anon-const for wrapping expanded impls (#427)
Browse files Browse the repository at this point in the history
* fix: use anon-const for wrapping expanded impls

* fix derive tests
  • Loading branch information
shekhirin authored Mar 4, 2024
1 parent d1c9b84 commit b1be99d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions proptest-derive/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ impl Impl {

let _top = call_site_ident(TOP_PARAM_NAME);

let _const = call_site_ident(&format!("_IMPL_ARBITRARY_FOR_{}", typ));

// Linearise everything. We're done after this.
//
// NOTE: The clippy::arc_with_non_send_sync lint is disabled here because the strategies
Expand All @@ -118,7 +116,7 @@ impl Impl {
let q = quote! {
#[allow(non_upper_case_globals)]
#[allow(clippy::arc_with_non_send_sync)]
const #_const: () = {
const _: () = {
extern crate proptest as _proptest;

impl #impl_generics _proptest::arbitrary::Arbitrary
Expand Down
6 changes: 3 additions & 3 deletions proptest-derive/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ test! {
} expands to {
#[allow(non_upper_case_globals)]
#[allow(clippy::arc_with_non_send_sync)]
const _IMPL_ARBITRARY_FOR_MyUnitStruct : () = {
const _: () = {
extern crate proptest as _proptest;
impl _proptest::arbitrary::Arbitrary for MyUnitStruct {
type Parameters = ();
Expand All @@ -101,7 +101,7 @@ test! {
} expands to {
#[allow(non_upper_case_globals)]
#[allow(clippy::arc_with_non_send_sync)]
const _IMPL_ARBITRARY_FOR_MyTupleUnitStruct : () = {
const _: () = {
extern crate proptest as _proptest;
impl _proptest::arbitrary::Arbitrary for MyTupleUnitStruct {
type Parameters = ();
Expand All @@ -122,7 +122,7 @@ test! {
} expands to {
#[allow(non_upper_case_globals)]
#[allow(clippy::arc_with_non_send_sync)]
const _IMPL_ARBITRARY_FOR_MyNamedUnitStruct : () = {
const _: () = {
extern crate proptest as _proptest;
impl _proptest::arbitrary::Arbitrary for MyNamedUnitStruct {
type Parameters = ();
Expand Down

0 comments on commit b1be99d

Please sign in to comment.