Skip to content

Rollup of easy patches #7361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,17 @@ pub fn make_test(config: &config, testfile: &Path) -> test::TestDescAndFn {
}

pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {

// Try to elide redundant long paths
fn shorten(path: &Path) -> ~str {
let filename = path.filename();
let dir = path.pop().filename();
fmt!("%s/%s", dir.get_or_default(~""), filename.get_or_default(~""))
}

test::DynTestName(fmt!("[%s] %s",
mode_str(config.mode),
testfile.to_str()))
shorten(testfile)))
}

pub fn make_test_closure(config: &config, testfile: &Path) -> test::TestFn {
Expand Down
2 changes: 1 addition & 1 deletion src/etc/vim/syntax/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
" Language: Rust
" Maintainer: Patrick Walton <pcwalton@mozilla.com>
" Maintainer: Ben Blum <bblum@cs.cmu.edu>
" Last Change: 2012 Jun 14
" Last Change: 2013 Jun 14

if version < 600
syntax clear
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* ~~~ {.rust}
* extern mod std;
* use std::arc;
* use extra::arc;
* let numbers=vec::from_fn(100, |ind| (ind as float)*rand::random());
* let shared_numbers=arc::ARC(numbers);
*
Expand Down
20 changes: 10 additions & 10 deletions src/libextra/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ impl<'self> ToBase64 for &'self [u8] {
* # Example
*
* ~~~ {.rust}
* extern mod std;
* use std::base64::ToBase64;
* extern mod extra;
* use extra::base64::ToBase64;
*
* fn main () {
* let str = [52,32].to_base64();
Expand Down Expand Up @@ -99,8 +99,8 @@ impl<'self> ToBase64 for &'self str {
* # Example
*
* ~~~ {.rust}
* extern mod std;
* use std::base64::ToBase64;
* extern mod extra;
* use extra::base64::ToBase64;
*
* fn main () {
* let str = "Hello, World".to_base64();
Expand All @@ -127,9 +127,9 @@ impl<'self> FromBase64 for &'self [u8] {
* # Example
*
* ~~~ {.rust}
* extern mod std;
* use std::base64::ToBase64;
* use std::base64::FromBase64;
* extern mod extra;
* use extra::base64::ToBase64;
* use extra::base64::FromBase64;
*
* fn main () {
* let str = [52,32].to_base64();
Expand Down Expand Up @@ -207,9 +207,9 @@ impl<'self> FromBase64 for &'self str {
* This converts a string literal to base64 and back.
*
* ~~~ {.rust}
* extern mod std;
* use std::base64::ToBase64;
* use std::base64::FromBase64;
* extern mod extra;
* use extra::base64::ToBase64;
* use extra::base64::FromBase64;
* use core::str;
*
* fn main () {
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* ~~~ {.rust}
* # fn fib(n: uint) -> uint {42};
* # fn make_a_sandwich() {};
* let mut delayed_fib = std::future::spawn (|| fib(5000) );
* let mut delayed_fib = extra::future::spawn (|| fib(5000) );
* make_a_sandwich();
* println(fmt!("fib(5000) = %?", delayed_fib.get()))
* ~~~
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/net_ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct ParseAddrErr {
*
* # Arguments
*
* * ip - a `std::net::ip::IpAddr`
* * ip - a `extra::net::ip::IpAddr`
*/
pub fn format_addr(ip: &IpAddr) -> ~str {
match *ip {
Expand All @@ -80,7 +80,7 @@ pub fn format_addr(ip: &IpAddr) -> ~str {
* Get the associated port
*
* # Arguments
* * ip - a `std::net::ip::IpAddr`
* * ip - a `extra::net::ip::IpAddr`
*/
pub fn get_port(ip: &IpAddr) -> uint {
match *ip {
Expand Down
16 changes: 14 additions & 2 deletions src/librustc/metadata/common.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand All @@ -7,7 +7,8 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use core::prelude::*;
use core::cast;

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

Expand Down Expand Up @@ -111,6 +112,7 @@ pub static tag_items_data_item_reexport_def_id: uint = 0x4e;
pub static tag_items_data_item_reexport_name: uint = 0x4f;

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

Expand All @@ -136,6 +138,16 @@ pub enum astencode_tag { // Reserves 0x50 -- 0x6f
tag_table_moves_map = 0x63,
tag_table_capture_map = 0x64
}
static first_astencode_tag : uint = tag_ast as uint;
static last_astencode_tag : uint = tag_table_capture_map as uint;
impl astencode_tag {
pub fn from_uint(value : uint) -> Option<astencode_tag> {
let is_a_tag = first_astencode_tag <= value && value <= last_astencode_tag;
if !is_a_tag { None } else {
Some(unsafe { cast::transmute(value as int) })
}
}
}

pub static tag_item_trait_method_sort: uint = 0x70;

Expand Down
14 changes: 1 addition & 13 deletions src/librustc/metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@ enum Family {
MutStatic, // b
Fn, // f
UnsafeFn, // u
PureFn, // p
StaticMethod, // F
UnsafeStaticMethod, // U
PureStaticMethod, // P
ForeignFn, // e
Type, // y
ForeignType, // T
Expand All @@ -126,10 +124,8 @@ fn item_family(item: ebml::Doc) -> Family {
'b' => MutStatic,
'f' => Fn,
'u' => UnsafeFn,
'p' => PureFn,
'F' => StaticMethod,
'U' => UnsafeStaticMethod,
'P' => PureStaticMethod,
'e' => ForeignFn,
'y' => Type,
'T' => ForeignType,
Expand Down Expand Up @@ -327,7 +323,6 @@ fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::crate_num)
Struct => dl_def(ast::def_struct(did)),
UnsafeFn => dl_def(ast::def_fn(did, ast::unsafe_fn)),
Fn => dl_def(ast::def_fn(did, ast::impure_fn)),
PureFn => dl_def(ast::def_fn(did, ast::pure_fn)),
ForeignFn => dl_def(ast::def_fn(did, ast::extern_fn)),
UnsafeStaticMethod => {
let trait_did_opt = translated_parent_item_opt(cnum, item);
Expand All @@ -337,10 +332,6 @@ fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::crate_num)
let trait_did_opt = translated_parent_item_opt(cnum, item);
dl_def(ast::def_static_method(did, trait_did_opt, ast::impure_fn))
}
PureStaticMethod => {
let trait_did_opt = translated_parent_item_opt(cnum, item);
dl_def(ast::def_static_method(did, trait_did_opt, ast::pure_fn))
}
Type | ForeignType => dl_def(ast::def_ty(did)),
Mod => dl_def(ast::def_mod(did)),
ForeignMod => dl_def(ast::def_foreign_mod(did)),
Expand Down Expand Up @@ -824,12 +815,11 @@ pub fn get_static_methods_if_impl(intr: @ident_interner,
let impl_method_doc = lookup_item(impl_method_id.node, cdata.data);
let family = item_family(impl_method_doc);
match family {
StaticMethod | UnsafeStaticMethod | PureStaticMethod => {
StaticMethod | UnsafeStaticMethod => {
let purity;
match item_family(impl_method_doc) {
StaticMethod => purity = ast::impure_fn,
UnsafeStaticMethod => purity = ast::unsafe_fn,
PureStaticMethod => purity = ast::pure_fn,
_ => fail!()
}

Expand Down Expand Up @@ -937,10 +927,8 @@ fn item_family_to_str(fam: Family) -> ~str {
MutStatic => ~"static mut",
Fn => ~"fn",
UnsafeFn => ~"unsafe fn",
PureFn => ~"pure fn",
StaticMethod => ~"static method",
UnsafeStaticMethod => ~"unsafe static method",
PureStaticMethod => ~"pure static method",
ForeignFn => ~"foreign fn",
Type => ~"type",
ForeignType => ~"foreign type",
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,6 @@ fn encode_info_for_method(ecx: &EncodeContext,
fn purity_fn_family(p: purity) -> char {
match p {
unsafe_fn => 'u',
pure_fn => 'p',
impure_fn => 'f',
extern_fn => 'e'
}
Expand All @@ -762,7 +761,6 @@ fn purity_fn_family(p: purity) -> char {
fn purity_static_method_family(p: purity) -> char {
match p {
unsafe_fn => 'U',
pure_fn => 'P',
impure_fn => 'F',
_ => fail!("extern fn can't be static")
}
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,9 @@ fn parse_hex(st: &mut PState) -> uint {
fn parse_purity(c: char) -> purity {
match c {
'u' => unsafe_fn,
'p' => pure_fn,
'i' => impure_fn,
'c' => extern_fn,
_ => fail!("parse_purity: bad purity")
_ => fail!("parse_purity: bad purity %c", c)
}
}

Expand Down
1 change: 0 additions & 1 deletion src/librustc/metadata/tyencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ fn enc_sigil(w: @io::Writer, sigil: Sigil) {

fn enc_purity(w: @io::Writer, p: purity) {
match p {
pure_fn => w.write_char('p'),
impure_fn => w.write_char('i'),
unsafe_fn => w.write_char('u'),
extern_fn => w.write_char('c')
Expand Down
Loading