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

issue: nargo is complaining about trait visibility not matching the import #92

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

kashbrti
Copy link
Contributor

@kashbrti kashbrti commented Jan 7, 2025

Description

I'm trying to fix the trait visibility warnings in bignum.
For the RuntimeBignumTrait I'm getting an error when importing the trait in lib.nr

Problem*

Resolves

Summary*

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@@ -18,6 +18,6 @@ pub(crate) mod utils;
pub use bignum::BigNum;
pub use bignum::BigNumTrait; // So that external code can operate on a generic BigNum, `where BigNum: BigNumTrait`.
pub use runtime_bignum::RuntimeBigNum;

pub use runtime_bignum::RuntimeBigNumTrait;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've imported the trait here. but the I'm getting an error.
the BignumTrait is imported here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-01-07 at 15 14 00

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pub use is saying that you want to reexport RuntimeBigNumTrait so it's visible outside of the crate. As runtime_bignum::RuntimeBigNumTraitispub(crate)` then you're increasing the visibility of this trait, which isn't allowed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed the trait to a pub instead of pub(crate). The error disappeared but the warning is still around.

Copy link
Member

@TomAFrench TomAFrench Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean?

warning: Visibility is ignored on a trait method
   ┌─ src/runtime_bignum.nr:69:5
   │
69 │     pub fn __udiv_mod(self, divisor: Self) -> (Self, Self);
   │     ---
   │

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is expected as those modifiers don't mean anything on trait methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants