]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #14133 : db48x/rust/ord-for-mut-refs, r=alexcrichton
bors [Thu, 15 May 2014 05:06:50 +0000 (22:06 -0700)]
auto merge of #14133 : db48x/rust/ord-for-mut-refs, r=alexcrichton

Also Show, which is useful in assertions. Fixes #14074

10 years agoauto merge of #14170 : pcwalton/rust/detildestr-misclibs, r=alexcrichton
bors [Thu, 15 May 2014 02:31:52 +0000 (19:31 -0700)]
auto merge of #14170 : pcwalton/rust/detildestr-misclibs, r=alexcrichton

r? @brson

10 years agolibnum: Remove all uses of `~str` from `libnum`
Patrick Walton [Wed, 14 May 2014 01:08:40 +0000 (18:08 -0700)]
libnum: Remove all uses of `~str` from `libnum`

10 years agolibcollections: Remove most uses of `~str` from `libcollections`
Patrick Walton [Wed, 14 May 2014 01:01:54 +0000 (18:01 -0700)]
libcollections: Remove most uses of `~str` from `libcollections`

10 years agoliburl: Remove all uses of `~str` from `liburl`
Patrick Walton [Wed, 14 May 2014 00:51:05 +0000 (17:51 -0700)]
liburl: Remove all uses of `~str` from `liburl`

10 years agolibterm: Remove all uses of `~str` from `libterm`
Patrick Walton [Wed, 14 May 2014 00:26:41 +0000 (17:26 -0700)]
libterm: Remove all uses of `~str` from `libterm`

10 years agolibtest: Remove all uses of `~str` from `libtest`.
Patrick Walton [Tue, 13 May 2014 23:44:05 +0000 (16:44 -0700)]
libtest: Remove all uses of `~str` from `libtest`.

10 years agolibsync: Remove all uses of `~str` from `libsync`
Patrick Walton [Tue, 13 May 2014 21:57:26 +0000 (14:57 -0700)]
libsync: Remove all uses of `~str` from `libsync`

10 years agolibrand: Remove all uses of `~str` from `librand`
Patrick Walton [Tue, 13 May 2014 21:38:13 +0000 (14:38 -0700)]
librand: Remove all uses of `~str` from `librand`

10 years agolibtime: Remove all uses of `~str` from `libtime`
Patrick Walton [Tue, 13 May 2014 05:24:20 +0000 (22:24 -0700)]
libtime: Remove all uses of `~str` from `libtime`

10 years agolibsemver: Remove all uses of `~str` from `libsemver`
Patrick Walton [Tue, 13 May 2014 04:39:26 +0000 (21:39 -0700)]
libsemver: Remove all uses of `~str` from `libsemver`

10 years agolibglob: Remove all uses of `~str` from `libglob`
Patrick Walton [Tue, 13 May 2014 04:36:30 +0000 (21:36 -0700)]
libglob: Remove all uses of `~str` from `libglob`

10 years agoliblog: Remove all uses of `~str` from `liblog`
Patrick Walton [Tue, 13 May 2014 04:35:40 +0000 (21:35 -0700)]
liblog: Remove all uses of `~str` from `liblog`

10 years agolibgraphviz: Remove all uses of `~str` from `libgraphviz`.
Patrick Walton [Tue, 13 May 2014 04:14:03 +0000 (21:14 -0700)]
libgraphviz: Remove all uses of `~str` from `libgraphviz`.

10 years agolibregex: Remove all uses of `~str` from `libregex`
Patrick Walton [Tue, 13 May 2014 04:12:50 +0000 (21:12 -0700)]
libregex: Remove all uses of `~str` from `libregex`

10 years agolibarena: Remove all uses of `~str` from `libarena`
Patrick Walton [Tue, 13 May 2014 04:06:17 +0000 (21:06 -0700)]
libarena: Remove all uses of `~str` from `libarena`

10 years agolibhexfloat: Remove all uses of `~str` from `libhexfloat`
Patrick Walton [Tue, 13 May 2014 03:35:23 +0000 (20:35 -0700)]
libhexfloat: Remove all uses of `~str` from `libhexfloat`

10 years agolibuuid: Remove all uses of `~str` from `libuuid`.
Patrick Walton [Tue, 13 May 2014 03:33:17 +0000 (20:33 -0700)]
libuuid: Remove all uses of `~str` from `libuuid`.

10 years agolibworkcache: Remove all uses of `~str` from `libworkcache`.
Patrick Walton [Tue, 13 May 2014 03:32:05 +0000 (20:32 -0700)]
libworkcache: Remove all uses of `~str` from `libworkcache`.

10 years agotest: Remove all uses of `~str` from the test suite.
Patrick Walton [Tue, 13 May 2014 00:56:43 +0000 (17:56 -0700)]
test: Remove all uses of `~str` from the test suite.

