Skip to content
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

aggregated small pulls #7479

Merged
merged 8 commits into from
Jun 29, 2013
Merged
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
71 changes: 36 additions & 35 deletions src/etc/zsh/_rust
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,30 @@ _rustc_opts_switches=(
--target'[Target triple cpu-manufacturer-kernel\[-os\] to compile]'
--target-feature'[Target specific attributes (llc -mattr=help for detail)]'
--android-cross-path'[The path to the Android NDK]'
{-W,--warn}'[Set lint warnings]'
{-A,--allow}'[Set lint allowed]'
{-D,--deny}'[Set lint denied]'
{-F,--forbid}'[Set lint forbidden]'
-Z'[Set internal debugging options]'
{-v,--version}'[Print version info and exit]'
)

_rustc_opts_lint=(
'path-statement:path statements with no effect'
'deprecated-pattern:warn about deprecated uses of pattern bindings'
'non-implicitly-copyable-typarams:passing non implicitly copyable types as copy type params'
'missing-trait-doc:detects missing documentation for traits'
'missing-struct-doc:detects missing documentation for structs'
'ctypes:proper use of core::libc types in foreign modules'
'implicit-copies:implicit copies of non implicitly copyable data'
"unused-mut:detect mut variables which don't need to be mutable"
'unused-imports:imports that are never used'
'heap-memory:use of any (~ type or @ type) heap memory'
'default-methods:allow default methods'
'unused-variable:detect variables which are not used in any way'
'dead-assignment:detect assignments that will never be read'
'unrecognized-lint:unrecognized lint attribute'
'type-limits:comparisons made useless by limits of the types involved'
'unused-unsafe:unnecessary use of an `unsafe` block'
'while-true:suggest using loop { } instead of while(true) { }'
'non-camel-case-types:types, variants and traits should have camel case names'
'managed-heap-memory:use of managed (@ type) heap memory'
'unnecessary-allocation:detects unnecessary allocations that can be eliminated'
'owned-heap-memory:use of owned (~ type) heap memory'
'path-statement[path statements with no effect]'
'deprecated-pattern[warn about deprecated uses of pattern bindings]'
'non-implicitly-copyable-typarams[passing non implicitly copyable types as copy type params]'
'missing-trait-doc[detects missing documentation for traits]'
'missing-struct-doc[detects missing documentation for structs]'
'ctypes[proper use of core::libc types in foreign modules]'
'implicit-copies[implicit copies of non implicitly copyable data]'
"unused-mut[detect mut variables which don't need to be mutable]"
'unused-imports[imports that are never used]'
'heap-memory[use of any (~ type or @ type) heap memory]'
'default-methods[allow default methods]'
'unused-variable[detect variables which are not used in any way]'
'dead-assignment[detect assignments that will never be read]'
'unrecognized-lint[unrecognized lint attribute]'
'type-limits[comparisons made useless by limits of the types involved]'
'unused-unsafe[unnecessary use of an `unsafe` block]'
'while-true[suggest using loop { } instead of while(true) { }]'
'non-camel-case-types[types, variants and traits should have camel case names]'
'managed-heap-memory[use of managed (@ type) heap memory]'
'unnecessary-allocation[detects unnecessary allocations that can be eliminated]'
'owned-heap-memory[use of owned (~ type) heap memory]'
)

_rustc_opts_debug=(
Expand Down Expand Up @@ -90,13 +84,20 @@ _rustc_opts_debug=(
'lint-llvm:Run the LLVM lint pass on the pre-optimization IR'
)

_rustc() {
case $words[2] in
-[WADF]) _describe 'options' _rustc_opts_lint ;;
-Z) _describe 'options' _rustc_opts_debug ;;
-) _arguments -s -w : "$_rustc_opts_switches[@]" ;;
*) _files -g "*.rs" ;;
esac
_rustc_opts_fun_lint(){
_values -s , 'options' \
"$_rustc_opts_lint[@]"
}

