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

rustc_trans: apply the debug location for the MIR Assert panic call. #35141

Merged
merged 1 commit into from
Aug 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustc_trans/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {

// After this point, bcx is the block for the call to panic.
bcx = panic_block.build();
debug_loc.apply_to_bcx(&bcx);
Copy link
Member

Choose a reason for hiding this comment

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

I feel like this is a fairly easy stuff to overlook. I skimmed the context and haven’t found any more obvious instances of such mistake, but I feel like it is considerably easy to make similar mistake at any point in the future.

Perhaps we should consider making a wrapper of some sort for fcx.new_block?

Copy link
Member Author

Choose a reason for hiding this comment

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

When old trans is gone, we can have a simpler and less error-prone interface, i.e. a Block that always knows its debug position.


// Get the location information.
let loc = bcx.sess().codemap().lookup_char_pos(span.lo);
Expand Down