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

Assertion reports wrong line number #3062

Closed
bstrie opened this issue Jul 31, 2012 · 3 comments
Closed

Assertion reports wrong line number #3062

bstrie opened this issue Jul 31, 2012 · 3 comments
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)

Comments

@bstrie
Copy link
Contributor

bstrie commented Jul 31, 2012

Test case:

fn dummy() {
    // padding
    // padding
    // padding
    // padding
    // padding
    // padding
    // padding
    // padding
    // padding
    // padding
    // padding
    // padding
    // padding
    // padding
}

fn main() {
                          // oopsie
    for [1,2,3,4,5].slice(3,1).each |x| { log(error, x); }  // Line 20, not line 1!
    assert true == false;  // This reports line 21 if you comment out the above line
}

Output (with incorrect line number):

rust: task failed at 'Assertion start <= end failed', fail.rs:1

Expected output:

rust: task failed at 'Assertion start <= end failed', fail.rs:20
@bstrie
Copy link
Contributor Author

bstrie commented Dec 11, 2012

Just verified that this bug is still present.

@pcwalton
Copy link
Contributor

This is definitely not backwards incompatible.

@alexcrichton
Copy link
Member

I think this has been fixed now, when I used error!(x) instead of log(error, x) I got:

rust: task failed at 'assertion failed: start <= end', /Users/alex/code/rust-opt/src/libstd/vec.rs:743

Which I believe is what's intended.

RalfJung pushed a commit to RalfJung/rust that referenced this issue Sep 25, 2023
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
This new method will assert that a pointer isn't null, and that its is
valid for access of a given type.

Co-authored-by: Zyad Hassan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)
Projects
None yet
Development

No branches or pull requests

3 participants