_rustc_opts_fun_debug(){
_describe 'options' _rustc_opts_debug
}

_rustc "$@"
_arguments -s : \
'(-W --warn)'{-W,--warn}'[Set lint warnings]:lint options:_rustc_opts_fun_lint' \
'(-A --allow)'{-A,--allow}'[Set lint allowed]:lint options:_rustc_opts_fun_lint' \
'(-D --deny)'{-D,--deny}'[Set lint denied]:lint options:_rustc_opts_fun_lint' \
'(-F --forbid)'{-F,--forbid}'[Set lint forbidden]:lint options:_rustc_opts_fun_lint' \
'*-Z[Set internal debugging options]:debug options:_rustc_opts_fun_debug' \
"$_rustc_opts_switches[@]" \
'*::files:_files -g "*.rs"'
3 changes: 2 additions & 1 deletion src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ struct RWARCInner<T> { lock: RWlock, failed: bool, data: T }
*
* Unlike mutex_arcs, rw_arcs are safe, because they cannot be nested.
*/
#[mutable]
#[mutable] // XXX remove after snap
#[no_freeze]
struct RWARC<T> {
x: UnsafeAtomicRcBox<RWARCInner<T>>,
}
Expand Down
3 changes: 2 additions & 1 deletion src/libextra/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ struct Chunk {
is_pod: bool,
}