10 years agoauto merge of #14086 : Ryman/rust/resolve_error_suggestions, r=alexcrichton
bors [Wed, 14 May 2014 19:06:29 +0000 (12:06 -0700)]
auto merge of #14086 : Ryman/rust/resolve_error_suggestions, r=alexcrichton

Provides better help for the resolve failures inside an `impl` if the name matches:
- a field on the self type
- a method on the self type
- a method on the current trait ref (in a trait impl)

Not handling trait method suggestions if in a regular `impl` (as you can see on line 69 of the test), I believe it is possible though.

Also, provides a better message when `self` fails to resolve due to being a static method.

It's using some unsafe pointers to skip copying the larger structures (which are only used in error conditions); it's likely possible to get it working with lifetimes (all the useful refs should outlive the visitor calls) but I haven't really figured that out for this case. (can switch to copying code if wanted)

Closes #2356.

10 years agorustc: Improve error messages for resolve failures.
Kevin Butler [Thu, 8 May 2014 21:35:09 +0000 (22:35 +0100)]
rustc: Improve error messages for resolve failures.

10 years agoauto merge of #14009 : jcmoyer/rust/bitflags-complement, r=alexcrichton
bors [Wed, 14 May 2014 16:21:25 +0000 (09:21 -0700)]
auto merge of #14009 : jcmoyer/rust/bitflags-complement, r=alexcrichton

I feel that this is a very vital, missing piece of functionality. This adds on to #13072.

Only bits used in the definition of the bitflag are considered for the universe set. This is a bit safer than simply inverting all of the bits in the wrapped value.

```rust
bitflags!(flags Flags: u32 {
    FlagA       = 0x00000001,
    FlagB       = 0x00000010,
    FlagC       = 0x00000100,
    FlagABC     = FlagA.bits
                | FlagB.bits
                | FlagC.bits
})

...

// `Not` implements set complement
assert!(!(FlagB | FlagC) == FlagA);
// `all` and `is_all` are the inverses of `empty` and `is_empty`
assert!(Flags::all() - FlagA == !FlagA);
assert!(FlagABC.is_all());
```

10 years agoauto merge of #14192 : pongad/rust/walkcleanup, r=pcwalton
bors [Wed, 14 May 2014 14:31:45 +0000 (07:31 -0700)]
auto merge of #14192 : pongad/rust/walkcleanup, r=pcwalton

Fixes #14134

10 years agoauto merge of #14191 : luqmana/rust/eu, r=alexcrichton
bors [Wed, 14 May 2014 12:56:18 +0000 (05:56 -0700)]
auto merge of #14191 : luqmana/rust/eu, r=alexcrichton

We were correctly determining the attributes needed for the parameters for extern fns, but when that extern fn was from another crate we never bothered to pass that information along to LLVM. (i.e never called `foreign::add_argument_attributes`).

I've just changed both local and non-local (crate) extern fn's to be dealt with together (through `foreign::register_foreign_item_fn`) so we don't run into something like again.

Fixes #14177.

10 years agoauto merge of #14186 : omasanori/rust/suppress-warnings, r=alexcrichton
bors [Wed, 14 May 2014 11:06:26 +0000 (04:06 -0700)]
auto merge of #14186 : omasanori/rust/suppress-warnings, r=alexcrichton

10 years agoauto merge of #14179 : luqmana/rust/acp, r=alexcrichton
bors [Wed, 14 May 2014 09:36:23 +0000 (02:36 -0700)]
auto merge of #14179 : luqmana/rust/acp, r=alexcrichton

It's a bit odd to single out just android when we don't do this for any other cross compiling targets. Android builds will still work since we just pass the full path for gcc and ar with `-C linker` and `-C ar`.

I did add the flag to compiletest though so it can find gdb. Though, i'm pretty sure we don't run debuginfo tests on android anyways right now.

[breaking-change]

10 years agoImplement set complement and universe for bitflags
J.C. Moyer [Wed, 7 May 2014 05:54:44 +0000 (01:54 -0400)]
Implement set complement and universe for bitflags

10 years agoauto merge of #14169 : alexcrichton/rust/atomics, r=sanxiyn
bors [Wed, 14 May 2014 08:06:24 +0000 (01:06 -0700)]
auto merge of #14169 : alexcrichton/rust/atomics, r=sanxiyn

This module is a foundation on which many other algorithms are built. When hardware support is missing, stubs are provided in libcompiler-rt.a, so this should be available on all platforms.

10 years agodefine Eq,TotalEq,Ord,TotalOrd for &mut T
Daniel Brooks [Mon, 12 May 2014 09:04:07 +0000 (02:04 -0700)]
define Eq,TotalEq,Ord,TotalOrd for &mut T

