Skip to content

Commit 8da044f

Browse files
committed
---
yaml --- r: 53951 b: refs/heads/dist-snap c: 429fed0 h: refs/heads/master i: 53949: 6536ebb 53947: 72e8f12 53943: 60927cf 53935: ee78b43 53919: b08a459 53887: 33e4fda v: v3
1 parent 49858dc commit 8da044f

File tree

15 files changed

+69
-179
lines changed

15 files changed

+69
-179
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: e1888948c640f8b8396091b336c2677cb82fdcce
10+
refs/heads/dist-snap: 429fed0c8b776de73937a39afc60a0ec93186c1c
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/front/config.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,19 @@ pub fn metas_in_cfg(cfg: ast::crate_cfg,
185185
// Pull the inner meta_items from the #[cfg(meta_item, ...)] attributes,
186186
// so we can match against them. This is the list of configurations for
187187
// which the item is valid
188-
let cfg_metas =
189-
vec::concat(
190-
vec::filter_map(cfg_metas, |i| attr::get_meta_item_list(i)));
191-
192-
let has_cfg_metas = vec::len(cfg_metas) > 0u;
193-
if !has_cfg_metas { return true; }
194-
195-
for cfg_metas.each |cfg_mi| {
196-
if attr::contains(cfg, *cfg_mi) { return true; }
197-
}
198-
199-
return false;
188+
let cfg_metas = vec::filter_map(cfg_metas, |i| attr::get_meta_item_list(i));
189+
190+
if cfg_metas.all(|c| c.is_empty()) { return true; }
191+
192+
cfg_metas.any(|cfg_meta| {
193+
cfg_meta.all(|cfg_mi| {
194+
match cfg_mi.node {
195+
ast::meta_list(s, ref it) if *s == ~"not"
196+
=> it.all(|mi| !attr::contains(cfg, *mi)),
197+
_ => attr::contains(cfg, *cfg_mi)
198+
}
199+
})
200+
})
200201
}
201202

202203

