klutzy
f3c8882533
std::os: Use unicode for last_os_error() on Win32
...
FormatMessageA may return non-ascii message,
which is encoded as system code page, not utf8.
This may cause `assert!(is_utf8(v))` failure on
some non-English machines.
This patch replaces it with FormatMessageW,
which returns utf-16 message.
Fixes `make check-stage2-std` failure on my machine. :)
2013-09-16 03:30:17 +09:00
Daniel Micay
8149e5c99f
rm some uses of the advance
iterator method
2013-09-15 00:45:34 -04:00
Erick Tryzelaar
93683ae6da
std: Fix another windows problem with the unwrap_or_default rename
2013-09-13 07:09:32 -07:00
Erick Tryzelaar
28eb49bfbf
std: rename Option.chain to Option.and_then on windows
2013-09-13 06:58:46 -07:00
Erick Tryzelaar
45c62c08f9
std: rename Option::unwrap_or_default() to unwrap_or()
2013-09-12 18:54:11 -07:00
Daniel Micay
6919cf5fe1
rename std::iterator
to std::iter
...
The trait will keep the `Iterator` naming, but a more concise module
name makes using the free functions less verbose. The module will define
iterables in addition to iterators, as it deals with iteration in
general.
2013-09-09 03:21:46 -04:00
Gareth Smith
193a1c8af6
Replace os::glob with extra::glob, which is written in rust,
...
fixing issue #6100 .
2013-09-05 21:19:47 +01:00
adridu59
50d4714d85
libstd/os: set tmp dir to /data/tmp on Android
...
Android has no /tmp partition, return /data/tmp instead. Cf. #8511 .
2013-09-04 18:07:46 +02:00
Tim Chevalier
34ed4e26a2
std: Add a file-renaming function to std::os
2013-08-30 15:48:37 -07:00
Vadim Chugunov
99345d8d17
Fixed MemoryMap on Windows.
2013-08-28 01:44:12 -07:00
Patrick Walton
5c3504799d
librustc: Remove &const
and *const
from the language.
...
They are still present as part of the borrow check.
2013-08-27 18:46:51 -07:00
klutzy
05b6a2f59c
std: Add Win64 support
...
Some extern blobs are duplicated without "stdcall" abi,
since Win64 does not use any calling convention.
(Giving any abi to them causes llvm producing wrong bytecode.)
2013-08-26 22:15:45 +09:00
bors
db55cd92de
auto merge of #8681 : mrordinaire/rust/remove-set_args, r=brson
2013-08-23 01:31:26 -07:00
Vadim Chugunov
12ecdb6381
Enabled unit tests in std and extra.
2013-08-22 20:02:20 -07:00
Do Nhat Minh
77df8b809a
removed os::set_args, closing #8325
...
removed pub on real_args, changed test to use args
2013-08-23 10:26:37 +08:00
Niko Matsakis
0479d946c8
Add externfn macro and correctly label fixed_stack_segments
2013-08-19 07:13:15 -04:00
bors
3bc6858428
auto merge of #8551 : huonw/rust/speling, r=alexcrichton
...
(This doesn't add/remove `u`s or change `ize` to `ise`, or anything like that.)
2013-08-18 05:11:58 -07:00
Huon Wilson
72fd02d939
doc: convert remaining uses of core:: to std::.
2013-08-16 15:54:14 +10:00
Kevin Ballard
03ef71e262
Add ToCStr method .with_c_str()
...
.with_c_str() is a replacement for the old .as_c_str(), to avoid
unnecessary boilerplate.
Replace all usages of .to_c_str().with_ref() with .with_c_str().
2013-08-15 01:33:10 -07:00
Erick Tryzelaar
4062b84f4a
std: merge Iterator and IteratorUtil
2013-08-10 07:02:17 -07:00
Erick Tryzelaar
fad7857c7b
Mass rename of .consume{,_iter}() to .move_iter()
...
cc #7887
2013-08-10 07:01:07 -07:00
bors
60f5011005
auto merge of #8296 : erickt/rust/remove-str-trailing-nulls, r=erickt
...
This PR fixes #7235 and #3371 , which removes trailing nulls from `str` types. Instead, it replaces the creation of c strings with a new type, `std::c_str::CString`, which wraps a malloced byte array, and respects:
* No interior nulls
* Ends with a trailing null
2013-08-09 21:56:17 -07:00
Erick Tryzelaar
ee59aacac4
Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls
2013-08-09 18:48:01 -07:00
Brian Anderson
b75915d0ca
Remove the C++ runtime. Sayonara
2013-08-09 16:45:50 -07:00
Erick Tryzelaar
c14e14e63a
std: more windows fixes to os.rs and run.rs
2013-08-09 11:13:26 -07:00
Brian Anderson
d392556160
std: Fix perf of local allocations in newsched
...
Mostly optimizing TLS accesses to bring local heap allocation performance
closer to that of oldsched. It's not completely at parity but removing the
branches involved in supporting oldsched and optimizing pthread_get/setspecific
to instead use our dedicated TCB slot will probably make up for it.
2013-08-09 01:15:31 -07:00
Erick Tryzelaar
56730c094c
Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls
2013-08-08 19:27:03 -07:00
Erick Tryzelaar
03cc757fe9
std: more fixes for os.rs for windows
2013-08-08 06:37:55 -07:00
Erick Tryzelaar
7a5ee374e2
std: import HANDLE for os::list_dir for windows
2013-08-07 21:07:06 -07:00
Erick Tryzelaar
1e490813b0
core: option.map_consume -> option.map_move
2013-08-07 08:52:09 -07:00
Erick Tryzelaar
5eaa4d1d2f
Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls
2013-08-06 16:21:02 -07:00
Erick Tryzelaar
c8e454097b
std: fix a typo where .to_c_str wasn't being called on android
2013-08-05 19:54:49 -07:00
Marvin Löbel
0ac7a219f0
Updated std::Option, std::Either and std::Result
...
- Made naming schemes consistent between Option, Result and Either
- Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None)
- Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-05 22:42:21 +02:00
Erick Tryzelaar
3c94b5044c
Merge remote-tracking branch 'remotes/origin/master' into str-remove-null
2013-08-04 16:23:41 -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
cd94e9121b
std: cleanup os and str tests
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
Daniel Micay
1008945528
remove obsolete foreach
keyword
...
this has been replaced by `for`
2013-08-03 22:48:02 -04:00
Patrick Walton
9457ebee55
librustc: Disallow "unsafe" for external functions
2013-08-02 21:57:59 -07:00
Daniel Micay
234acad404
replace range
with an external iterator
2013-08-02 00:51:14 -04:00
blake2-ppc
b18bd785ec
std: Replace for
with do { .. }
expr where internal iterators are used
2013-08-01 16:54:22 +02:00
Daniel Micay
1fc4db2d08
migrate many for
loops to foreach
2013-08-01 05:34:55 -04:00
Daniel Micay
dabd476203
make in
and foreach
get treated as keywords
2013-08-01 00:21:13 -04:00
Daniel Micay
ef870d37a5
implement pointer arithmetic with GEP
...
Closes #8118 , #7136
~~~rust
extern mod extra;
use std::vec;
use std::ptr;
fn bench_from_elem(b: &mut extra::test::BenchHarness) {
do b.iter {
let v: ~[u8] = vec::from_elem(1024, 0u8);
}
}
fn bench_set_memory(b: &mut extra::test::BenchHarness) {
do b.iter {
let mut v: ~[u8] = vec::with_capacity(1024);
unsafe {
let vp = vec::raw::to_mut_ptr(v);
ptr::set_memory(vp, 0, 1024);
vec::raw::set_len(&mut v, 1024);
}
}
}
fn bench_vec_repeat(b: &mut extra::test::BenchHarness) {
do b.iter {
let v: ~[u8] = ~[0u8, ..1024];
}
}
~~~
Before:
test bench_from_elem ... bench: 415 ns/iter (+/- 17)
test bench_set_memory ... bench: 85 ns/iter (+/- 4)
test bench_vec_repeat ... bench: 83 ns/iter (+/- 3)
After:
test bench_from_elem ... bench: 84 ns/iter (+/- 2)
test bench_set_memory ... bench: 84 ns/iter (+/- 5)
test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-07-30 02:50:31 -04:00
Erick Tryzelaar
2dd3c44a56
std: remove a malloc from os::fill_charp_buf
2013-07-23 16:56:23 -07:00
Erick Tryzelaar
7af56bb921
std: move StrUtil::as_c_str into StrSlice
2013-07-23 16:56:22 -07:00
Erick Tryzelaar
cfd89c4075
std: remove os::as_c_charp
2013-07-23 16:56:22 -07:00