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

rustc: Remove codemap and reachable from metadata encoder #12589

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ use syntax::ast_util::*;
use syntax::ast_util;
use syntax::attr::AttrMetaMethods;
use syntax::attr;
use syntax::codemap;
use syntax::diagnostic::SpanHandler;
use syntax::parse::token::InternedString;
use syntax::parse::token::special_idents;
Expand Down Expand Up @@ -73,8 +72,6 @@ pub struct EncodeParams<'a> {
link_meta: &'a LinkMeta,
cstore: @cstore::CStore,
encode_inlined_item: EncodeInlinedItem<'a>,
reachable: @RefCell<HashSet<ast::NodeId>>,
codemap: @codemap::CodeMap,
}

struct Stats {
Expand Down Expand Up @@ -104,13 +101,6 @@ pub struct EncodeContext<'a> {
cstore: &'a cstore::CStore,
encode_inlined_item: EncodeInlinedItem<'a>,
type_abbrevs: abbrev_map,
reachable: @RefCell<HashSet<ast::NodeId>>,
codemap: @codemap::CodeMap,
}

pub fn reachable(ecx: &EncodeContext, id: NodeId) -> bool {
let reachable = ecx.reachable.borrow();
reachable.get().contains(&id)
}

fn encode_name(ebml_w: &mut writer::Encoder, name: Name) {
Expand Down Expand Up @@ -1630,7 +1620,7 @@ impl<'a, 'b> Visitor<()> for MacroDefVisitor<'a, 'b> {
fn visit_item(&mut self, item: &Item, _: ()) {
match item.node {
ItemMac(..) => {
let def = self.ecx.codemap.span_to_snippet(item.span)
let def = self.ecx.tcx.sess.codemap.span_to_snippet(item.span)
.expect("Unable to find source for macro");
self.ebml_w.start_tag(tag_macro_def);
self.ebml_w.wr_str(def);
Expand Down Expand Up @@ -1796,9 +1786,7 @@ fn encode_metadata_inner(wr: &mut MemWriter, parms: EncodeParams, krate: &Crate)
cstore,
encode_inlined_item,
link_meta,
reachable,
non_inlineable_statics,
codemap,
..
} = parms;
let type_abbrevs = @RefCell::new(HashMap::new());
Expand All @@ -1814,8 +1802,6 @@ fn encode_metadata_inner(wr: &mut MemWriter, parms: EncodeParams, krate: &Crate)
cstore: cstore,
encode_inlined_item: encode_inlined_item,
type_abbrevs: type_abbrevs,
reachable: reachable,
codemap: codemap,
};

let mut ebml_w = writer::Encoder(wr);
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2552,8 +2552,6 @@ pub fn crate_ctxt_to_encode_parms<'r>(cx: &'r CrateContext, ie: encoder::EncodeI
link_meta: link_meta,
cstore: cx.sess.cstore,
encode_inlined_item: ie,
reachable: cx.reachable,
codemap: cx.sess.codemap,
}
}

Expand Down