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

Wrong error location when slicing a slice #101796

Closed
Bunch-of-cells opened this issue Sep 14, 2022 · 2 comments
Closed

Wrong error location when slicing a slice #101796

Bunch-of-cells opened this issue Sep 14, 2022 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Bunch-of-cells
Copy link

fn main() {
    let s = &[0, 1];
    let _ = &s[0..4];
}

The current output is:

thread 'main' panicked at 'range end index 4 out of range for slice of length 2', library/core/src/slice/index.rs:73:5

Ideally the output should look like:

thread 'main' panicked at 'range end index 4 out of range for slice of length 2', src/main.rs:3:21

The error location should be in main.rs, and not library/core/.../index.rs

@Bunch-of-cells Bunch-of-cells added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 14, 2022
@fmease
Copy link
Member

fmease commented Sep 14, 2022

This should already be fixed on nightly via #100759. Can you confirm this? This issue is probably a duplicate of #100696.

@compiler-errors
Copy link
Member

This is indeed fixed on nightly. Thanks for reporting the issue, closing now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants