-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure to build 1.4.1 on existing projects that were using 1.3.2 #208
Comments
Can you provide a standalone and minimal test case that reproduces the issue? That would be helpful in diagnosing and fixing the bug. |
I suspect it's the use of std::thread_local in the recursion counter. I think folks should just |
Recursion guard was added in #109 |
Up until the 1.4 releases we've been able to support arbitrary in no_std crates by extern importing std into the space like so:
const _: () = {
// derive(Arbitrary) expects these two to be in scope
use #path::testutils::arbitrary::std;
use #path::testutils::arbitrary::arbitrary;
#[derive(#path::testutils::arbitrary::arbitrary::Arbitrary)]
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd)]
#vis #arbitrary_type_decl
impl #path::testutils::arbitrary::SorobanArbitrary for #ident {
type Prototype = #arbitrary_type_ident;
}
impl #path::TryFromVal<#path::Env, #arbitrary_type_ident> for #ident {
type Error = #path::ConversionError;
fn try_from_val(env: &#path::Env, v: &#arbitrary_type_ident) -> std::result::Result<Self, Self::Error> {
Ok(#arbitrary_ctor)
}
}
};
// Used by `contracttype`
#[doc(hidden)]
pub use std; It seems something has changed where I guess the arbitrary derive is now creating a new scope, that isn't seeing the I think this basically breaks arbitrary for any no_std crate, where it worked before as long as the crate imported std into the scope being derived into. |
### What Limit the versions of arbitrary/derive_arbitrary to 1.3.x. ### Why Arbitrary introduced changes into the 1.4.x releases that no longer compiles with the use of arbitrary in the soroban-sdk: - rust-fuzz/arbitrary#203 - rust-fuzz/arbitrary#208
Similar to #203, it seems like the
1.4.1
releases are still making assumptions about items in the current space that weren't prior, which is a breaking change, and fails to build on projects who were dependent on1.3.2
.Cargo.toml
:src/lib.rs
:Run
cargo test
with1.4.1
:Included in the output are the following build errors:
Re-run
cargo test
with1.3.2
and it compiles:The text was updated successfully, but these errors were encountered: