Skip to content

Handle higher-rank lifetimes when generating type IDs #19821

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

Merged
merged 3 commits into from
Dec 17, 2014

Conversation

bkoropoff
Copy link
Contributor

Normalize late-bound regions in bare functions, stack closures, and traits and include them in the generated hash.

Closes #19791

r? @nikomatsakis (does my normalization make sense?)
cc @alexcrichton

@@ -5780,128 +5780,162 @@ pub fn trait_item_of_item(tcx: &ctxt, def_id: ast::DefId)

/// Creates a hash of the type `Ty` which will be the same no matter what crate
/// context it's calculated within. This is used by the `type_id` intrinsic.
pub fn hash_crate_independent(tcx: &ctxt, ty: Ty, svh: &Svh) -> u64 {
pub fn hash_crate_independent<'tcx>(tcx: &'tcx ctxt, ty: Ty<'tcx>, svh: &Svh) -> u64 {
Copy link
Member

Choose a reason for hiding this comment

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

This is wrong and I would expect it to cause terrible errors.
'tcx is the lifetime parameter of ctxt, not its lifetime - &ctxt<'tcx> to be precise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch

@alexcrichton
Copy link
Member

This looks awesome, thanks @bkoropoff! And especially thanks for the thorough tests :)

@bkoropoff
Copy link
Contributor Author

My test also uncovered a small pretty printer bug. Bonus!

@nikomatsakis
Copy link
Contributor

r+ -- nice

Normalize late-bound regions in bare functions, stack closures,
and traits and include them in the generated hash.

Closes rust-lang#19791
@bkoropoff
Copy link
Contributor Author

Rebased to resolve merge conflicts and hoisted normalize into a top-level function. I think refactoring hash_crate_independent to be a type folder is a good idea, but I'd rather do it with a follow-up patch.

Need r=nikomatsakis

brson added a commit that referenced this pull request Dec 16, 2014
Normalize late-bound regions in bare functions, stack closures, and traits and include them in the generated hash.

Closes #19791

r? @nikomatsakis (does my normalization make sense?)
cc @alexcrichton
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Dec 17, 2014
Normalize late-bound regions in bare functions, stack closures, and traits and include them in the generated hash.

Closes rust-lang#19791

r? @nikomatsakis (does my normalization make sense?)
cc @alexcrichton
@bors bors merged commit 0a1798d into rust-lang:master Dec 17, 2014
Sign up for free to 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.

ICE: when non-static &str argument is encountered by TypeId
5 participants