Commit Graph

20780 Commits

Author SHA1 Message Date
Erick Tryzelaar
3c94b5044c Merge remote-tracking branch 'remotes/origin/master' into str-remove-null 2013-08-04 16:23:41 -07:00
Erick Tryzelaar
5865a7597b Remove trailing null from strings 2013-08-04 15:45:16 -07:00
Erick Tryzelaar
17e0089856 std: remove use of cast module from os. 2013-08-04 15:45:16 -07:00
Erick Tryzelaar
3629f702e9 std: merge str::raw::from_buf and str::raw::from_c_str 2013-08-04 15:45:16 -07:00
Erick Tryzelaar
bd908d4c0e std and rustc: explicitly pass c strings to c functions
When strings lose their trailing null, this pattern will become dangerous:

let foo = "bar";
let foo_ptr: *u8 = &foo[0];

Instead we should use c_strs to handle this correctly.
2013-08-04 15:45:16 -07:00
Erick Tryzelaar
3102b1797e std: replace str::as_c_str with std::c_str 2013-08-04 14:13:17 -07:00
Erick Tryzelaar
0512475fda extra: make sure time::match_digits does not read past the end of the str 2013-08-04 13:32:41 -07:00
Erick Tryzelaar
bb5bf7c3e0 std: remove str::from_bytes_with_null 2013-08-04 13:32:41 -07:00
Erick Tryzelaar
d5110854f7 std: add test for str::as_c_str 2013-08-04 13:32:41 -07:00
Erick Tryzelaar
cd94e9121b std: cleanup os and str tests 2013-08-04 13:32:41 -07:00
Erick Tryzelaar
dca9ff9a13 std: remove str::NullTerminatedStr 2013-08-04 13:32:41 -07:00
Erick Tryzelaar
fd293dfb0f std: rewrite run::with_{argv,envp,dirp} to copy C strings 2013-08-04 13:32:41 -07:00
Erick Tryzelaar
08b6cb46c6 std: add str.to_c_str() 2013-08-04 13:32:40 -07:00
Erick Tryzelaar
6011f83dec std: minor cleanup 2013-08-04 13:32:40 -07:00
bors
3d14470be4 auto merge of #7115 : alexcrichton/rust/llvm-upgrades, r=thestinger
This is a reopening of #6713

This is still blocked on windows failures. I'll re-push try once the existing crisis has passed.
2013-08-04 12:49:53 -07:00
Daniel Micay
b49d026ecd Merge pull request #8284 from huonw/emacs-in-kw
etc: add the `in` keyword to the emacs mode.
2013-08-04 12:49:11 -07:00
Alex Crichton
60e9507086 Integrate new arm patch and fix an LLVM bug
Thanks @luqama!
2013-08-04 10:58:23 -07:00
Alex Crichton
bb93930575 Add a workaround for 8199 for now 2013-08-04 10:58:23 -07:00
Alex Crichton
4ace3b7434 Fix setting the fixed stack segment attribute on LLVM functions
At the same time create a more robust wrapper to try to prevent this type of
issue from cropping up in the future.
2013-08-04 10:58:23 -07:00
Alex Crichton
8d29367650 Fix build issues once LLVM has been upgraded
* LLVM now has a C interface to LLVMBuildAtomicRMW
* The exception handling support for the JIT seems to have been dropped
* Various interfaces have been added or headers have changed
2013-08-04 10:58:23 -07:00
Alex Crichton
1d06aaae64 Update LLVM 2013-08-04 10:58:22 -07:00
Brian Anderson
9ae0658fd0 Try to fix a periodic windows build failure due to broken rwildcard macro 2013-08-04 10:58:22 -07:00
bors
8495ee52b2 auto merge of #8262 : dotdash/rust/no_rval_copies, r=pcwalton
rvalues aren't going to be used anywhere but as the argument, so
there's no point in copying them. LLVM used to eliminate the copy
later, but why bother emitting it in the first place?
2013-08-04 10:55:53 -07:00
bors
22f9ce4df6 auto merge of #8243 : stepancheg/rust/ipv, r=brson
multicast functions now take IpAddr (without port), because they dont't
need port.

