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

[MIR] track Location in MirVisitor, combine Location #35542

Merged
merged 3 commits into from
Aug 27, 2016

Conversation

scottcarr
Copy link
Contributor

All the users of MirVisitor::visit_statement implement their own statement index tracking. This PR move the tracking into MirVisitor itself.

Also, there were 2 separate implementations of Location that were identical. This PR eliminates one of them.

@rust-highfive
Copy link
Collaborator

r? @eddyb

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

@scottcarr
Copy link
Contributor Author

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Aug 9, 2016
pub fn is_terminator(&self, mir: &Mir) -> bool {
self.statement_index < mir.basic_blocks()[self.block].statements.len()
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Missing newline.

@nikomatsakis
Copy link
Contributor

Seems like a win to me. @nagisa I don't quite understand your comment -- are you suggesting we should use a u32? I'm ok either way, especially given the temporary nature of this structure. I'm going to r+ I think but we can revisit.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Aug 9, 2016

📌 Commit 16785b6 has been approved by nikomatsakis

@nagisa
Copy link
Member

nagisa commented Aug 9, 2016

@nikomatsakis I’m suggesting there’s a potential overflow. We have usize = u16 targets. I feel like it is very possible to get into a situation where this usize is overflowed, and thus, terminator cannot be represented.

@jonas-schievink
Copy link
Contributor

Well, this is a host-usize. I'm assuming no 16-bit-usize target will ever run rustc.

@nikomatsakis
Copy link
Contributor

@nagisa I'm not quite following. If indeed we are running on a 16-bit host, then yes, usize will be 16-bits -- probably lots of stuff would fail, but anyway we surely (in that case) wouldn't have more than 2^16 statements in any given basic block, since that's the size of the address space we'd have available, and hence we'd still be able to represent the terminator in the same way, right?

@bors
Copy link
Contributor

bors commented Aug 11, 2016

☔ The latest upstream changes (presumably #35403) made this pull request unmergeable. Please resolve the merge conflicts.

@scottcarr scottcarr force-pushed the visitor_refactor branch 2 times, most recently from a178a8d to fe40004 Compare August 11, 2016 17:24
@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Aug 11, 2016

📌 Commit fe40004 has been approved by nikomatsakis

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Aug 11, 2016

📌 Commit fb84bb1 has been approved by nikomatsakis

Manishearth added a commit to Manishearth/rust that referenced this pull request Aug 13, 2016
…atsakis

[MIR] track Location in MirVisitor, combine Location

All the users of MirVisitor::visit_statement implement their own statement index tracking.  This PR move the tracking into MirVisitor itself.

Also, there were 2 separate implementations of Location that were identical.  This PR eliminates one of them.
@eddyb
Copy link
Member

eddyb commented Aug 14, 2016

@bors r- According to travis on #35649, this needs a rebase.

@bors
Copy link
Contributor

bors commented Aug 14, 2016

☔ The latest upstream changes (presumably #35409) made this pull request unmergeable. Please resolve the merge conflicts.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Aug 18, 2016

📌 Commit 0ff1282 has been approved by nikomatsakis

@nikomatsakis
Copy link
Contributor

@scottcarr hmm, these travis failures look legit...something about the interaction with constant expressions, perhaps an error in the port?

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Aug 26, 2016

📌 Commit c043a27 has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Aug 27, 2016

⌛ Testing commit c043a27 with merge b7e2157...

bors added a commit that referenced this pull request Aug 27, 2016
[MIR] track Location in MirVisitor, combine Location

All the users of MirVisitor::visit_statement implement their own statement index tracking.  This PR move the tracking into MirVisitor itself.

Also, there were 2 separate implementations of Location that were identical.  This PR eliminates one of them.
@bors bors merged commit c043a27 into rust-lang:master Aug 27, 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.

7 participants