Also Show, which is useful in assertions. Fixes #14074

10 years agocore: Allow using failure outside of libcore
Alex Crichton [Tue, 13 May 2014 04:23:13 +0000 (21:23 -0700)]
core: Allow using failure outside of libcore

Due to our excellent macro hygiene, this involves having a global path and a
hidden module in libcore itself.

10 years agocore: Document should_not_exist's existence
Alex Crichton [Tue, 13 May 2014 04:22:50 +0000 (21:22 -0700)]
core: Document should_not_exist's existence

Explain why it should not exist, and the plan of attack for removing it.

10 years agocore: Add a crate doc block
Alex Crichton [Tue, 13 May 2014 04:22:35 +0000 (21:22 -0700)]
core: Add a crate doc block

10 years agocore: Inherit the atomics module
Alex Crichton [Tue, 13 May 2014 04:30:48 +0000 (21:30 -0700)]
core: Inherit the atomics module

10 years agoRemoved unnecessary arguments for walk_* functions
Michael Darakananda [Wed, 14 May 2014 06:20:25 +0000 (02:20 -0400)]
Removed unnecessary arguments for walk_* functions

10 years agolibrustc: Make sure to add argument attributes to extern fns from non-local crates.
Luqman Aden [Wed, 14 May 2014 06:07:33 +0000 (02:07 -0400)]
librustc: Make sure to add argument attributes to extern fns from non-local crates.

10 years agoGet rid of the android-cross-path flag to rustc.
Luqman Aden [Tue, 13 May 2014 18:44:30 +0000 (14:44 -0400)]
Get rid of the android-cross-path flag to rustc.

There's no need to include this specific flag just for android. We can
already deal with what it tries to solve by using -C linker=/path/to/cc
and -C ar=/path/to/ar. The Makefiles for rustc already set this up when
we're crosscompiling.

I did add the flag to compiletest though so it can find gdb. Though, I'm
pretty sure we don't run debuginfo tests on android anyways right now.

[breaking-change]

10 years agoauto merge of #14178 : alexcrichton/rust/more-ignores, r=brson
bors [Wed, 14 May 2014 04:41:25 +0000 (21:41 -0700)]
auto merge of #14178 : alexcrichton/rust/more-ignores, r=brson

It was thought that these failures only happened on windows, turns out they
happen on any 32-bit machine.

cc #14064

10 years agoauto merge of #13127 : kballard/rust/read_at_least, r=alexcrichton
bors [Wed, 14 May 2014 03:01:28 +0000 (20:01 -0700)]
auto merge of #13127 : kballard/rust/read_at_least, r=alexcrichton

Reader.read_at_least() ensures that at least a given number of bytes
have been read. The most common use-case for this is ensuring at least 1
byte has been read. If the reader returns 0 enough times in a row, a new
error kind NoProgress will be returned instead of looping infinitely.

This change is necessary in order to properly support Readers that
repeatedly return 0, either because they're broken, or because they're
attempting to do a non-blocking read on some resource that never becomes
available.

Also add .push() and .push_at_least() methods. push() is like read() but
the results are appended to the passed Vec.

Remove Reader.fill() and Reader.push_exact() as they end up being thin
wrappers around read_at_least() and push_at_least().

[breaking-change]

10 years agoio: Add .read_at_least() to Reader
Kevin Ballard [Tue, 25 Mar 2014 06:22:23 +0000 (23:22 -0700)]
io: Add .read_at_least() to Reader

Reader.read_at_least() ensures that at least a given number of bytes
have been read. The most common use-case for this is ensuring at least 1
byte has been read. If the reader returns 0 enough times in a row, a new
error kind NoProgress will be returned instead of looping infinitely.

This change is necessary in order to properly support Readers that
repeatedly return 0, either because they're broken, or because they're
attempting to do a non-blocking read on some resource that never becomes
available.

Also add .push() and .push_at_least() methods. push() is like read() but
the results are appended to the passed Vec.

Remove Reader.fill() and Reader.push_exact() as they end up being thin
wrappers around read_at_least() and push_at_least().

[breaking-change]

10 years agoauto merge of #14187 : alexcrichton/rust/rollup, r=alexcrichton
bors [Wed, 14 May 2014 01:31:51 +0000 (18:31 -0700)]
auto merge of #14187 : alexcrichton/rust/rollup, r=alexcrichton

Closes #14184 (std: Move the owned module from core to std)
Closes #14183 (Allow blocks in const expressions)
Closes #14176 (Add tests for from_bits.)
Closes #14175 (Replaced ~T by Box<T> in manual)
Closes #14173 (Implements Default trait for BigInt and BigUint)
Closes #14171 (Fix #8391)
Closes #14159 (Clean up unicode code in libstd)
Closes #14126 (docs: Add a not found page)
Closes #14123 (add a line to the example to clarify semantics)
Closes #14106 (Pretty printer improvements)
Closes #14083 (rustllvm: Add LLVMRustArrayType)
Closes #13957 (io: Implement process wait timeouts)

