Skip to content

syntax: use an index in CodeMap instead of Gc for ExpnInfo. #17314

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
Sep 20, 2014

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Sep 16, 2014

No description provided.

@eddyb eddyb force-pushed the span-no-gc branch 2 times, most recently from ad7ec1e to 8b7847c Compare September 16, 2014 19:54
pub fn record_expansion(&self, expn_info: ExpnInfo) -> ExpnId {
let mut expansions = self.expansions.borrow_mut();
expansions.push(expn_info);
ExpnId(expansions.len().to_u32().unwrap() - 1)
Copy link
Member

Choose a reason for hiding this comment

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

as u32? (If you're doing this for verification/assertion purposes, .expect("too many ExpnInfo's") would be better.)

Copy link
Member

Choose a reason for hiding this comment

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

Also, minor point: this will break all the NO_EXPANSIONs if 232 - 1 elements are inserted.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it would break if 232 elements are inserted, which is what I'm checking for (I will switch to expect).

Copy link
Member

Choose a reason for hiding this comment

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

Oh, of course.

@eddyb eddyb force-pushed the span-no-gc branch 3 times, most recently from 4f26f69 to 0db5292 Compare September 18, 2014 02:55
loop {
let expn_info = self.codemap().with_expn_info(expn_id, |ei| {
ei.map(|ei| (ei.call_site, ei.callee.name.as_slice() == "include"))
})
Copy link
Member

Choose a reason for hiding this comment

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

plop a semicolon here.

@emberian
Copy link
Member

Also:

/home/cmr/src/rust/src/libsyntax/parse/mod.rs:739:42: 739:51 error: structure `codemap::Span` has no field named `expn_info`
/home/cmr/src/rust/src/libsyntax/parse/mod.rs:739         Span{lo:BytePos(a),hi:BytePos(b),expn_info:None}
                                                                                           ^~~~~~~~~

}
Ok(())
let cs = try!(cm.with_expn_info(sp.expn_id, |expn_info| match expn_info {
Some(ei) => {
Copy link
Member

Choose a reason for hiding this comment

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

Could be Ok(expn_info.map(|ei| { ... })) rather than a match.

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Sep 19, 2014
@bors bors merged commit f1a8f53 into rust-lang:master Sep 20, 2014
@eddyb eddyb deleted the span-no-gc branch March 9, 2017 13:40
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