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

save-analysis: fix a bug with tuple sub-expressions #34327

Merged
merged 1 commit into from
Jul 7, 2016

Conversation

nrc
Copy link
Member

@nrc nrc commented Jun 17, 2016

No description provided.

@rust-highfive
Copy link
Collaborator

r? @arielb1

(rust_highfive has picked a reviewer for you, use r? to override)

@jseyfried
Copy link
Contributor

I fixed the underlying cause of this bug in #34355.

@nrc
Copy link
Member Author

nrc commented Jun 28, 2016

ping @arielb1 for review

re @jseyfried 's comment, even if the underlying cause of the bug is fixed, I would like this to land since it adds a layer of safety.

Some(Node::NodeExpr(expr)) => expr,
_ => {
debug!("Missing or weird node for sub-expression {} in {:?}",
sub_ex.id, ex);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: If sub_ex.id is not mapped to an hir expression node, I think that's solely a problem with sub_ex and sub_ex.id -- I don't think ex is relevant.

Copy link
Member Author

Choose a reason for hiding this comment

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

My reasoning is that if subex is messed up for some other reason, then it is useful to have an expression which we know is not messed up. I also find it easier to debug this way - you get a reference to say (a, b, x + 4) rather than a and the former is easier to grep for.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense.

@jseyfried
Copy link
Contributor

@nrc r=me with or without the nit

Manishearth added a commit to Manishearth/rust that referenced this pull request Jun 29, 2016
…nique, r=nrc

Give `ast::ExprKind::Paren` no-op expressions the same ids as their children.

Having `ast::ExprKind::Paren` expressions share ids with their children
 - reduces the number of unused `NodeId`s in the hir map and
 - guarantees that `tcx.map.expect_expr(ast_expr.id)` is the hir corresponding to `ast_expr`.

This fixes the bug from rust-lang#34327, which was introduced in rust-lang#33296 when I assumed the above guarantee.

r? @nrc
@nrc
Copy link
Member Author

nrc commented Jul 5, 2016

@bors: r=jseyfried rollup

@bors
Copy link
Contributor

bors commented Jul 5, 2016

📌 Commit 60e19ce has been approved by jseyfried

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jul 6, 2016
save-analysis: fix a bug with tuple sub-expressions
bors added a commit that referenced this pull request Jul 7, 2016
@bors bors merged commit 60e19ce into rust-lang:master Jul 7, 2016
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.

5 participants