10 years agoio: Implement process wait timeouts
Alex Crichton [Mon, 5 May 2014 23:58:42 +0000 (16:58 -0700)]
io: Implement process wait timeouts

This implements set_timeout() for std::io::Process which will affect wait()
operations on the process. This follows the same pattern as the rest of the
timeouts emerging in std::io::net.

The implementation was super easy for everything except libnative on unix
(backwards from usual!), which required a good bit of signal handling. There's a
doc comment explaining the strategy in libnative. Internally, this also required
refactoring the "helper thread" implementation used by libnative to allow for an
extra helper thread (not just the timer).

This is a breaking change in terms of the io::Process API. It is now possible
for wait() to fail, and subsequently wait_with_output(). These two functions now
return IoResult<T> due to the fact that they can time out.

Additionally, the wait_with_output() function has moved from taking `&mut self`
to taking `self`. If a timeout occurs while waiting with output, the semantics
are undesirable in almost all cases if attempting to re-wait on the process.
Equivalent functionality can still be achieved by dealing with the output
handles manually.

[breaking-change]

cc #13523

10 years agorustllvm: Add LLVMRustArrayType
klutzy [Sat, 10 May 2014 08:30:55 +0000 (17:30 +0900)]
rustllvm: Add LLVMRustArrayType

LLVM internally uses `uint64_t` for array size, but the corresponding
C API (`LLVMArrayType`) uses `unsigned int` so ths value is truncated.
Therefore rustc generates wrong type for fixed-sized large vector e.g.
`[0 x i8]` for `[0u8, ..(1 << 32)]`.

This patch adds `LLVMRustArrayType` function for `uint64_t` support.

10 years agosyntax: Improve --pretty normal slightly
Alex Crichton [Sun, 11 May 2014 08:34:28 +0000 (01:34 -0700)]
syntax: Improve --pretty normal slightly

When printing doc comments, always put a newline after them in a macro
invocation to ensure that a line-doc-comment doesn't consume remaining tokens on
the line.

10 years agosyntax: Preserve attributes in #[deriving]
Alex Crichton [Sun, 11 May 2014 08:11:33 +0000 (01:11 -0700)]
syntax: Preserve attributes in #[deriving]

Now that the #[deriving] attribute is removed, the raw_pointers_deriving lint
was broken. This commit restores the lint by preserving lint attributes
across #[deriving] to the implementations and using #[automatically_derived] as
the trigger for activating the lint.

10 years agotest: Give a test a bigger stack for pretty printing
Alex Crichton [Sun, 11 May 2014 05:02:59 +0000 (22:02 -0700)]
test: Give a test a bigger stack for pretty printing

10 years agosyntax: Print suffixed token literals correctly
Alex Crichton [Sun, 11 May 2014 04:57:49 +0000 (21:57 -0700)]
syntax: Print suffixed token literals correctly

Previously, literals "1i" were printed as "1". This fixes the
numeric-method-autoexport test for pretty printing.

10 years agotest: Ignore a pretty expanded failing test
Alex Crichton [Sun, 11 May 2014 04:57:11 +0000 (21:57 -0700)]
test: Ignore a pretty expanded failing test

When expanding, an extra unsafe block is generated which is currently not
handled well.

10 years agotest: Fix a pretty printing test
Alex Crichton [Sun, 11 May 2014 04:46:46 +0000 (21:46 -0700)]
test: Fix a pretty printing test

The pretty printer handles inlines comments quite badly

10 years agosyntax: Fix parsing << with closure types
Alex Crichton [Sun, 11 May 2014 04:27:44 +0000 (21:27 -0700)]
syntax: Fix parsing << with closure types

This uses the trick of replacing the << token with a < token to parse closure
types correctly.

Closes #13324

10 years agosyntax: Fix printing INT64_MIN
Alex Crichton [Sun, 11 May 2014 03:16:51 +0000 (20:16 -0700)]
syntax: Fix printing INT64_MIN

Integers are always parsed as a u64 in libsyntax, but they're stored as i64. The
parser and pretty printer both printed an i64 instead of u64, sometimes
introducing an extra negative sign.

10 years agoTouch up and rebase previous commits
Alex Crichton [Sun, 11 May 2014 00:39:08 +0000 (17:39 -0700)]
Touch up and rebase previous commits

* Added `// no-pretty-expanded` to pretty-print a test, but not run it through
  the `expanded` variant.
* Removed #[deriving] and other expanded attributes after they are expanded
* Removed hacks around &str and &&str and friends (from both the parser and the
  pretty printer).
