Skip to content

Commit a28f9ba

Browse files
committed
auto merge of #7361 : brson/rust/incoming, r=brson
2 parents f1e09d6 + 332671c commit a28f9ba

File tree

24 files changed

+175
-221
lines changed

24 files changed

+175
-221
lines changed

src/compiletest/compiletest.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,17 @@ pub fn make_test(config: &config, testfile: &Path) -> test::TestDescAndFn {
254254
}
255255

256256
pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
257+
258+
// Try to elide redundant long paths
259+
fn shorten(path: &Path) -> ~str {
260+
let filename = path.filename();
261+
let dir = path.pop().filename();
262+
fmt!("%s/%s", dir.get_or_default(~""), filename.get_or_default(~""))
263+
}
264+
257265
test::DynTestName(fmt!("[%s] %s",
258266
mode_str(config.mode),
259-
testfile.to_str()))
267+
shorten(testfile)))
260268
}
261269

262270
pub fn make_test_closure(config: &config, testfile: &Path) -> test::TestFn {

src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language: Rust
33
" Maintainer: Patrick Walton <[email protected]>
44
" Maintainer: Ben Blum <[email protected]>
5-
" Last Change: 2012 Jun 14
5+
" Last Change: 2013 Jun 14
66

77
if version < 600
88
syntax clear

src/libextra/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
* ~~~ {.rust}
2121
* extern mod std;
22-
* use std::arc;
22+
* use extra::arc;
2323
* let numbers=vec::from_fn(100, |ind| (ind as float)*rand::random());
2424
* let shared_numbers=arc::ARC(numbers);
2525
*

src/libextra/base64.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ impl<'self> ToBase64 for &'self [u8] {
3636
* # Example
3737
*
3838
* ~~~ {.rust}
39-
* extern mod std;
40-
* use std::base64::ToBase64;
39+
* extern mod extra;
40+
* use extra::base64::ToBase64;
4141
*
4242
* fn main () {
4343
* let str = [52,32].to_base64();
@@ -99,8 +99,8 @@ impl<'self> ToBase64 for &'self str {
9999
* # Example
100100
*
101101
* ~~~ {.rust}
102-
* extern mod std;
103-
* use std::base64::ToBase64;
102+
* extern mod extra;
103+
* use extra::base64::ToBase64;
104104
*
105105
* fn main () {
106106
* let str = "Hello, World".to_base64();
@@ -127,9 +127,9 @@ impl<'self> FromBase64 for &'self [u8] {
127127
* # Example
128128
*
129129
* ~~~ {.rust}
130-
* extern mod std;
131-
* use std::base64::ToBase64;
132-
* use std::base64::FromBase64;
130+
* extern mod extra;
131+
* use extra::base64::ToBase64;
132+
* use extra::base64::FromBase64;
133133
*
134134
* fn main () {
135135
* let str = [52,32].to_base64();
@@ -207,9 +207,9 @@ impl<'self> FromBase64 for &'self str {
207207
* This converts a string literal to base64 and back.
208208
*
209209
* ~~~ {.rust}
210-
* extern mod std;
211-
* use std::base64::ToBase64;
212-
* use std::base64::FromBase64;
210+
* extern mod extra;
211+
* use extra::base64::ToBase64;
212+
* use extra::base64::FromBase64;
213213
* use core::str;
214214
*
215215
* fn main () {

src/libextra/future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* ~~~ {.rust}
1818
* # fn fib(n: uint) -> uint {42};
1919
* # fn make_a_sandwich() {};
20-
* let mut delayed_fib = std::future::spawn (|| fib(5000) );
20+
* let mut delayed_fib = extra::future::spawn (|| fib(5000) );
2121
* make_a_sandwich();
2222
* println(fmt!("fib(5000) = %?", delayed_fib.get()))
2323
* ~~~

src/libextra/net_ip.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub struct ParseAddrErr {
5555
*
5656
* # Arguments
5757
*
58-
* * ip - a `std::net::ip::IpAddr`
58+
* * ip - a `extra::net::ip::IpAddr`
5959
*/
6060
pub fn format_addr(ip: &IpAddr) -> ~str {
6161
match *ip {
@@ -80,7 +80,7 @@ pub fn format_addr(ip: &IpAddr) -> ~str {
8080
* Get the associated port
8181
*
8282
* # Arguments
83-
* * ip - a `std::net::ip::IpAddr`
83+
* * ip - a `extra::net::ip::IpAddr`
8484
*/
8585
pub fn get_port(ip: &IpAddr) -> uint {
8686
match *ip {

src/librustc/metadata/common.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -7,7 +7,8 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
10+
use core::prelude::*;
11+
use core::cast;
1112

1213
// EBML enum definitions and utils shared by the encoder and decoder
1314

@@ -111,6 +112,7 @@ pub static tag_items_data_item_reexport_def_id: uint = 0x4e;
111112
pub static tag_items_data_item_reexport_name: uint = 0x4f;
112113

113114
// used to encode crate_ctxt side tables
115+
#[deriving(Eq)]
114116
pub enum astencode_tag { // Reserves 0x50 -- 0x6f
115117
tag_ast = 0x50,
116118

@@ -136,6 +138,16 @@ pub enum astencode_tag { // Reserves 0x50 -- 0x6f
136138
tag_table_moves_map = 0x63,
137139
tag_table_capture_map = 0x64
138140
}
141+
static first_astencode_tag : uint = tag_ast as uint;
142+
static last_astencode_tag : uint = tag_table_capture_map as uint;
143+
impl astencode_tag {
144+
pub fn from_uint(value : uint) -> Option<astencode_tag> {
145+
let is_a_tag = first_astencode_tag <= value && value <= last_astencode_tag;
146+
if !is_a_tag { None } else {
147+
Some(unsafe { cast::transmute(value as int) })
148+
}
149+
}
150+
}
139151

140152
pub static tag_item_trait_method_sort: uint = 0x70;
141153

src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ enum Family {
100100
MutStatic, // b
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
@@ -126,10 +124,8 @@ fn item_family(item: ebml::Doc) -> Family {
126124
'b' => MutStatic,
127125
'f' => Fn,
128126
'u' => UnsafeFn,
129-
'p' => PureFn,
130127
'F' => StaticMethod,
131128
'U' => UnsafeStaticMethod,
132-
'P' => PureStaticMethod,
133129
'e' => ForeignFn,
134130
'y' => Type,
135131
'T' => ForeignType,
@@ -327,7 +323,6 @@ fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::crate_num)
327323
Struct => dl_def(ast::def_struct(did)),
328324
UnsafeFn => dl_def(ast::def_fn(did, ast::unsafe_fn)),
329325
Fn => dl_def(ast::def_fn(did, ast::impure_fn)),
330-
PureFn => dl_def(ast::def_fn(did, ast::pure_fn)),
331326
ForeignFn => dl_def(ast::def_fn(did, ast::extern_fn)),
332327
UnsafeStaticMethod => {
333328
let trait_did_opt = translated_parent_item_opt(cnum, item);
@@ -337,10 +332,6 @@ fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::crate_num)
337332
let trait_did_opt = translated_parent_item_opt(cnum, item);
338333
dl_def(ast::def_static_method(did, trait_did_opt, ast::impure_fn))
339334
}
340-
PureStaticMethod => {
341-
let trait_did_opt = translated_parent_item_opt(cnum, item);
342-
dl_def(ast::def_static_method(did, trait_did_opt, ast::pure_fn))
343-
}
344335
Type | ForeignType => dl_def(ast::def_ty(did)),
345336
Mod => dl_def(ast::def_mod(did)),
346337
ForeignMod => dl_def(ast::def_foreign_mod(did)),
@@ -819,12 +810,11 @@ pub fn get_static_methods_if_impl(intr: @ident_interner,
819810
let impl_method_doc = lookup_item(impl_method_id.node, cdata.data);
820811
let family = item_family(impl_method_doc);
821812
match family {
822-
StaticMethod | UnsafeStaticMethod | PureStaticMethod => {
813+
StaticMethod | UnsafeStaticMethod => {
823814
let purity;
824815
match item_family(impl_method_doc) {
825816
StaticMethod => purity = ast::impure_fn,
826817
UnsafeStaticMethod => purity = ast::unsafe_fn,
827-
PureStaticMethod => purity = ast::pure_fn,
828818
_ => fail!()
829819
}
830820

@@ -932,10 +922,8 @@ fn item_family_to_str(fam: Family) -> ~str {
932922
MutStatic => ~"static mut",
933923
Fn => ~"fn",
934924
UnsafeFn => ~"unsafe fn",
935-
PureFn => ~"pure fn",
936925
StaticMethod => ~"static method",
937926
UnsafeStaticMethod => ~"unsafe static method",
938-
PureStaticMethod => ~"pure static method",
939927
ForeignFn => ~"foreign fn",
940928
Type => ~"type",
941929
ForeignType => ~"foreign type",

src/librustc/metadata/encoder.rs

Lines changed: 0 additions & 2 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 0 additions & 1 deletion
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')

0 commit comments

Comments
 (0)