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

Getting started in the book should state how to get a backtrace #27428

Closed
mdinger opened this Issue Jul 31, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@mdinger
Copy link
Contributor

mdinger commented Jul 31, 2015

This is the most annoying and most useless error message ever if you don't know how to get a backtrace. The docs should state how to get one. Without a backtrace it's only helpful if you already know where the error isn't always the case.

This:

vec![1, 2][7];

Returns:

thread '<main>' panicked at 'index out of bounds: the len is 2 but the index is 7', /home/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcollections/vec.rs:1359
playpen: application terminated with error code 101

@steveklabnik steveklabnik added the A-docs label Aug 13, 2015

@kstep

This comment has been minimized.

Copy link

kstep commented Aug 18, 2015

A better option may be not the full traceback by default, but just make panic point to user's code, not code from std, as Perl's Carp does, by unwinding stack trace up to the point where it goes out of "trusted" std code.

@kstep

This comment has been minimized.

Copy link

kstep commented Aug 18, 2015

I know all the problems with unwinding, but it's already there when you print traceback anyway, why not make another step to users?

steveklabnik added a commit to steveklabnik/rust that referenced this issue Aug 18, 2015

Add note about backtraces to TRPL
This is where panic!() is introduced.

Fixes rust-lang#27428
@mdinger

This comment has been minimized.

Copy link
Contributor Author

mdinger commented Aug 18, 2015

Nice! Now it's at least documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.