* Un-ignored a bunch of tests

10 years agocompiletest: Test `--pretty expanded`
klutzy [Wed, 16 Apr 2014 05:29:02 +0000 (14:29 +0900)]
compiletest: Test `--pretty expanded`

After testing `--pretty normal`, it tries to run `--pretty expanded` and
typecheck output.
Here we don't check convergence since it really diverges: for every
iteration, some extra lines (e.g.`extern crate std`) are inserted.

Some tests are `ignore-pretty`-ed since they cause various issues
with `--pretty expanded`.

10 years agocompiletest: Modernize typenames
klutzy [Wed, 16 Apr 2014 04:56:39 +0000 (13:56 +0900)]
compiletest: Modernize typenames

10 years agotest: Add missing `#![feature(managed_boxes)]`
klutzy [Thu, 17 Apr 2014 09:20:37 +0000 (18:20 +0900)]
test: Add missing `#![feature(managed_boxes)]`

The tests use managed boxes, but are not perfectly feature-gated because
they use `@` inside macros. (It causes issue after `--pretty expanded`.)

10 years agolibsyntax: Workaround pprust `for` issue
klutzy [Thu, 17 Apr 2014 08:35:36 +0000 (17:35 +0900)]
libsyntax: Workaround pprust `for` issue

10 years agopprust: Remove unnecessary && of `print_tt`
klutzy [Fri, 18 Apr 2014 06:48:47 +0000 (15:48 +0900)]
pprust: Remove unnecessary && of `print_tt`

10 years agopprust: Print `&&e` instead of `& &e`
klutzy [Fri, 18 Apr 2014 06:44:25 +0000 (15:44 +0900)]
pprust: Print `&&e` instead of `& &e`

10 years agopprust: Fix asm output
klutzy [Thu, 17 Apr 2014 08:35:40 +0000 (17:35 +0900)]
pprust: Fix asm output

10 years agopprust: Add parentheses to some Expr
klutzy [Wed, 16 Apr 2014 20:33:58 +0000 (05:33 +0900)]
pprust: Add parentheses to some Expr

Some `Expr` needs parentheses when printed. For example, without
parentheses, `ExprUnary(UnNeg, ExprBinary(BiAdd, ..))` becomes
`-lhs + rhs` which is wrong.

Those cases don't appear in ordinary code (since parentheses are
explicitly added) but they can appear in manually crafted ast by
extensions.

10 years agorustc: Make std_inject valid for pretty-printer
klutzy [Wed, 16 Apr 2014 05:32:35 +0000 (14:32 +0900)]
rustc: Make std_inject valid for pretty-printer

Inject `extern crate {std, native}` before `use` statements.
Add `#![feature(glob)]` since `use std::prelude::*` is used.

(Unfortunately `rustc --pretty expanded` does not converge,
since `extern crate` and `use std::prelude::*` is injected at every
iteration.)

10 years agoadd a line to the example to clarify semantics
Zooko Wilcox-O'Hearn [Mon, 12 May 2014 03:57:04 +0000 (03:57 +0000)]
add a line to the example to clarify semantics

This is to clarify that match construct doesn't define a new variable, since I
observed a person reading the Rust tutorial who seemed to incorrectly think
that it did. Fixes https://github.com/mozilla/rust/issues/13571 .

10 years agodocs: Add a not found page
Richo Healey [Mon, 12 May 2014 06:10:40 +0000 (23:10 -0700)]
docs: Add a not found page

10 years agostd: Rename str::Normalizations to str::Decompositions
Florian Zeitz [Mon, 12 May 2014 20:44:21 +0000 (22:44 +0200)]
std: Rename str::Normalizations to str::Decompositions

The Normalizations iterator has been renamed to Decompositions.
It does not currently include all forms of Unicode normalization,
but only encompasses decompositions.
If implemented recomposition would likely be a separate iterator
which works on the result of this one.

[breaking-change]

10 years agocore: Move Hangul decomposition into unicode.rs
Florian Zeitz [Mon, 12 May 2014 20:25:38 +0000 (22:25 +0200)]
core: Move Hangul decomposition into unicode.rs

10 years agocore: Use appropriately sized integers for codepoints and bytes
Florian Zeitz [Mon, 12 May 2014 19:53:53 +0000 (21:53 +0200)]
core: Use appropriately sized integers for codepoints and bytes

10 years agostd, core: Generate unicode.rs using unicode.py
Florian Zeitz [Mon, 12 May 2014 17:56:41 +0000 (19:56 +0200)]
std, core: Generate unicode.rs using unicode.py

10 years agocheck_match: get rid of superfluous clones
Edward Wang [Tue, 13 May 2014 06:30:21 +0000 (14:30 +0800)]
check_match: get rid of superfluous clones

