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

fix: require generic trait impls to be in scope to call them #6913

Draft
wants to merge 1 commit into
base: ab/trait-functions-in-scope-for-primitives
Choose a base branch
from

Conversation

asterite
Copy link
Collaborator

Description

Based on top of #6901

Problem

Part of #6864

Summary

Similar to the previous PRs, but for traits which are implemented over all types with an optional where clause, for example:

fn main() {
    let x: i32 = 1;
    let _ = x.foo(); // This will warn because there's no `use private_mod::Foo;`
}

mod private_mod {
    pub trait Foo<T> {
        fn foo(self) -> i32;
    }

    impl<T> Foo<T> for T {
        fn foo(self) -> i32 {
            42
        }
    }
}

Additional Context

Documentation

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist

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

Copy link
Contributor

Peak Memory Sample

Program Peak Memory
keccak256 78.51M
workspace 123.83M
regression_4709 422.94M
ram_blowup_regression 1.58G
private-kernel-tail 168.30M
private-kernel-reset 168.33M
private-kernel-inner 168.30M
parity-root 151.61M

Copy link
Contributor

Compilation Sample

Program Compilation Time %
sha256_regression 1.365s 3%
regression_4709 0.797s 2%
ram_blowup_regression 15.187s -1%
noir-contracts 15.221s -1%

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.

1 participant