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 spans in error reporting with unicode characters. #1100

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

maximebuyse
Copy link
Contributor

Fixes #1099

@maximebuyse
Copy link
Contributor Author

This fix only works when the unicode characters are on a different line from the error.

But something like:

fn f(x: usize) {
    let mut bar = 0;
    let mut opt = Some(x);
    /*äöü*/opt.take().map(|foo| bar = foo+1);
}

Open this code snippet in the playground

is still wrong

@maximebuyse
Copy link
Contributor Author

This fix only works when the unicode characters are on a different line from the error.

But something like:

fn f(x: usize) {
    let mut bar = 0;
    let mut opt = Some(x);
    /*äöü*/opt.take().map(|foo| bar = foo+1);
}

Open this code snippet in the playground

is still wrong

I pushed a new version fixing this as well. I introduced a new dependency to take care of this which simplifies and should hopefully be more reliable.

Copy link
Member

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

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

I don't like adding dependencies for something small like this.
But we want to surface backend errors nicely as well. So something may be needed anyway. Let's keep this on the radar to see how to deal with it.
But this fixes the issue at hand. Let's get it in.

@franziskuskiefer franziskuskiefer added this pull request to the merge queue Nov 5, 2024
Merged via the queue into main with commit acb0c3d Nov 5, 2024
14 checks passed
@franziskuskiefer franziskuskiefer deleted the fix-spans-unicode branch November 5, 2024 13:09
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.

Unicode in Comments shifts spans and can crash hax
2 participants