Skip to content

ICH: Hash expression spans if their source location is captured for panics. - #37513

Merged
bors merged 2 commits into
rust-lang:masterfrom
michaelwoerister:hash-panic-spans
Nov 3, 2016
Merged

ICH: Hash expression spans if their source location is captured for panics.#37513
bors merged 2 commits into
rust-lang:masterfrom
michaelwoerister:hash-panic-spans

Conversation

@michaelwoerister

Copy link
Copy Markdown
Member

Since the location of some expressions is captured in error message constants, it has an influence on machine code and consequently we need to take them into account by the incr. comp. hash. This PR makes this happen for +, -, *, /, % and for array indexing -- let me know if I forgot anything.

In the future we might want to change the codegen strategy for those error messages, so that they are stored in a separate object file with a stable symbol name, so that only this object file has to be regenerated when source locations change. This strategy would also eliminate unnecessary duplications due to monomorphization, as @arielb1 has pointed out on IRC. I opened #37512, so we don't forget about this.

r? @nikomatsakis

@nikomatsakisnikomatsakis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

r=me with new test

}

fn maybe_enable_overflow_checks(&mut self, item_attrs: &[ast::Attribute]) {
if attr::contains_name(item_attrs, "rustc_inherit_overflow_checks") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

good catch, i'd forgotten about this, can we add this to the test?

@michaelwoerister

Copy link
Copy Markdown
MemberAuthor

@bors r=nikomatsakis

Test case added. Thanks for the review!

@bors

bors commented Nov 2, 2016

Copy link
Copy Markdown
Collaborator

📌 Commit 0e391bf has been approved by nikomatsakis

@sophiajtsophiajt mentioned this pull request Nov 2, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Nov 2, 2016
…r=nikomatsakis
ICH: Hash expression spans if their source location is captured for panics.
Since the location of some expressions is captured in error message constants, it has an influence on machine code and consequently we need to take them into account by the incr. comp. hash. This PR makes this happen for `+, -, *, /, %` and for array indexing -- let me know if I forgot anything.
In the future we might want to change the codegen strategy for those error messages, so that they are stored in a separate object file with a stable symbol name, so that only this object file has to be regenerated when source locations change. This strategy would also eliminate unnecessary duplications due to monomorphization, as @arielb1 has pointed out on IRC. I opened rust-lang#37512, so we don't forget about this.
r? @nikomatsakis
bors added a commit that referenced this pull request Nov 2, 2016
@bors
bors merged commit 0e391bf into rust-lang:masterNov 3, 2016
Sign up for freeto 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.

3 participants

@michaelwoerister@bors@nikomatsakis