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

Add high-level locations to sierra error. #7074

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ilyalesokhin-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@ilyalesokhin-starkware ilyalesokhin-starkware marked this pull request as draft January 14, 2025 08:04
Copy link
Collaborator

@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 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ilyalesokhin-starkware)


crates/cairo-lang-sierra-to-casm/src/annotations.rs line 110 at r1 (raw file):

                }
                res.push(*destination_statement_idx);
                res

.

Suggestion:

                chain!([*source_statement_idx, *destination_statement_idx],
                introduction_point.source_statement_idx).collect()

Copy link
Contributor Author

@ilyalesokhin-starkware ilyalesokhin-starkware 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: 1 of 5 files reviewed, 1 unresolved discussion (waiting on @orizi)


crates/cairo-lang-sierra-to-casm/src/annotations.rs line 110 at r1 (raw file):

Previously, orizi wrote…

.

Done.

Copy link
Collaborator

@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 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ilyalesokhin-starkware)


crates/cairo-lang-executable/src/compile.rs line 169 at r2 (raw file):

            anyhow::bail!("Failed to create runnable builder: {}\n{}", err, locs.join("\n"));
        }
    };

Suggestion:

    let builder = match RunnableBuilder::new(sierra_program, None).map_err(|err| {
        let mut locs = vec![];
        for stmt_idx in err.stmt_indices() {
            if let Some(loc) = debug_info
                .statements_locations
                .locations
                .get(&stmt_idx)
                .and_then(|stmt_locs| stmt_locs.first())
            {
                locs.push(format!("#{stmt_idx} {:?}", loc.diagnostic_location(db).debug(db)))
            }
        }

        anyhow::anyhow!("Failed to create runnable builder: {}\n{}", err, locs.join("\n"));
    };

Copy link
Collaborator

@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.

:lgtm:

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

Copy link
Collaborator

@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 r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)

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