#[mutable]
#[mutable] // XXX remove after snap
#[no_freeze]
pub struct Arena {
// The head is separated out from the list as a unbenchmarked
// microoptimization, to avoid needing to case on the list to
Expand Down
5 changes: 4 additions & 1 deletion src/libextra/ebml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ pub mod reader {
use core::cast::transmute;
use core::int;
use core::io;
use core::option::{None, Option, Some};

#[cfg(target_arch = "x86")]
#[cfg(target_arch = "x86_64")]
use core::option::{None, Option, Some};
use core::ptr::offset;

#[cfg(target_arch = "x86")]
#[cfg(target_arch = "x86_64")]
use core::unstable::intrinsics::bswap32;

// ebml reading
Expand Down
7 changes: 4 additions & 3 deletions src/libextra/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct RcBox<T> {

/// Immutable reference counted pointer type
#[unsafe_no_drop_flag]
#[non_sendable]
#[no_send]
pub struct Rc<T> {
priv ptr: *mut RcBox<T>,
}
Expand Down Expand Up @@ -168,8 +168,9 @@ struct RcMutBox<T> {

/// Mutable reference counted pointer type
#[non_owned]
#[non_sendable]
#[mutable]
#[no_send]
#[mutable] // XXX remove after snap
#[no_freeze]
#[unsafe_no_drop_flag]
pub struct RcMut<T> {
priv ptr: *mut RcMutBox<T>,
Expand Down
6 changes: 4 additions & 2 deletions src/libextra/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,15 @@ impl Terminal {
pub fn reset(&self) {
let mut vars = Variables::new();
let s = do self.ti.strings.find_equiv(&("op"))
.map_consume_default(Err(~"can't find op")) |&op| {
.map_consume_default(Err(~"can't find terminfo capability `op`")) |&op| {
expand(op, [], &mut vars)
};
if s.is_ok() {
self.out.write(s.unwrap());
} else {
} else if self.num_colors > 0 {
warn!("%s", s.unwrap_err());
} else {
debug!("%s", s.unwrap_err());
}
}

Expand Down
8 changes: 3 additions & 5 deletions src/librustc/middle/trans/meth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ use middle::trans::type_of::*;
use middle::ty;
use middle::typeck;
use util::common::indenter;
use util::ppaux::{Repr, ty_to_str};
use util::ppaux::Repr;

use middle::trans::type_::Type;

use core::vec;
use syntax::ast_map::{path, path_mod, path_name};
use syntax::ast_util;
use syntax::{ast, ast_map};
use syntax::parse::token;

/**
The main "translation" pass for methods. Generates code
Expand Down Expand Up @@ -755,10 +754,9 @@ pub fn make_vtable(ccx: &mut CrateContext,
components.push(ptr)
}

let name = fmt!("%s_vtable_%u", ty_to_str(ccx.tcx, tydesc.ty), token::gensym("vtable"));

let tbl = C_struct(components);
let vt_gvar = do name.as_c_str |buf| {
let vtable = ccx.sess.str_of(gensym_name("vtable"));
let vt_gvar = do vtable.as_c_str |buf| {
llvm::LLVMAddGlobal(ccx.llmod, val_ty(tbl).to_ref(), buf)
};
llvm::LLVMSetInitializer(vt_gvar, tbl);
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,7 @@ static TC_ONCE_CLOSURE: TypeContents = TypeContents{bits: 0b0001_0000_0000};
/// An enum with no variants.
static TC_EMPTY_ENUM: TypeContents = TypeContents{bits: 0b0010_0000_0000};

/// Contains a type marked with `#[non_sendable]`
/// Contains a type marked with `#[no_send]`
static TC_NON_SENDABLE: TypeContents = TypeContents{bits: 0b0100_0000_0000};

/// Is a bare vector, str, function, trait, etc (only relevant at top level).
Expand Down Expand Up @@ -2204,10 +2204,10 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
}

fn apply_tc_attr(cx: ctxt, did: def_id, mut tc: TypeContents) -> TypeContents {
if has_attr(cx, did, "mutable") {
if has_attr(cx, did, "no_freeze") {
tc = tc + TC_MUTABLE;
}
if has_attr(cx, did, "non_sendable") {
if has_attr(cx, did, "no_send") {
tc = tc + TC_NON_SENDABLE;
}
tc
Expand Down
1 change: 0 additions & 1 deletion src/librustpkg/path_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ static path_entry_separator: &'static str = ":";
/// DIR/.rust for any DIR that's the current working directory
/// or an ancestor of it
pub fn rust_path() -> ~[Path] {
let env_path: ~str = os::getenv("RUST_PATH").get_or_default(~"");
let mut env_rust_path: ~[Path] = match os::getenv("RUST_PATH") {
Some(env_path) => {
let env_path_components: ~[&str] =
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ A dynamic, mutable location.
Similar to a mutable option type, but friendlier.
*/

#[mutable]
#[mutable] // XXX remove after snap
#[no_freeze]
#[deriving(Clone, DeepClone, Eq)]
#[allow(missing_doc)]
pub struct Cell<T> {
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ impl<'self, A, St> UnfoldrIterator<'self, A, St> {
/// Creates a new iterator with the specified closure as the "iterator
/// function" and an initial state to eventually pass to the iterator
#[inline]
pub fn new<'a>(f: &'a fn(&mut St) -> Option<A>, initial_state: St)
pub fn new<'a>(initial_state: St, f: &'a fn(&mut St) -> Option<A>)
-> UnfoldrIterator<'a, A, St> {
UnfoldrIterator {
f: f,
Expand Down Expand Up @@ -1174,7 +1174,7 @@ mod tests {
}
}

let mut it = UnfoldrIterator::new(count, 0);
let mut it = UnfoldrIterator::new(0, count);
let mut i = 0;
for it.advance |counted| {
assert_eq!(counted, i);
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/mutable-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[mutable]
#[no_freeze]
enum Foo { A }

fn bar<T: Freeze>(_: T) {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/mutable-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[mutable]
#[no_freeze]
struct Foo { a: int }

fn bar<T: Freeze>(_: T) {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/non_owned-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[non_sendable]
#[no_send]
enum Foo { A }

fn bar<T: Send>(_: T) {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/non_owned-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[non_sendable]
#[no_send]
struct Foo { a: int }

fn bar<T: Send>(_: T) {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/unfoldr-cross-crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn main() {
}
}

let mut it = UnfoldrIterator::new(count, 0);
let mut it = UnfoldrIterator::new(0, count);
let mut i = 0;
for it.advance |counted| {
assert_eq!(counted, i);
Expand Down