Skip to content

Commit aa67def

Browse files
committed
remove sty_by_ref, though traces still remain due to dtors
1 parent 2888563 commit aa67def

File tree

15 files changed

+18
-88
lines changed

15 files changed

+18
-88
lines changed

src/librustc/metadata/decoder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,6 @@ fn get_self_ty(item: ebml::Doc) -> ast::self_ty_ {
630630
let self_ty_kind = string[0];
631631
match self_ty_kind as char {
632632
's' => { return ast::sty_static; }
633-
'r' => { return ast::sty_by_ref; }
634633
'v' => { return ast::sty_value; }
635634
'@' => { return ast::sty_box(get_mutability(string[1])); }
636635
'~' => { return ast::sty_uniq(get_mutability(string[1])); }

src/librustc/metadata/encoder.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,6 @@ fn encode_self_type(ebml_w: writer::Encoder, self_type: ast::self_ty_) {
410410
sty_static => {
411411
ebml_w.writer.write(&[ 's' as u8 ]);
412412
}
413-
sty_by_ref => {
414-
ebml_w.writer.write(&[ 'r' as u8 ]);
415-
}
416413
sty_value => {
417414
ebml_w.writer.write(&[ 'v' as u8 ]);
418415
}

src/librustc/middle/borrowck/gather_loans.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -180,21 +180,6 @@ fn req_loans_in_expr(ex: @ast::expr,
180180
}
181181
}
182182

183-
match self.bccx.method_map.find(&ex.id) {
184-
Some(ref method_map_entry) => {
185-
match (*method_map_entry).explicit_self {
186-
ast::sty_by_ref => {
187-
let rcvr_cmt = self.bccx.cat_expr(rcvr);
188-
self.guarantee_valid(rcvr_cmt, m_imm, scope_r);
189-
}
190-
_ => {} // Nothing to do.
191-
}
192-
}
193-
None => {
194-
self.tcx().sess.span_bug(ex.span, ~"no method map entry");
195-
}
196-
}
197-
198183
visit::visit_expr(ex, self, vt);
199184
}
200185

src/librustc/middle/liveness.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,6 @@ fn visit_fn(fk: &visit::fn_kind,
467467
match *fk {
468468
fk_method(_, _, method) => {
469469
match method.self_ty.node {
470-
sty_by_ref => {
471-
fn_maps.add_variable(Arg(method.self_id,
472-
special_idents::self_,
473-
by_ref));
474-
}
475470
sty_value | sty_region(*) | sty_box(_) | sty_uniq(_) => {
476471
fn_maps.add_variable(Arg(method.self_id,
477472
special_idents::self_,

src/librustc/middle/moves.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -737,20 +737,7 @@ pub impl VisitContext {
737737
receiver_expr: @expr,
738738
visitor: vt<VisitContext>)
739739
{
740-
let callee_mode = match self.method_map.find(&expr_id) {
741-
Some(ref method_map_entry) => {
742-
match method_map_entry.explicit_self {
743-
sty_by_ref => by_ref,
744-
_ => by_copy
745-
}
746-
}
747-
None => {
748-
self.tcx.sess.span_bug(
749-
span,
750-
~"no method map entry");
751-
}
752-
};
753-
self.use_fn_arg(callee_mode, receiver_expr, visitor);
740+
self.use_fn_arg(by_copy, receiver_expr, visitor);
754741
}
755742

756743
fn use_fn_args(&self,

src/librustc/middle/resolve.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use syntax::ast::{named_field, ne, neg, node_id, pat, pat_enum, pat_ident};
5050
use syntax::ast::{path, pat_box, pat_lit, pat_range, pat_struct};
5151
use syntax::ast::{pat_tup, pat_uniq, pat_wild, prim_ty, private, provided};
5252
use syntax::ast::{public, required, rem, self_ty_, shl, shr, stmt_decl};
53-
use syntax::ast::{struct_dtor, struct_field, struct_variant_kind, sty_by_ref};
53+
use syntax::ast::{struct_dtor, struct_field, struct_variant_kind};
5454
use syntax::ast::{sty_static, subtract, trait_ref, tuple_variant_kind, Ty};
5555
use syntax::ast::{ty_bool, ty_char, ty_f, ty_f32, ty_f64, ty_float, ty_i};
5656
use syntax::ast::{ty_i16, ty_i32, ty_i64, ty_i8, ty_int, TyParam, ty_path};
@@ -3792,7 +3792,6 @@ pub impl Resolver {
37923792
// we only have self ty if it is a non static method
37933793
let self_binding = match method.self_ty.node {
37943794
sty_static => { NoSelfBinding }
3795-
sty_by_ref => { HasSelfBinding(method.self_id, true) }
37963795
_ => { HasSelfBinding(method.self_id, false) }
37973796
};
37983797

src/librustc/middle/trans/meth.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ pub fn trans_trait_callee(bcx: block,
596596
597597
let llpair = match explicit_self {
598598
ast::sty_region(*) => Load(bcx, llpair),
599-
ast::sty_static | ast::sty_by_ref | ast::sty_value |
599+
ast::sty_static | ast::sty_value |
600600
ast::sty_box(_) | ast::sty_uniq(_) => llpair
601601
};
602602
@@ -645,21 +645,6 @@ pub fn trans_trait_callee_from_llval(bcx: block,
645645
ast::sty_static => {
646646
bcx.tcx().sess.bug(~"shouldn't see static method here");
647647
}
648-
ast::sty_by_ref => {
649-
// We need to pass a pointer to a pointer to the payload.
650-
match store {
651-
ty::BoxTraitStore |
652-
ty::BareTraitStore |
653-
ty::UniqTraitStore => {
654-
llself = GEPi(bcx, llbox, [0u, abi::box_field_body]);
655-
}
656-
ty::RegionTraitStore(_) => {
657-
llself = llbox;
658-
}
659-
}
660-
661-
self_mode = ast::by_ref;
662-
}
663648
ast::sty_value => {
664649
bcx.tcx().sess.bug(~"methods with by-value self should not be \
665650
called on objects");

src/librustc/middle/typeck/check/method.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ use core::hashmap::linear::LinearSet;
9999
use core::result;
100100
use core::uint;
101101
use core::vec;
102-
use syntax::ast::{def_id, sty_by_ref, sty_value, sty_region, sty_box};
102+
use syntax::ast::{def_id, sty_value, sty_region, sty_box};
103103
use syntax::ast::{sty_uniq, sty_static, node_id, by_copy, by_ref};
104104
use syntax::ast::{m_const, m_mutbl, m_imm};
105105
use syntax::ast;
@@ -527,7 +527,7 @@ pub impl<'self> LookupContext<'self> {
527527
ast::sty_region(_) => {
528528
return; // inapplicable
529529
}
530-
ast::sty_by_ref | ast::sty_region(_) => vstore_slice(r)
530+
ast::sty_region(_) => vstore_slice(r)
531531
ast::sty_box(_) => vstore_box, // XXX NDM mutability
532532
ast::sty_uniq(_) => vstore_uniq
533533
}
@@ -741,7 +741,7 @@ pub impl<'self> LookupContext<'self> {
741741
// shouldn't really have to be.
742742
let rcvr_substs = {
743743
match self_decl {
744-
sty_static | sty_value | sty_by_ref |
744+
sty_static | sty_value |
745745
sty_box(_) | sty_uniq(_) => {
746746
self_substs
747747
}
@@ -1327,7 +1327,7 @@ pub fn transform_self_type_for_method(tcx: ty::ctxt,
13271327
tcx.sess.bug(~"calling transform_self_type_for_method on \
13281328
static method");
13291329
}
1330-
sty_by_ref | sty_value => {
1330+
sty_value => {
13311331
impl_ty
13321332
}
13331333
sty_region(_, mutability) => {

src/libsyntax/ast.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,6 @@ impl to_bytes::IterBytes for ret_style {
10031003
#[deriving(Eq)]
10041004
pub enum self_ty_ {
10051005
sty_static, // no self
1006-
sty_by_ref, // ``
10071006
sty_value, // `self`
10081007
sty_region(Option<@Lifetime>, mutability), // `&'lt self`
10091008
sty_box(mutability), // `@self`

src/libsyntax/ext/deriving/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use ast::{item_enum, item_impl, item_struct, Generics};
1717
use ast::{m_imm, meta_item, method};
1818
use ast::{named_field, or, pat, pat_ident, pat_wild, public, pure_fn};
1919
use ast::{stmt, struct_def, struct_variant_kind};
20-
use ast::{sty_by_ref, sty_region, tuple_variant_kind, ty_nil, TyParam};
20+
use ast::{sty_region, tuple_variant_kind, ty_nil, TyParam};
2121
use ast::{TyParamBound, ty_path, ty_rptr, unnamed_field, variant};
2222
use ext::base::ext_ctxt;
2323
use ext::build;

src/libsyntax/ext/deriving/eq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use ast::{item_enum, item_impl, item_struct, Generics};
1717
use ast::{m_imm, meta_item, method};
1818
use ast::{named_field, or, pat, pat_ident, pat_wild, public, pure_fn};
1919
use ast::{stmt, struct_def, struct_variant_kind};
20-
use ast::{sty_by_ref, sty_region, tuple_variant_kind, ty_nil, TyParam};
20+
use ast::{sty_region, tuple_variant_kind, ty_nil, TyParam};
2121
use ast::{TyParamBound, ty_path, ty_rptr, unnamed_field, variant};
2222
use ext::base::ext_ctxt;
2323
use ext::build;

src/libsyntax/ext/deriving/iter_bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use ast::{item_enum, item_impl, item_struct, Generics};
1717
use ast::{m_imm, meta_item, method};
1818
use ast::{named_field, or, pat, pat_ident, pat_wild, public, pure_fn};
1919
use ast::{stmt, struct_def, struct_variant_kind};
20-
use ast::{sty_by_ref, sty_region, tuple_variant_kind, ty_nil, TyParam};
20+
use ast::{sty_region, tuple_variant_kind, ty_nil, TyParam};
2121
use ast::{TyParamBound, ty_path, ty_rptr, unnamed_field, variant};
2222
use ext::base::ext_ctxt;
2323
use ext::build;

src/libsyntax/ext/deriving/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use ast::{item_enum, item_impl, item_struct, Generics};
2020
use ast::{m_imm, meta_item, method};
2121
use ast::{named_field, or, pat, pat_ident, pat_wild, public, pure_fn};
2222
use ast::{stmt, struct_def, struct_variant_kind};
23-
use ast::{sty_by_ref, sty_region, tuple_variant_kind, ty_nil, TyParam};
23+
use ast::{sty_region, tuple_variant_kind, ty_nil, TyParam};
2424
use ast::{TyParamBound, ty_path, ty_rptr, unnamed_field, variant};
2525
use ext::base::ext_ctxt;
2626
use ext::build;

src/libsyntax/parse/parser.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use ast::{rem, required};
4646
use ast::{ret_style, return_val, self_ty, shl, shr, stmt, stmt_decl};
4747
use ast::{stmt_expr, stmt_semi, stmt_mac, struct_def, struct_field};
4848
use ast::{struct_immutable, struct_mutable, struct_variant_kind, subtract};
49-
use ast::{sty_box, sty_by_ref, sty_region, sty_static, sty_uniq, sty_value};
49+
use ast::{sty_box, sty_region, sty_static, sty_uniq, sty_value};
5050
use ast::{token_tree, trait_method, trait_ref, tt_delim, tt_seq, tt_tok};
5151
use ast::{tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot, ty_box};
5252
use ast::{ty_field, ty_fixed_length_vec, ty_closure, ty_bare_fn};
@@ -471,8 +471,6 @@ pub impl Parser {
471471
) |p| {
472472
let attrs = p.parse_outer_attributes();
473473
let lo = p.span.lo;
474-
let is_static = p.parse_staticness();
475-
let static_sty = spanned(lo, p.span.hi, sty_static);
476474

477475
let vis = p.parse_visibility();
478476
let pur = p.parse_fn_purity();
@@ -487,12 +485,6 @@ pub impl Parser {
487485
// names to be left off if there is a definition...
488486
either::Left(p.parse_arg_general(false))
489487
};
490-
// XXX: Wrong. Shouldn't allow both static and self_ty
491-
let self_ty = if is_static || self_ty.node == sty_by_ref {
492-
static_sty
493-
} else {
494-
self_ty
495-
};
496488

497489
let hi = p.last_span.hi;
498490
debug!("parse_trait_methods(): trait method signature ends in \
@@ -2877,7 +2869,7 @@ pub impl Parser {
28772869
p.expect_self_ident();
28782870
cnstr(mutability)
28792871
} else {
2880-
sty_by_ref
2872+
sty_static
28812873
}
28822874
}
28832875

@@ -2926,7 +2918,7 @@ pub impl Parser {
29262918
self.expect_self_ident();
29272919
sty_region(Some(lifetime), mutability)
29282920
} else {
2929-
sty_by_ref
2921+
sty_static
29302922
}
29312923
}
29322924

@@ -2950,13 +2942,13 @@ pub impl Parser {
29502942
sty_value
29512943
}
29522944
_ => {
2953-
sty_by_ref
2945+
sty_static
29542946
}
29552947
};
29562948

29572949
// If we parsed a self type, expect a comma before the argument list.
29582950
let args_or_capture_items;
2959-
if self_ty != sty_by_ref {
2951+
if self_ty != sty_static {
29602952
match *self.token {
29612953
token::COMMA => {
29622954
self.bump();
@@ -3058,7 +3050,6 @@ pub impl Parser {
30583050
let attrs = self.parse_outer_attributes();
30593051
let lo = self.span.lo;
30603052

3061-
let is_static = self.parse_staticness();
30623053
let static_sty = spanned(lo, self.span.hi, sty_static);
30633054

30643055
let visa = self.parse_visibility();
@@ -3068,12 +3059,6 @@ pub impl Parser {
30683059
let (self_ty, decl) = do self.parse_fn_decl_with_self() |p| {
30693060
p.parse_arg()
30703061
};
3071-
// XXX: interaction between staticness, self_ty is broken now
3072-
let self_ty = if is_static || self_ty.node == sty_by_ref {
3073-
static_sty
3074-
} else {
3075-
self_ty
3076-
};
30773062

30783063
let (inner_attrs, body) = self.parse_inner_attrs_and_block(true);
30793064
let hi = body.span.hi;

src/libsyntax/print/pprust.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ pub fn print_pat(s: @ps, &&pat: @ast::pat, refutable: bool) {
16431643
// Returns whether it printed anything
16441644
pub fn print_self_ty(s: @ps, self_ty: ast::self_ty_) -> bool {
16451645
match self_ty {
1646-
ast::sty_static | ast::sty_by_ref => { return false; }
1646+
ast::sty_static => { return false; }
16471647
ast::sty_value => { word(s.s, ~"self"); }
16481648
ast::sty_region(lt, m) => {
16491649
word(s.s, ~"&");
@@ -1669,7 +1669,7 @@ pub fn print_fn(s: @ps,
16691669
opt_self_ty: Option<ast::self_ty_>,
16701670
vis: ast::visibility) {
16711671
head(s, ~"");
1672-
print_fn_header_info(s, opt_self_ty, purity, ast::Many, None, vis);
1672+
print_fn_header_info(s, purity, ast::Many, None, vis);
16731673
nbsp(s);
16741674
print_ident(s, name);
16751675
print_generics(s, generics);
@@ -2175,7 +2175,6 @@ pub fn print_opt_sigil(s: @ps, opt_sigil: Option<ast::Sigil>) {
21752175
}
21762176

21772177
pub fn print_fn_header_info(s: @ps,
2178-
opt_sty: Option<ast::self_ty_>,
21792178
purity: ast::purity,
21802179
onceness: ast::Onceness,
21812180
opt_sigil: Option<ast::Sigil>,

0 commit comments

Comments
 (0)