10 years agoFix #8391
Edward Wang [Tue, 13 May 2014 05:20:52 +0000 (13:20 +0800)]
Fix #8391

Closes #8391

10 years agoImplements Default trait for BigInt and BigUint
Piotr Jawniak [Tue, 13 May 2014 09:00:11 +0000 (11:00 +0200)]
Implements Default trait for BigInt and BigUint

10 years agoReplaced ~T by Box<T> in manual
Adolfo Ochagavía [Tue, 13 May 2014 13:43:10 +0000 (15:43 +0200)]
Replaced ~T by Box<T> in manual

10 years agoAdd tests for from_bits.
OGINO Masanori [Tue, 13 May 2014 14:12:55 +0000 (23:12 +0900)]
Add tests for from_bits.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoAllow blocks in const expressions
Marvin Löbel [Sun, 4 May 2014 08:39:11 +0000 (10:39 +0200)]
Allow blocks in const expressions

Only blocks with tail expressions that are const expressions
and items are allowed.

10 years agostd: Move the owned module from core to std
Alex Crichton [Tue, 13 May 2014 21:58:29 +0000 (14:58 -0700)]
std: Move the owned module from core to std

The compiler was updated to recognize that implementations for ty_uniq(..) are
allowed if the Box lang item is located in the current crate. This enforces the
idea that libcore cannot allocated, and moves all related trait implementations
from libcore to libstd.

This is a breaking change in that the AnyOwnExt trait has moved from the any
module to the owned module. Any previous users of std::any::AnyOwnExt should now
use std::owned::AnyOwnExt instead. This was done because the trait is intended
for Box traits and only Box traits.

[breaking-change]

10 years agoSuppress warnings on 32bit platforms.
OGINO Masanori [Tue, 13 May 2014 15:44:04 +0000 (00:44 +0900)]
Suppress warnings on 32bit platforms.

On 32bit platforms, int is the same as i32, so 0xffffffff is "out of
range." Annotating variables as u32 fixes the problems.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoSuppress a "unused variable" warning.
OGINO Masanori [Tue, 13 May 2014 15:41:58 +0000 (00:41 +0900)]
Suppress a "unused variable" warning.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoauto merge of #14075 : Rufflewind/rust/patch-3, r=alexcrichton
bors [Tue, 13 May 2014 23:01:48 +0000 (16:01 -0700)]
auto merge of #14075 : Rufflewind/rust/patch-3, r=alexcrichton