branches/dist-snap/src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,7 @@ fn get_self_ty(item: ebml::Doc) -> ast::self_ty_ {
631631
'v' => { return ast::sty_value; }
632632
'@' => { return ast::sty_box(get_mutability(string[1])); }
633633
'~' => { return ast::sty_uniq(get_mutability(string[1])); }
634-
'&' => {
635-
// FIXME(#4846) expl. region
636-
return ast::sty_region(None, get_mutability(string[1]));
637-
}
634+
'&' => { return ast::sty_region(get_mutability(string[1])); }
638635
_ => {
639636
fail!(fmt!("unknown self type code: `%c`", self_ty_kind as char));
640637
}

branches/dist-snap/src/librustc/metadata/encoder.rs

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -406,47 +406,32 @@ fn encode_self_type(ebml_w: writer::Encoder, self_type: ast::self_ty_) {
406406
ebml_w.start_tag(tag_item_trait_method_self_ty);
407407

408408
// Encode the base self type.
409+
let ch;
409410
match self_type {
410-
sty_static => {
411-
ebml_w.writer.write(&[ 's' as u8 ]);
412-
}
413-
sty_by_ref => {
414-
ebml_w.writer.write(&[ 'r' as u8 ]);
415-
}
416-
sty_value => {
417-
ebml_w.writer.write(&[ 'v' as u8 ]);
418-
}
419-
sty_region(_, m) => {
420-
// FIXME(#4846) encode custom lifetime
421-
ebml_w.writer.write(&[ '&' as u8 ]);
422-
encode_mutability(ebml_w, m);
411+
sty_static => { ch = 's' as u8; }
412+
sty_by_ref => { ch = 'r' as u8; }
413+
sty_value => { ch = 'v' as u8; }
414+
sty_region(_) => { ch = '&' as u8; }
415+
sty_box(_) => { ch = '@' as u8; }
416+
sty_uniq(_) => { ch = '~' as u8; }
417+
}
418+
ebml_w.writer.write(&[ ch ]);
419+
420+
// Encode mutability.
421+
match self_type {
422+
sty_static | sty_by_ref | sty_value => { /* No-op. */ }
423+
sty_region(m_imm) | sty_box(m_imm) | sty_uniq(m_imm) => {
424+
ebml_w.writer.write(&[ 'i' as u8 ]);
423425
}
424-
sty_box(m) => {
425-
ebml_w.writer.write(&[ '@' as u8 ]);
426-
encode_mutability(ebml_w, m);
426+
sty_region(m_mutbl) | sty_box(m_mutbl) | sty_uniq(m_mutbl) => {
427+
ebml_w.writer.write(&[ 'm' as u8 ]);
427428
}
428-
sty_uniq(m) => {
429-
ebml_w.writer.write(&[ '~' as u8 ]);
430-
encode_mutability(ebml_w, m);
429+
sty_region(m_const) | sty_box(m_const) | sty_uniq(m_const) => {
430+
ebml_w.writer.write(&[ 'c' as u8 ]);
431431
}
432432
}
433433

434434
ebml_w.end_tag();
435-
436-
fn encode_mutability(ebml_w: writer::Encoder,
437-
m: ast::mutability) {
438-
match m {
439-
m_imm => {
440-
ebml_w.writer.write(&[ 'i' as u8 ]);
441-
}
442-
m_mutbl => {
443-
ebml_w.writer.write(&[ 'm' as u8 ]);
444-
}
445-
m_const => {
446-
ebml_w.writer.write(&[ 'c' as u8 ]);
447-
}
448-
}
449-
}
450435
}
451436

452437
fn encode_method_sort(ebml_w: writer::Encoder, sort: char) {

branches/dist-snap/src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ fn visit_fn(fk: &visit::fn_kind,
472472
special_idents::self_,
473473
by_ref));
474474
}
475-
sty_value | sty_region(*) | sty_box(_) | sty_uniq(_) => {
475+
sty_value | sty_region(_) | sty_box(_) | sty_uniq(_) => {
476476
fn_maps.add_variable(Arg(method.self_id,
477477
special_idents::self_,
478478
by_copy));

branches/dist-snap/src/librustc/middle/trans/meth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ pub fn trans_trait_callee(bcx: block,
589589
let llpair = self_datum.to_ref_llval(bcx);
590590
591591
let llpair = match explicit_self {
592-
ast::sty_region(*) => Load(bcx, llpair),
592+
ast::sty_region(_) => Load(bcx, llpair),
593593
ast::sty_static | ast::sty_by_ref | ast::sty_value |
594594
ast::sty_box(_) | ast::sty_uniq(_) => llpair
595595
};
@@ -658,7 +658,7 @@ pub fn trans_trait_callee_from_llval(bcx: block,
658658
bcx.tcx().sess.bug(~"methods with by-value self should not be \
659659
called on objects");
660660
}
661-
ast::sty_region(*) => {
661+
ast::sty_region(_) => {
662662
// As before, we need to pass a pointer to a pointer to the
663663
// payload.
664664
match store {

branches/dist-snap/src/librustc/middle/trans/reflect.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ pub impl Reflector {
105105
v,
106106
ty::BoxTraitStore,
107107
ast::sty_region(
108-
None,
109108
ast::m_imm)),
110109
ArgVals(args), SaveIn(scratch.val), DontAutorefArg);
111110
let result = scratch.to_value_llval(bcx);

branches/dist-snap/src/librustc/middle/typeck/check/method.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -743,12 +743,10 @@ pub impl LookupContext/&self {
743743
sty_box(_) | sty_uniq(_) => {
744744
self_substs
745745
}
746-
sty_region(*) if self_substs.self_r.is_some() => {
747-
// FIXME(#4846) ignoring expl lifetime here
746+
sty_region(_) if self_substs.self_r.is_some() => {
748747
self_substs
749748
}
750-
sty_region(*) => {
751-
// FIXME(#4846) ignoring expl lifetime here
749+
sty_region(_) => {
752750
substs {
753751
self_r:
754752
Some(self.infcx().next_region_var(
@@ -1328,8 +1326,7 @@ pub fn transform_self_type_for_method(tcx: ty::ctxt,
13281326
sty_by_ref | sty_value => {
13291327
impl_ty
13301328
}
1331-
sty_region(_, mutability) => {
1332-
// FIXME(#4846) ignoring expl lifetime here
1329+
sty_region(mutability) => {
13331330
mk_rptr(tcx,
13341331
self_region.expect(~"self region missing for &self param"),
13351332
ty::mt { ty: impl_ty, mutbl: mutability })

branches/dist-snap/src/librustc/middle/typeck/check/regionmanip.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ pub fn replace_bound_regions_in_fn_sig(
3030
isr: isr_alist,
3131
self_info: Option<SelfInfo>,
3232
fn_sig: &ty::FnSig,
33-
mapf: &fn(ty::bound_region) -> ty::Region)
34-
-> (isr_alist, Option<SelfInfo>, ty::FnSig)
35-
{
33+
mapf: &fn(ty::bound_region) -> ty::Region) ->
34+
(isr_alist, Option<SelfInfo>, ty::FnSig) {
3635
// Take self_info apart; the self_ty part is the only one we want
3736
// to update here.
3837
let self_ty = self_info.map(|s| s.self_ty);
@@ -42,10 +41,8 @@ pub fn replace_bound_regions_in_fn_sig(
4241

4342
match self_info {
4443
Some(SelfInfo {
45-
explicit_self: codemap::spanned {
46-
node: ast::sty_region(_, m),
47-
// FIXME(#4846) ------^ Use this lifetime instead of self
48-
_}, _}) => {
44+
explicit_self: codemap::spanned { node: ast::sty_region(m),
45+
_}, _}) => {
4946
let region = ty::re_bound(ty::br_self);
5047
let ty = ty::mk_rptr(tcx, region,
5148
ty::mt { ty: ty::mk_self(tcx), mutbl: m });
@@ -54,6 +51,7 @@ pub fn replace_bound_regions_in_fn_sig(
5451
_ => {}
5552
}
5653

54+
5755
for self_ty.each |t| { all_tys.push(*t) }
5856

5957
debug!("replace_bound_regions_in_fn_sig(self_info.self_ty=%?, fn_sig=%s, \

branches/dist-snap/src/libsyntax/ast.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,18 +1001,18 @@ impl to_bytes::IterBytes for ret_style {
10011001
#[auto_decode]
10021002
#[deriving_eq]
10031003
pub enum self_ty_ {
1004-
sty_static, // no self
1005-
sty_by_ref, // ``
1006-
sty_value, // `self`
1007-
sty_region(Option<@Lifetime>, mutability), // `&'lt self`
1008-
sty_box(mutability), // `@self`
1009-
sty_uniq(mutability) // `~self`
1004+
sty_static, // no self: static method
1005+
sty_by_ref, // old by-reference self: ``
1006+
sty_value, // by-value self: `self`
1007+
sty_region(mutability), // by-region self: `&self`
1008+
sty_box(mutability), // by-managed-pointer self: `@self`
1009+
sty_uniq(mutability) // by-unique-pointer self: `~self`
10101010
}
10111011
10121012
impl self_ty_ {
10131013
fn is_borrowed(&self) -> bool {
10141014
match *self {
1015-
sty_region(*) => true,
1015+
sty_region(_) => true,
10161016
_ => false
10171017
}
10181018
}

branches/dist-snap/src/libsyntax/ext/auto_encode.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,8 @@ fn mk_ser_method(
634634
ident: cx.ident_of(~"encode"),
635635
attrs: ~[],
636636
generics: ast_util::empty_generics(),
637-
self_ty: codemap::spanned {
638-
node: ast::sty_region(None, ast::m_imm),
639-
span: span
640-
},
637+
self_ty: codemap::spanned { node: ast::sty_region(ast::m_imm),
638+
span: span },
641639
purity: ast::impure_fn,
642640
decl: ser_decl,
643641
body: ser_body,

branches/dist-snap/src/libsyntax/ext/deriving.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ fn create_eq_method(cx: @ext_ctxt,
220220
let body_block = build::mk_simple_block(cx, span, body);
221221

222222
// Create the method.
223-
let self_ty = spanned { node: sty_region(None, m_imm), span: span };
223+
let self_ty = spanned { node: sty_region(m_imm), span: span };
224224
@ast::method {
225225
ident: method_ident,
226226
attrs: ~[],
@@ -398,7 +398,7 @@ fn create_iter_bytes_method(cx: @ext_ctxt,
398398
let body_block = build::mk_block_(cx, span, statements);
399399

400400
// Create the method.
401-
let self_ty = spanned { node: sty_region(None, m_imm), span: span };
401+
let self_ty = spanned { node: sty_region(m_imm), span: span };
402402
let method_ident = cx.ident_of(~"iter_bytes");
403403
@ast::method {
404404
ident: method_ident,
@@ -448,7 +448,7 @@ fn create_clone_method(cx: @ext_ctxt,
448448
let body_block = build::mk_simple_block(cx, span, expr);
449449

450450
// Create the self type and method identifier.
451-
let self_ty = spanned { node: sty_region(None, m_imm), span: span };
451+
let self_ty = spanned { node: sty_region(m_imm), span: span };
452452
let method_ident = cx.ident_of(~"clone");
453453

454454
// Create the method.

branches/dist-snap/src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -966,13 +966,6 @@ pub impl Parser {
966966
}
967967
}
968968

969-
fn token_is_lifetime(&self, tok: &token::Token) -> bool {
970-
match *tok {
971-
token::LIFETIME(_) => true,
972-
_ => false
973-
}
974-
}
975-
976969
fn parse_lifetime(&self) -> ast::Lifetime {
977970
/*!
978971
*
@@ -1040,11 +1033,6 @@ pub impl Parser {
10401033
}
10411034
}
10421035

1043-
fn token_is_mutability(&self, tok: &token::Token) -> bool {
1044-
self.token_is_keyword(&~"mut", tok) ||
1045-
self.token_is_keyword(&~"const", tok)
1046-
}
1047-
10481036
fn parse_mutability(&self) -> mutability {
10491037
if self.eat_keyword(&~"mut") {
10501038
m_mutbl
@@ -2849,63 +2837,14 @@ pub impl Parser {
28492837
}
28502838
}
28512839

2852-
fn maybe_parse_borrowed_self_ty(
2853-
self: &Parser
2854-
) -> ast::self_ty_ {
2855-
// The following things are possible to see here:
2856-
//
2857-
// fn(&self)
2858-
// fn(&mut self)
2859-
// fn(&'lt self)
2860-
// fn(&'lt mut self)
2861-
//
2862-
// We already know that the current token is `&`.
2863-
2864-
if (
2865-
self.token_is_keyword(&~"self", &self.look_ahead(1)))
2866-
{
2867-
self.bump();
2868-
self.expect_self_ident();
2869-
sty_region(None, m_imm)
2870-
} else if (
2871-
self.token_is_mutability(&self.look_ahead(1)) &&
2872-
self.token_is_keyword(&~"self", &self.look_ahead(2)))
2873-
{
2874-
self.bump();
2875-
let mutability = self.parse_mutability();
2876-
self.expect_self_ident();
2877-
sty_region(None, mutability)
2878-
} else if (
2879-
self.token_is_lifetime(&self.look_ahead(1)) &&
2880-
self.token_is_keyword(&~"self", &self.look_ahead(2)))
2881-
{
2882-
self.bump();
2883-
let lifetime = @self.parse_lifetime();
2884-
self.expect_self_ident();
2885-
sty_region(Some(lifetime), m_imm)
2886-
} else if (
2887-
self.token_is_lifetime(&self.look_ahead(1)) &&
2888-
self.token_is_mutability(&self.look_ahead(2)) &&
2889-
self.token_is_keyword(&~"self", &self.look_ahead(3)))
2890-
{
2891-
self.bump();
2892-
let lifetime = @self.parse_lifetime();
2893-
let mutability = self.parse_mutability();
2894-
self.expect_self_ident();
2895-
sty_region(Some(lifetime), mutability)
2896-
} else {
2897-
sty_by_ref
2898-
}
2899-
}
2900-
29012840
self.expect(&token::LPAREN);
29022841

29032842
// A bit of complexity and lookahead is needed here in order to to be
29042843
// backwards compatible.
29052844
let lo = self.span.lo;
29062845
let self_ty = match *self.token {
29072846
token::BINOP(token::AND) => {
2908-
maybe_parse_borrowed_self_ty(self)
2847+
maybe_parse_self_ty(sty_region, self)
29092848
}
29102849
token::AT => {
29112850
maybe_parse_self_ty(sty_box, self)

0 commit comments

Comments
 (0)