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

Added selector inline macro for starknet. #3912

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

@orizi orizi requested a review from spapinistarkware August 16, 2023 05:43
@orizi orizi force-pushed the pr/orizi/orizi/inline-macro/5bae488f branch 2 times, most recently from 52f5b27 to a0c56cc Compare August 16, 2023 07:24
@milancermak milancermak mentioned this pull request Aug 16, 2023
Copy link
Member

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

Reviewed 18 of 18 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @orizi and @spapinistarkware)


crates/cairo-lang-compiler/src/db.rs line 103 at r1 (raw file):

    pub fn with_inline_macro_plugin(
        &mut self,
        name: impl Into<String>,

why not just &str ? Less stuff to monomorphize for Rust compiler

Suggestion:

&str

Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: 14 of 18 files reviewed, 1 unresolved discussion (waiting on @mkaput and @spapinistarkware)


crates/cairo-lang-compiler/src/db.rs line 103 at r1 (raw file):

Previously, mkaput (Marek Kaput) wrote…

why not just &str ? Less stuff to monomorphize for Rust compiler

Done.

Copy link
Member

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @orizi and @spapinistarkware)


crates/cairo-lang-starknet/src/inline_macros/selector.rs line 9 at r2 (raw file):

/// Macro for expanding a selector to a string literal.
#[derive(Debug)]

May I ask you to add this impl? I am relying on having T: Default bounds in Scarb code: https://github.com/software-mansion/scarb/blob/bf927194941f6c0ce62677e7e2ef4f9122489ff6/scarb/src/compiler/plugin/builtin.rs#L24

Suggestion:

#[derive(Debug, Default)]

Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mkaput and @spapinistarkware)


crates/cairo-lang-starknet/src/inline_macros/selector.rs line 9 at r2 (raw file):

Previously, mkaput (Marek Kaput) wrote…

May I ask you to add this impl? I am relying on having T: Default bounds in Scarb code: https://github.com/software-mansion/scarb/blob/bf927194941f6c0ce62677e7e2ef4f9122489ff6/scarb/src/compiler/plugin/builtin.rs#L24

if at some point we'd have plugins that requires params - how would you support it?
or all params for such plugins would ahve to be salsa db inputs? (as they are for cfg for example)

Copy link
Member

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @orizi and @spapinistarkware)


crates/cairo-lang-starknet/src/inline_macros/selector.rs line 9 at r2 (raw file):

Previously, orizi wrote…

if at some point we'd have plugins that requires params - how would you support it?
or all params for such plugins would ahve to be salsa db inputs? (as they are for cfg for example)

Pull stuff from salsa. I can't see any other way to pass params to plugins when they'll be written as packages, especially because I believe the constructor will have to be representable as extern "C".

Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mkaput and @spapinistarkware)


crates/cairo-lang-starknet/src/inline_macros/selector.rs line 9 at r2 (raw file):

Previously, mkaput (Marek Kaput) wrote…

Pull stuff from salsa. I can't see any other way to pass params to plugins when they'll be written as packages, especially because I believe the constructor will have to be representable as extern "C".

Done.

@orizi orizi force-pushed the pr/orizi/orizi/inline-macro/5bae488f branch from d62fa48 to dfe2d18 Compare August 17, 2023 06:44
Copy link
Member

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @spapinistarkware)

Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 8 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @spapinistarkware)

Copy link
Member

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 8 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @spapinistarkware)

@orizi orizi changed the base branch from main to pr/orizi/orizi/inline-macro/c9ee2b95 August 20, 2023 13:29
@orizi orizi force-pushed the pr/orizi/orizi/inline-macro/5bae488f branch from b98ade6 to f3dde63 Compare August 20, 2023 13:29
@orizi orizi changed the base branch from pr/orizi/orizi/inline-macro/c9ee2b95 to main August 21, 2023 08:27
@orizi orizi force-pushed the pr/orizi/orizi/inline-macro/5bae488f branch from f3dde63 to c610b37 Compare August 21, 2023 08:27
@orizi orizi force-pushed the pr/orizi/orizi/inline-macro/5bae488f branch from c610b37 to 498ef50 Compare August 22, 2023 07:01
Copy link
Contributor

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 18 files at r1, 2 of 4 files at r2, 1 of 1 files at r3, 4 of 8 files at r4, 4 of 4 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @orizi and @spapinistarkware)


crates/cairo-lang-starknet/src/inline_macros/selector.rs line 28 at r5 (raw file):

            let diagnostics = vec![PluginDiagnostic {
                stable_ptr: syntax.stable_ptr().untyped(),
                message: "selector macro must have a single argument".to_string(),

Suggestion:

Selector

Copy link
Contributor

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @orizi and @spapinistarkware)

@orizi orizi force-pushed the pr/orizi/orizi/inline-macro/5bae488f branch from 498ef50 to 7f21c80 Compare August 22, 2023 07:52
Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @spapinistarkware)

@orizi orizi enabled auto-merge August 22, 2023 07:53
Copy link
Contributor

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @spapinistarkware)

@orizi orizi added this pull request to the merge queue Aug 22, 2023
Merged via the queue into main with commit bc96d45 Aug 22, 2023
@orizi orizi deleted the pr/orizi/orizi/inline-macro/5bae488f branch August 22, 2023 14:35
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.

3 participants