- Use Unicode-aware versions of `CreateProcess` (Fixes #13815) and `Get/FreeEnvironmentStrings`.
    - Includes a helper function `os::win32::as_mut_utf16_p`, which does the same thing as `os::win32::as_utf16_p` except the pointer is mutable.
    - Fixed `make_command_line` to handle Unicode correctly.
- Tests for the above.

10 years agoTest Unicode support of process spawning
Phil Ruffwind [Wed, 7 May 2014 23:26:16 +0000 (19:26 -0400)]
Test Unicode support of process spawning

Added a run-pass test to ensure that processes can be correctly spawned
using non-ASCII arguments, working directory, and environment variables.
It also tests Unicode support of os::env_as_bytes.

An additional assertion was added to the test for make_command_line to
verify it handles Unicode correctly.

10 years agoUse Get/FreeEnvironmentStringsW instead of Get/FreeEnvironmentStringsA
Phil Ruffwind [Mon, 5 May 2014 01:14:55 +0000 (21:14 -0400)]
Use Get/FreeEnvironmentStringsW instead of Get/FreeEnvironmentStringsA

Changed libstd to use Get/FreeEnvironmentStringsW instead of
Get/FreeEnvironmentStringsA to support Unicode environment variables.

10 years agoFix make_command_line to handle Unicode correctly
Phil Ruffwind [Sun, 4 May 2014 21:27:42 +0000 (17:27 -0400)]
Fix make_command_line to handle Unicode correctly

Previously, make_command_line iterates over each u8 in the string and
then appends them as chars, so any non-ASCII string will get horribly
mangled by this function.  This fix should allow Unicode arguments to
work correctly in native::io::process::spawn.

10 years agoUse CreateProcessW instead of CreateProcessA
Phil Ruffwind [Sun, 4 May 2014 07:11:42 +0000 (03:11 -0400)]
Use CreateProcessW instead of CreateProcessA

Changed libnative to use CreateProcessW instead of CreateProcessA.  In
addition, the lpEnvironment parameter now uses Unicode.

Added a helper function os::win32::as_mut_utf16_p, which does basically
the same thing as os::win32::as_utf16_p except the pointer is mutable.

10 years agoauto merge of #14052 : dylanbraithwaite/rust/char-fns-for-strbuf, r=alexcrichton
bors [Tue, 13 May 2014 20:41:49 +0000 (13:41 -0700)]
auto merge of #14052 : dylanbraithwaite/rust/char-fns-for-strbuf, r=alexcrichton

Added functions pop_char and shift_char to StrBuf along with unit tests, using the same test cases as push_char.

10 years agoserialize: Broaden ignores of json tests
Alex Crichton [Tue, 13 May 2014 16:28:26 +0000 (09:28 -0700)]
serialize: Broaden ignores of json tests

It was thought that these failures only happened on windows, turns out they
happen on any 32-bit machine.

cc #14064

10 years agoauto merge of #14158 : nikomatsakis/rust/issue-5527-refactor-foldable, r=pcwalton
bors [Tue, 13 May 2014 15:57:33 +0000 (08:57 -0700)]
auto merge of #14158 : nikomatsakis/rust/issue-5527-refactor-foldable, r=pcwalton

Factor out foldable better to reduce code duplication.

r? @pcwalton (probably want to let travis run...)

10 years agoauto merge of #14168 : zwarich/rust/deriving-clone, r=alexcrichton
bors [Tue, 13 May 2014 13:11:45 +0000 (06:11 -0700)]
auto merge of #14168 : zwarich/rust/deriving-clone, r=alexcrichton

10 years agoauto merge of #14167 : cmr/rust/cmplx, r=alexcrichton
bors [Tue, 13 May 2014 11:06:50 +0000 (04:06 -0700)]
auto merge of #14167 : cmr/rust/cmplx, r=alexcrichton

[breaking-change]

10 years agoAdded functions pop_char and shift_char to StrBuf struct along with appropriate unit...
Dylan Braithwaite [Thu, 8 May 2014 20:42:40 +0000 (21:42 +0100)]
Added functions pop_char and shift_char to StrBuf struct along with appropriate unit tests, using the same test case as push_char.

Changed StrBuf.shift_byte() that it no longer reallocates the buffer by just calling Vec.shift();

Added warning to shift_char()'s docs about it having to copy the whole buffer, as per the docs for
Vec.shift().

10 years agoauto merge of #13919 : thomaslee/rust/thomaslee_proposed_tcpstream_open, r=alexcrichton
bors [Tue, 13 May 2014 06:11:45 +0000 (23:11 -0700)]
auto merge of #13919 : thomaslee/rust/thomaslee_proposed_tcpstream_open, r=alexcrichton

Been meaning to try my hand at something like this for a while, and noticed something similar mentioned as part of #13537. The suggestion on the original ticket is to use `TcpStream::open(&str)` to pass in a host + port string, but seems a little cleaner to pass in host and port separately -- so a signature like `TcpStream::open(&str, u16)`.

Also means we can use std::io::net::addrinfo directly instead of using e.g. liburl to parse the host+port pair from a string.

One outstanding issue in this PR that I'm not entirely sure how to address: in open_timeout, the timeout_ms will apply for every A record we find associated with a hostname -- probably not the intended behavior, but I didn't want to waste my time on elaborate alternatives until the general idea was a-OKed. :)

Anyway, perhaps there are other reasons for us to prefer the original proposed syntax, but thought I'd get some thoughts on this. Maybe there are some solid reasons to prefer using liburl to do this stuff.

10 years agoFix field ordering of addrinfo struct on Android
Tom Lee [Tue, 13 May 2014 04:48:02 +0000 (21:48 -0700)]
Fix field ordering of addrinfo struct on Android

10 years agoauto merge of #14164 : alexcrichton/rust/rollup, r=alexcrichton
bors [Tue, 13 May 2014 04:45:13 +0000 (21:45 -0700)]
auto merge of #14164 : alexcrichton/rust/rollup, r=alexcrichton

10 years agoDocument a possible way in which connect_timout may change in the future
Tom Lee [Sun, 11 May 2014 04:30:57 +0000 (21:30 -0700)]
Document a possible way in which connect_timout may change in the future

10 years agoTry to parse TcpStream::connect 'host' parameter as an IP.
Tom Lee [Sun, 11 May 2014 04:30:36 +0000 (21:30 -0700)]
Try to parse TcpStream::connect 'host' parameter as an IP.

Fall back to get_host_addresses to try a DNS lookup if we can't
parse it as an IP address.

10 years agoEasier interface for TCP ::connect and ::bind.
Tom Lee [Sat, 3 May 2014 08:12:31 +0000 (01:12 -0700)]
Easier interface for TCP ::connect and ::bind.

Prior to this commit, TcpStream::connect and TcpListener::bind took a
single SocketAddr argument. This worked well enough, but the API felt a
little too "low level" for most simple use cases.

