Skip to content

Commit

Permalink
auto merge of #12807 : pnkfelix/rust/fsk-issue5121-fns-with-early-lif…
Browse files Browse the repository at this point in the history
…etime-params, r=pnkfelix

Fix issue #5121: Add proper support for early/late distinction for lifetime bindings.

There are some little refactoring cleanups as separate commits; the real meat that has the actual fix is in the final commit.

The original author of the work was @nikomatsakis; I have reviewed it, revised it slightly, refactored it into these separate commits, and done some rebasing work.
  • Loading branch information
bors committed Mar 12, 2014
2 parents 397abb7 + 742e458 commit c2e5135
Show file tree
Hide file tree
Showing 44 changed files with 702 additions and 313 deletions.
4 changes: 2 additions & 2 deletions src/librustc/front/std_inject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ impl fold::Folder for PreludeInjector {
segments: vec!(
ast::PathSegment {
identifier: token::str_to_ident("std"),
lifetimes: opt_vec::Empty,
lifetimes: Vec::new(),
types: opt_vec::Empty,
},
ast::PathSegment {
identifier: token::str_to_ident("prelude"),
lifetimes: opt_vec::Empty,
lifetimes: Vec::new(),
types: opt_vec::Empty,
}),
};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/front/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ fn path_node(ids: Vec<ast::Ident> ) -> ast::Path {
global: false,
segments: ids.move_iter().map(|identifier| ast::PathSegment {
identifier: identifier,
lifetimes: opt_vec::Empty,
lifetimes: Vec::new(),
types: opt_vec::Empty,
}).collect()
}
Expand All @@ -381,7 +381,7 @@ fn path_node_global(ids: Vec<ast::Ident> ) -> ast::Path {
global: true,
segments: ids.move_iter().map(|identifier| ast::PathSegment {
identifier: identifier,
lifetimes: opt_vec::Empty,
lifetimes: Vec::new(),
types: opt_vec::Empty,
}).collect()
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ fn item_region_param_defs(item_doc: ebml::Doc, cdata: Cmd)
tag_region_param_def_def_id);
let def_id = reader::with_doc_data(def_id_doc, parse_def_id);
let def_id = translate_def_id(cdata, def_id);
v.push(ty::RegionParameterDef { ident: ident.name,
v.push(ty::RegionParameterDef { name: ident.name,
def_id: def_id });
true
});
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ fn encode_region_param_defs(ebml_w: &mut writer::Encoder,
ebml_w.start_tag(tag_region_param_def);

ebml_w.start_tag(tag_region_param_def_ident);
encode_name(ebml_w, param.ident);
encode_name(ebml_w, param.name);
ebml_w.end_tag();

ebml_w.wr_tagged_str(tag_region_param_def_def_id,
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/metadata/tyencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ fn enc_region(w: &mut MemWriter, cx: @ctxt, r: ty::Region) {
enc_bound_region(w, cx, br);
mywrite!(w, "]");
}
ty::ReEarlyBound(node_id, index, ident) => {
ty::ReEarlyBound(node_id, index, name) => {
mywrite!(w, "B[{}|{}|{}]",
node_id,
index,
token::get_name(ident));
token::get_name(name));
}
ty::ReFree(ref fr) => {
mywrite!(w, "f[{}|", fr.scope_id);
Expand Down Expand Up @@ -208,10 +208,10 @@ fn enc_bound_region(w: &mut MemWriter, cx: @ctxt, br: ty::BoundRegion) {
ty::BrAnon(idx) => {
mywrite!(w, "a{}|", idx);
}
ty::BrNamed(d, s) => {
ty::BrNamed(d, name) => {
mywrite!(w, "[{}|{}]",
(cx.ds)(d),
token::get_name(s));
token::get_name(name));
}
ty::BrFresh(id) => {
mywrite!(w, "f{}|", id);
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/middle/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
//! which are available for use externally when compiled as a library.

use std::mem::replace;
use std::vec_ng::Vec;

use metadata::csearch;
use middle::lint;
Expand Down Expand Up @@ -855,7 +856,7 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
debug!("privacy - list {}", pid.node.id);
let seg = ast::PathSegment {
identifier: pid.node.name,
lifetimes: opt_vec::Empty,
lifetimes: Vec::new(),
types: opt_vec::Empty,
};
let segs = vec!(seg);
Expand Down
Loading

0 comments on commit c2e5135

Please sign in to comment.