Skip to content

Commit c06ee9f

Browse files
committed
Merge remote-tracking branch 'cmr/various-cleanup' into incoming
2 parents f480686 + 116897f commit c06ee9f

File tree

11 files changed

+21
-39
lines changed

11 files changed

+21
-39
lines changed

src/librustc/metadata/decoder.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ enum Family {
100100
Const, // c
101101
Fn, // f
102102
UnsafeFn, // u
103-
PureFn, // p
104103
StaticMethod, // F
105104
UnsafeStaticMethod, // U
106-
PureStaticMethod, // P
107105
ForeignFn, // e
108106
Type, // y
109107
ForeignType, // T
@@ -125,10 +123,8 @@ fn item_family(item: ebml::Doc) -> Family {
125123
'c' => Const,
126124
'f' => Fn,
127125
'u' => UnsafeFn,
128-
'p' => PureFn,
129126
'F' => StaticMethod,
130127
'U' => UnsafeStaticMethod,
131-
'P' => PureStaticMethod,
132128
'e' => ForeignFn,
133129
'y' => Type,
134130
'T' => ForeignType,
@@ -325,7 +321,6 @@ fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::crate_num)
325321
Struct => dl_def(ast::def_struct(did)),
326322
UnsafeFn => dl_def(ast::def_fn(did, ast::unsafe_fn)),
327323
Fn => dl_def(ast::def_fn(did, ast::impure_fn)),
328-
PureFn => dl_def(ast::def_fn(did, ast::pure_fn)),
329324
ForeignFn => dl_def(ast::def_fn(did, ast::extern_fn)),
330325
UnsafeStaticMethod => {
331326
let trait_did_opt = translated_parent_item_opt(cnum, item);
@@ -335,10 +330,6 @@ fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::crate_num)
335330
let trait_did_opt = translated_parent_item_opt(cnum, item);
336331
dl_def(ast::def_static_method(did, trait_did_opt, ast::impure_fn))
337332
}
338-
PureStaticMethod => {
339-
let trait_did_opt = translated_parent_item_opt(cnum, item);
340-
dl_def(ast::def_static_method(did, trait_did_opt, ast::pure_fn))
341-
}
342333
Type | ForeignType => dl_def(ast::def_ty(did)),
343334
Mod => dl_def(ast::def_mod(did)),
344335
ForeignMod => dl_def(ast::def_foreign_mod(did)),
@@ -822,12 +813,11 @@ pub fn get_static_methods_if_impl(intr: @ident_interner,
822813
let impl_method_doc = lookup_item(impl_method_id.node, cdata.data);
823814
let family = item_family(impl_method_doc);
824815
match family {
825-
StaticMethod | UnsafeStaticMethod | PureStaticMethod => {
816+
StaticMethod | UnsafeStaticMethod => {
826817
let purity;
827818
match item_family(impl_method_doc) {
828819
StaticMethod => purity = ast::impure_fn,
829820
UnsafeStaticMethod => purity = ast::unsafe_fn,
830-
PureStaticMethod => purity = ast::pure_fn,
831821
_ => fail!()
832822
}
833823

@@ -934,10 +924,8 @@ fn item_family_to_str(fam: Family) -> ~str {
934924
Const => ~"const",
935925
Fn => ~"fn",
936926
UnsafeFn => ~"unsafe fn",
937-
PureFn => ~"pure fn",
938927
StaticMethod => ~"static method",
939928
UnsafeStaticMethod => ~"unsafe static method",
940-
PureStaticMethod => ~"pure static method",
941929
ForeignFn => ~"foreign fn",
942930
Type => ~"type",
943931
ForeignType => ~"foreign type",

src/librustc/metadata/encoder.rs

-2
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,6 @@ fn encode_info_for_method(ecx: &EncodeContext,
753753
fn purity_fn_family(p: purity) -> char {
754754
match p {
755755
unsafe_fn => 'u',
756-
pure_fn => 'p',
757756
impure_fn => 'f',
758757
extern_fn => 'e'
759758
}
@@ -762,7 +761,6 @@ fn purity_fn_family(p: purity) -> char {
762761
fn purity_static_method_family(p: purity) -> char {
763762
match p {
764763
unsafe_fn => 'U',
765-
pure_fn => 'P',
766764
impure_fn => 'F',
767765
_ => fail!("extern fn can't be static")
768766
}

src/librustc/metadata/tydecode.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,9 @@ fn parse_hex(st: &mut PState) -> uint {
440440
fn parse_purity(c: char) -> purity {
441441
match c {
442442
'u' => unsafe_fn,
443-
'p' => pure_fn,
444443
'i' => impure_fn,
445444
'c' => extern_fn,
446-
_ => fail!("parse_purity: bad purity")
445+
_ => fail!("parse_purity: bad purity %c", c)
447446
}
448447
}
449448

src/librustc/metadata/tyencode.rs

-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ fn enc_sigil(w: @io::Writer, sigil: Sigil) {
350350

351351
fn enc_purity(w: @io::Writer, p: purity) {
352352
match p {
353-
pure_fn => w.write_char('p'),
354353
impure_fn => w.write_char('i'),
355354
unsafe_fn => w.write_char('u'),
356355
extern_fn => w.write_char('c')

src/librustc/middle/trans/reflect.rs

-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ pub fn ast_sigil_constant(sigil: ast::Sigil) -> uint {
400400

401401
pub fn ast_purity_constant(purity: ast::purity) -> uint {
402402
match purity {
403-
ast::pure_fn => 0u,
404403
ast::unsafe_fn => 1u,
405404
ast::impure_fn => 2u,
406405
ast::extern_fn => 3u

src/librustc/middle/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ pub fn mk_ctor_fn(cx: ctxt, input_tys: &[ty::t], output: ty::t) -> t {
12541254
let input_args = input_tys.map(|t| *t);
12551255
mk_bare_fn(cx,
12561256
BareFnTy {
1257-
purity: ast::pure_fn,
1257+
purity: ast::impure_fn,
12581258
abis: AbiSet::Rust(),
12591259
sig: FnSig {
12601260
bound_lifetime_names: opt_vec::Empty,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ pub fn blank_fn_ctxt(ccx: @mut CrateCtxt,
275275
err_count_on_creation: ccx.tcx.sess.err_count(),
276276
ret_ty: rty,
277277
indirect_ret_ty: None,
278-
ps: PurityState::function(ast::pure_fn, 0),
278+
ps: PurityState::function(ast::impure_fn, 0),
279279
region_lb: region_bnd,
280280
in_scope_regions: @Nil,
281281
fn_kind: Vanilla,

src/librustc/middle/typeck/infer/glb.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use middle::typeck::infer::fold_regions_in_sig;
2323
use middle::typeck::isr_alist;
2424
use syntax::ast;
2525
use syntax::ast::{Many, Once, extern_fn, impure_fn, m_const, m_imm, m_mutbl};
26-
use syntax::ast::{pure_fn, unsafe_fn};
26+
use syntax::ast::{unsafe_fn};
2727
use syntax::ast::{Onceness, purity};
2828
use syntax::abi::AbiSet;
2929
use syntax::codemap::span;
@@ -103,7 +103,6 @@ impl Combine for Glb {
103103

104104
fn purities(&self, a: purity, b: purity) -> cres<purity> {
105105
match (a, b) {
106-
(pure_fn, _) | (_, pure_fn) => Ok(pure_fn),
107106
(extern_fn, _) | (_, extern_fn) => Ok(extern_fn),
108107
(impure_fn, _) | (_, impure_fn) => Ok(impure_fn),
109108
(unsafe_fn, unsafe_fn) => Ok(unsafe_fn)

src/librustc/middle/typeck/infer/lub.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use extra::list;
2828
use syntax::abi::AbiSet;
2929
use syntax::ast;
3030
use syntax::ast::{Many, Once, extern_fn, m_const, impure_fn};
31-
use syntax::ast::{pure_fn, unsafe_fn};
31+
use syntax::ast::{unsafe_fn};
3232
use syntax::ast::{Onceness, purity};
3333
use syntax::codemap::span;
3434

@@ -92,8 +92,7 @@ impl Combine for Lub {
9292
match (a, b) {
9393
(unsafe_fn, _) | (_, unsafe_fn) => Ok(unsafe_fn),
9494
(impure_fn, _) | (_, impure_fn) => Ok(impure_fn),
95-
(extern_fn, _) | (_, extern_fn) => Ok(extern_fn),
96-
(pure_fn, pure_fn) => Ok(pure_fn)
95+
(extern_fn, extern_fn) => Ok(extern_fn),
9796
}
9897
}
9998

src/libsyntax/ast.rs

-2
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,6 @@ pub struct fn_decl {
845845

846846
#[deriving(Eq, Encodable, Decodable)]
847847
pub enum purity {
848-
pure_fn, // declared with "pure fn"
849848
unsafe_fn, // declared with "unsafe fn"
850849
impure_fn, // declared with "fn"
851850
extern_fn, // declared with "extern fn"
@@ -856,7 +855,6 @@ impl ToStr for purity {
856855
match *self {
857856
impure_fn => ~"impure",
858857
unsafe_fn => ~"unsafe",
859-
pure_fn => ~"pure",
860858
extern_fn => ~"extern"
861859
}
862860
}

src/libsyntax/print/pprust.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -2201,26 +2201,29 @@ pub fn print_fn_header_info(s: @ps,
22012201
print_opt_sigil(s, opt_sigil);
22022202
}
22032203

2204-
pub fn opt_sigil_to_str(opt_p: Option<ast::Sigil>) -> ~str {
2204+
pub fn opt_sigil_to_str(opt_p: Option<ast::Sigil>) -> &'static str {
22052205
match opt_p {
2206-
None => ~"fn",
2207-
Some(p) => fmt!("fn%s", p.to_str())
2206+
None => "fn",
2207+
Some(p) => match p {
2208+
ast::BorrowedSigil => "fn&",
2209+
ast::OwnedSigil => "fn~",
2210+
ast::ManagedSigil => "fn@"
2211+
}
22082212
}
22092213
}
22102214

2211-
pub fn purity_to_str(p: ast::purity) -> ~str {
2215+
pub fn purity_to_str(p: ast::purity) -> &'static str {
22122216
match p {
2213-
ast::impure_fn => ~"impure",
2214-
ast::unsafe_fn => ~"unsafe",
2215-
ast::pure_fn => ~"pure",
2216-
ast::extern_fn => ~"extern"
2217+
ast::impure_fn => "impure",
2218+
ast::unsafe_fn => "unsafe",
2219+
ast::extern_fn => "extern"
22172220
}
22182221
}
22192222

2220-
pub fn onceness_to_str(o: ast::Onceness) -> ~str {
2223+
pub fn onceness_to_str(o: ast::Onceness) -> &'static str {
22212224
match o {
2222-
ast::Once => ~"once",
2223-
ast::Many => ~"many"
2225+
ast::Once => "once",
2226+
ast::Many => "many"
22242227
}
22252228
}
22262229

0 commit comments

Comments
 (0)