Uv* types renamed:
* UvIpAddr -> UvSocketAddr
* UvIpv4 -> UvIpv4SocketAddr
* UvIpv6 -> UvIpv6SocketAddr

"Socket address" is a common name for (ip-address, port) pair (e.g. in
sockaddr_in struct).

P. S. Are there any backward compatibility concerns? What is std::rt module, is it a part of public API?
2013-08-04 08:49:55 -07:00
bors
f7c4359a2c auto merge of #8237 : blake2-ppc/rust/faster-utf8, r=brson
Use unchecked vec indexing since the vector bounds are checked by the
loop. Iterators are not easy to use in this case since we skip 1-4 bytes
each lap. This part of the commit speeds up is_utf8 for ASCII input.

Check codepoint ranges by checking the byte ranges manually instead of
computing a full decoding for multibyte encodings. This is easy to read
and corresponds to the UTF-8 syntax in the RFC.

No changes to what we accept. A comment notes that surrogate halves are
accepted.

Before:

	test str::bench::is_utf8_100_ascii ... bench: 165 ns/iter (+/- 3)
	test str::bench::is_utf8_100_multibyte ... bench: 218 ns/iter (+/- 5)

After:
	test str::bench::is_utf8_100_ascii ... bench: 130 ns/iter (+/- 1)
	test str::bench::is_utf8_100_multibyte ... bench: 156 ns/iter (+/- 3)

An improvement upon the previous pull #8133
2013-08-04 07:10:56 -07:00
bors
5cf69d5bf8 auto merge of #8254 : brson/rust/libuv-mac-supp, r=pcwalton
I suspect that this is a race between process exit and the termination of
worker threads used by libuv (if I sleep before exit it doesn't leak). This
isn't going to cause any real problems but should probably be fixed at
some point.

r? @pcwalton

cc #8253
2013-08-04 05:28:57 -07:00
bors
91b711883c auto merge of #8217 : brson/rust/reset_stack_limit, r=pcwalton
In some scenarios upcall_rust_stack_limit fails to record the stack
limit, leaving it 0, and allowing subsequent Rust code to run into
the red zone.
2013-08-04 03:34:56 -07:00
Brian Anderson
044fa35bf8 rt: Fix a corner-case in unwinding that leads to stack overflow
In some scenarios upcall_rust_stack_limit fails to record the stack
limit, leaving it 0, and allowing subsequent Rust code to run into
the red zone.
2013-08-03 23:40:25 -07:00
bors
fbeeeebf47 auto merge of #8264 : thestinger/rust/snapshot, r=Aatch 2013-08-03 23:25:55 -07:00
bors
93432a2c2f auto merge of #8269 : brson/rust/fix-task-cleanup, r=brson
...y/catch

And before collect_failure. These are both running user dtors and need to be handled
in the task try/catch block and before the final task cleanup code.
2013-08-03 21:46:56 -07:00
Daniel Micay
e7bb33aed8 rm obsolete for support from the compiler 2013-08-04 00:39:48 -04:00
Daniel Micay
1008945528 remove obsolete foreach keyword
this has been replaced by `for`
2013-08-03 22:48:02 -04:00
Daniel Micay
9f74217d80 register snapshots 2013-08-03 21:09:28 -04:00
Daniel Micay
8ce953347c Merge pull request #8251 from chris-morgan/vim-sigil-highlighting
Highlight sigils and operators in Vim.

r=huonw, known spurious failure on one bot
2013-08-03 18:02:04 -07:00
Brian Anderson
3c9e393354 std::rt: Run local storage cleanup and the box annihilator inside the try/catch
And before collect_failure. These are both running user dtors and need to be handled
in the task try/catch block and before the final task cleanup code.
2013-08-03 14:43:16 -07:00
bors
18e3db7392 auto merge of #8246 : stepancheg/rust/contains-key, r=thestinger
Map::contains_key can be implemented with Map::find.

Remove several implementations of contains_key.
2013-08-03 13:40:49 -07:00
bors
b5d77d20ec auto merge of #8223 : davidhalperin/rust/master, r=Aatch
Closes #7907

This is my first pull request so let me know if I've done anything wrong.  I tried to pick off a nice easy one.
2013-08-03 11:52:50 -07:00
bors
800dbffa69 auto merge of #8219 : sstewartgallus/rust/fix_dynamic_lib, r=graydon
A test case was also created for this situation to prevent the problem
occuring again.

A similar problem was also fixed for the symbol method.

There was some minor code cleanup.

I am unsatisfied with using /dev/null as an invalid dynamic library. It is not cross platform.
2013-08-03 10:04:58 -07:00
bors
34101d2320 auto merge of #8213 : kballard/rust/fd-limit, r=brson
Revert the workaround 49b72bd and instead bump the fd limit on OS X.
2013-08-03 07:46:53 -07:00
Björn Steinbrink
a51e3e46ef trans_arg_expr: Omit extra copies for rvalues
rvalues aren't going to be used anywhere but as the argument, so
there's no point in copying them. LLVM used to eliminate the copy
later, but why bother emitting it in the first place?
2013-08-03 15:03:58 +02:00
bors
6be014d23c auto merge of #8186 : huonw/rust/hashmap-=rt, r=Aatch
The `new` constructor uses the task-local RNG to retrieve seeds for the
two key values, which requires the runtime. Exposing a constructor that
takes the keys directly allows HashMaps to be used in programs that wish
to avoid the runtime.
2013-08-03 05:37:52 -07:00
Huon Wilson
c852a5bb68 std: expose the keyed HashMap constructor, for runtime-less use.
The `new` constructor uses the task-local RNG to retrieve seeds for the
two key values, which requires the runtime. Exposing a constructor that
takes the keys directly allows HashMaps to be used in programs that wish
to avoid the runtime.
2013-08-03 21:00:32 +10:00
bors
2765811cb6 auto merge of #8206 : omasanori/rust/blk-to-block, r=graydon
Just for consistency.
2013-08-03 03:55:52 -07:00
bors
39fafd655a auto merge of #8204 : kballard/rust/str-into-owned, r=graydon
The method .into_owned() is meant to be used as an optimization when you
need to get a ~str from a Str, but don't want to unnecessarily copy it
if it's already a ~str.

This is meant to ease functions that look like

  fn foo<S: Str>(strs: &[S])

Previously they could work with the strings as slices using .as_slice(),
but producing ~str required copying the string, even if the vector
turned out be a &[~str] already.

I don't have any concrete uses for this yet, since the one conversion I've done to `&[S]` so far (see PR #8203) didn't actually need owned strings. But having this here may make using `Str` more attractive.

It also may be worth adding an `into_managed()` function, but that one is less obviously useful than `into_owned()`.
2013-08-03 02:10:54 -07:00
Huon Wilson
cdad7f6f3b etc: add the in keyword to the emacs mode. 2013-08-03 18:31:23 +10:00
bors
20fad0f5ff auto merge of #8257 : mozilla/rust/rollup, r=thestinger
1f9c392 r=brson
54e685d r=graydon
1992765 r=thestinger
75155cd r=bblum
def8891 r=graydon
2013-08-03 00:25:56 -07:00
OGINO Masanori
def88913d8 Move use statements.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-03 03:21:01 -04:00
OGINO Masanori
682939724f Rename sum -> _sum.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-03 03:20:56 -04:00
OGINO Masanori
afaca4c822 Remove unused variables.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-03 03:20:45 -04:00
Kevin Ballard
75155cd1b0 Explicitly impl Clone for RWArc
RWArc had a clone() method, but it was part of impl RWArc instead of
an implementation of Clone.

Stick with the explicit implementation instead of deriving Clone so we
can have a docstring.

Fixes #8052.
2013-08-03 03:17:07 -04:00