A great example is connecting to rust-lang.org on port 80. Rust users would
need to:

  1. resolve the IP address of rust-lang.org using
     io::net::addrinfo::get_host_addresses.

  2. check for errors

  3. if all went well, use the returned IP address and the port number
     to construct a SocketAddr

  4. pass this SocketAddr to TcpStream::connect.

I'm modifying the type signature of TcpStream::connect and
TcpListener::bind so that the API is a little easier to use.

TcpStream::connect now accepts two arguments: a string describing the
host/IP of the host we wish to connect to, and a u16 representing the
remote port number.

Similarly, TcpListener::bind has been modified to take two arguments:
a string describing the local interface address (e.g. "0.0.0.0" or
"127.0.0.1") and a u16 port number.

Here's how to port your Rust code to use the new TcpStream::connect API:

  // old ::connect API
  let addr = SocketAddr{ip: Ipv4Addr{127, 0, 0, 1}, port: 8080};
  let stream = TcpStream::connect(addr).unwrap()

  // new ::connect API (minimal change)
  let addr = SocketAddr{ip: Ipv4Addr{127, 0, 0, 1}, port: 8080};
  let stream = TcpStream::connect(addr.ip.to_str(), addr.port()).unwrap()

  // new ::connect API (more compact)
  let stream = TcpStream::connect("127.0.0.1", 8080).unwrap()

  // new ::connect API (hostname)
  let stream = TcpStream::connect("rust-lang.org", 80)

Similarly, for TcpListener::bind:

  // old ::bind API
  let addr = SocketAddr{ip: Ipv4Addr{0, 0, 0, 0}, port: 8080};
  let mut acceptor = TcpListener::bind(addr).listen();

  // new ::bind API (minimal change)
  let addr = SocketAddr{ip: Ipv4Addr{0, 0, 0, 0}, port: 8080};
  let mut acceptor = TcpListener::bind(addr.ip.to_str(), addr.port()).listen()

  // new ::bind API (more compact)
  let mut acceptor = TcpListener::bind("0.0.0.0", 8080).listen()

[breaking-change]

10 years agoRemove a workaround for deriving(Clone) on unit structs.
Cameron Zwarich [Tue, 13 May 2014 04:29:31 +0000 (21:29 -0700)]
Remove a workaround for deriving(Clone) on unit structs.

10 years agonum: rename Cmplx to Complex
Corey Richardson [Tue, 13 May 2014 04:07:08 +0000 (21:07 -0700)]
num: rename Cmplx to Complex

Cmplx is a uselessly short name. Change it to be more clear.

[breaking-change]

10 years agoTest fixes from rollup
Alex Crichton [Tue, 13 May 2014 02:06:31 +0000 (19:06 -0700)]
Test fixes from rollup

Closes #14163 (Fix typos in rustc manpage)
Closes #14161 (Add the patch number to version strings. Closes #13289)
Closes #14156 (rustdoc: Fix hiding implementations of traits)
Closes #14152 (add shebang to scripts that have execute bit set)
Closes #14150 (libcore: remove fails from slice.rs and remove duplicated length checking)
Closes #14147 (Make ProcessOutput Eq, TotalEq, Clone)
Closes #14142 (doc: updates rust manual (loop to continue))
Closes #14141 (doc: Update the linkage documentation)
Closes #14139 (Remove an unnecessary .move_iter().collect())
Closes #14136 (Two minor fixes in parser.rs)
Closes #14130 (Fixed typo in comments of driver.rs)
Closes #14128 (Add `stat` method to `std::io::fs::File` to stat without a Path.)
Closes #14114 (rustdoc: List macros in the sidebar)
Closes #14113 (shootout-nbody improvement)
Closes #14112 (Improved example code in Option)
Closes #14104 (Remove reference to MutexArc)
Closes #14087 (emacs: highlight `macro_name!` in macro invocations using [] delimiters)

10 years agoauto merge of #13820 : klutzy/rust/urandom, r=alexcrichton
bors [Tue, 13 May 2014 03:17:13 +0000 (20:17 -0700)]
auto merge of #13820 : klutzy/rust/urandom, r=alexcrichton

This patch adds document which explains when to use `OSRng` in
cryptographic context, and explains why we use `/dev/urandom` instead
of `/dev/random`.

10 years agoemacs: highlight `macro_name!` in macro invocations using [] delimiters
Huon Wilson [Sat, 10 May 2014 14:14:43 +0000 (00:14 +1000)]
emacs: highlight `macro_name!` in macro invocations using [] delimiters

10 years agoRemove reference to MutexArc
Derek Chiang (Enchi Jiang) [Sun, 11 May 2014 01:38:39 +0000 (21:38 -0400)]
Remove reference to MutexArc

10 years agoImproved example code in Option
Adolfo Ochagavía [Sun, 11 May 2014 16:23:46 +0000 (18:23 +0200)]
Improved example code in Option