Skip to content
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

Non-local impl errors in latest rust #1374

Open
leighmcculloch opened this issue Oct 22, 2024 · 2 comments
Open

Non-local impl errors in latest rust #1374

leighmcculloch opened this issue Oct 22, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@leighmcculloch
Copy link
Member

error: non-local `impl` definition, `impl` blocks should be written at the same level as their item
  --> /home/runner/work/rs-soroban-sdk/rs-soroban-sdk/soroban-sdk/src/auth.rs:11:1
   |
11 | #[contracttype(crate_path = "crate", export = false)]
   | ^----------------------------------------------------
   | |
   | `Arbitrary` is not local
   | move the `impl` block outside of this constant `_` and up 2 bodies
12 | pub enum Context {
   |          ------- `ArbitraryContext` is not local
   |
   = note: the derive macro `crate::testutils::arbitrary::arbitrary::Arbitrary` defines the non-local `impl`, and may need to be changed
   = note: the derive macro `crate::testutils::arbitrary::arbitrary::Arbitrary` may come from an old version of the `derive_arbitrary` crate, try updating your dependency with `cargo update -p derive_arbitrary`
   = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
   = note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint
   = note: `-D non-local-definitions` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(non_local_definitions)]`
   = note: this error originates in the derive macro `crate::testutils::arbitrary::arbitrary::Arbitrary` which comes from the expansion of the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info)

Ref: https://github.com/stellar/rs-soroban-sdk/actions/runs/11286263771/job/31861055751

@leighmcculloch leighmcculloch added the bug Something isn't working label Oct 22, 2024
@leighmcculloch leighmcculloch self-assigned this Oct 23, 2024
@leighmcculloch
Copy link
Member Author

This compiler error is showing up because the lint has been added:

@leighmcculloch
Copy link
Member Author

Actually, my comment above is incorrect. The issue is a bug in the compiler in nightly. It's being tracked and discussed in:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant