Commit Graph

12059 Commits

Author SHA1 Message Date
Pietro Albini
f47a76477d
Rollup merge of #52861 - ColinFinck:master, r=alexcrichton
Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and port libstd to it.

As a start, the port uses the simplest possible configuration (no jemalloc, abort on panic) and makes use of existing Unix-specific code wherever possible.
It adds targets for x86_64 (current main HermitCore platform) and aarch64 (HermitCore platform under development).

Together with the patches to "liblibc" (https://github.com/rust-lang/libc/pull/1048) and llvm (https://github.com/rust-lang/llvm/pull/122), this enables HermitCore applications to be written in Rust.
2018-08-01 10:12:55 +02:00
Pietro Albini
06b91a4901
Rollup merge of #52771 - matklad:patch-1, r=kennytm
Clarify thread::park semantics

It took me quite some time to realize that the example is not actually racy, so let's clarify it? :-)
2018-08-01 10:12:38 +02:00
Pietro Albini
acff794b68
Rollup merge of #52732 - SimonSapin:spring, r=Mark-Simulacrum
Remove unstable and deprecated APIs
2018-08-01 10:12:36 +02:00
Pietro Albini
b7ee110ea2
Rollup merge of #52340 - cypher:document-from-trait-in-ffi, r=steveklabnik
Document From trait implementations for OsStr, OsString, CString, and CStr

As part of issue #51430 (cc @skade).

The allocation and copy claims should be double-checked.

r? @steveklabnik
2018-08-01 10:12:32 +02:00
Colin Finck
4ad4ad02eb Fix coding style. 2018-07-31 09:49:10 +02:00
Simon Sapin
4ca77f702f Remove unstable and deprecated APIs 2018-07-30 18:18:23 +02:00
Simon Sapin
d8b3c830fb Remove the unstable std_unicode crate, deprecated since 1.27
Its former contents are now in libcore.
2018-07-30 18:18:04 +02:00
Colin Finck
e50f4eeaad Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and port libstd to it.
As a start, the port uses the simplest possible configuration (no jemalloc, abort on panic)
and makes use of existing Unix-specific code wherever possible.
It adds targets for x86_64 (current main HermitCore platform) and aarch64 (HermitCore platform
under development).

Together with the patches to "liblibc" and "llvm", this enables HermitCore applications to be
written in Rust.
2018-07-30 15:50:51 +02:00
bors
7bbcd005b3 Auto merge of #52805 - ljedrz:format_str_literal, r=petrochenkov
Don't format!() string literals

Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
2018-07-30 06:29:39 +00:00
bors
866a713258 Auto merge of #52738 - ljedrz:push_to_extend, r=eddyb
Replace push loops with extend() where possible

Or set the vector capacity where I couldn't do it.

According to my [simple benchmark](https://gist.github.com/ljedrz/568e97621b749849684c1da71c27dceb) `extend`ing a vector can be over **10 times** faster than `push`ing to it in a loop:

10 elements (6.1 times faster):
```
test bench_extension ... bench:          75 ns/iter (+/- 23)
test bench_push_loop ... bench:         458 ns/iter (+/- 142)
```

100 elements (11.12 times faster):
```
test bench_extension ... bench:          87 ns/iter (+/- 26)
test bench_push_loop ... bench:         968 ns/iter (+/- 3,528)
```

1000 elements (11.04 times faster):
```
test bench_extension ... bench:         311 ns/iter (+/- 9)
test bench_push_loop ... bench:       3,436 ns/iter (+/- 233)
```

Seems like a good idea to use `extend` as much as possible.
2018-07-29 21:37:47 +00:00
ljedrz
59c8a279da Replace push loops with collect() and extend() where possible 2018-07-29 18:53:22 +02:00
bors
023fd7e74a Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkov
Prefer to_string() to format!()

Simple benchmarks suggest in some cases it can be faster by even 37%:
```
test converting_f64_long  ... bench:         339 ns/iter (+/- 199)
test converting_f64_short ... bench:         136 ns/iter (+/- 34)
test converting_i32_long  ... bench:          87 ns/iter (+/- 16)
test converting_i32_short ... bench:          87 ns/iter (+/- 49)
test converting_str       ... bench:          54 ns/iter (+/- 15)
test formatting_f64_long  ... bench:         349 ns/iter (+/- 176)
test formatting_f64_short ... bench:         145 ns/iter (+/- 14)
test formatting_i32_long  ... bench:          98 ns/iter (+/- 14)
test formatting_i32_short ... bench:          93 ns/iter (+/- 15)
test formatting_str       ... bench:          86 ns/iter (+/- 23)
```
2018-07-29 09:33:37 +00:00
bors
a5c2d0fffa Auto merge of #52764 - sinkuu:cleanup, r=nikomatsakis
Misc cleanups
2018-07-29 06:32:24 +00:00
ljedrz
421b2ba347 Don't format!() string literals 2018-07-28 17:58:52 +02:00
kennytm
b326319f15
Rollup merge of #52759 - stjepang:impl-send-sync-for-joinhandle, r=TimNN
Impl Send & Sync for JoinHandle

This is just a cosmetic change - it slightly relaxes and clarifies the public API without effectively promising any new guarantees.

Currently we have [these auto trait implementations](https://doc.rust-lang.org/nightly/std/thread/struct.JoinHandle.html#synthetic-implementations):

```rust
impl<T: Send> Send for JoinHandle<T> {}
impl<T: Sync> Sync for JoinHandle<T> {}
```

Bound `T: Send` doesn't make much sense because `JoinHandle<T>` can be created only when `T: Send`. Note that [`JoinHandle::<T>::join`](https://doc.rust-lang.org/nightly/std/thread/struct.JoinHandle.html#method.join) doesn't require `T: Send` so why should the `Send` impl?

And the `Sync` impl doesn't need `T: Sync` because `JoinHandle<T>` cannot even share `T` - it can only send it to the thread that calls `join`.
2018-07-28 16:24:59 +08:00
bors
4f1e235744 Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrum
Rollup of bare_trait_objects PRs

All deny attributes were moved into bootstrap so they can be disabled with a line of config.

Warnings for external tools are allowed and it's up to the tool's maintainer to keep it warnings free.

r? @Mark-Simulacrum
cc @ljedrz @kennytm
2018-07-27 20:27:40 +00:00
Shotaro Yamada
3525368a56 Use str::repeat 2018-07-27 23:26:36 +09:00
Aleksey Kladov
5f87f78b14
Fix ws 2018-07-27 14:44:20 +03:00
Aleksey Kladov
922bf1d2ac
Clarify thread::park semantics 2018-07-27 14:01:42 +03:00
ljedrz
57a5a9b054 Prefer to_string() to format!() 2018-07-27 11:11:18 +02:00
Stjepan Glavina
688db1df80 Add stability attributes 2018-07-27 10:08:02 +02:00
Stjepan Glavina
89a81625f4 Impl Send & Sync for JoinHandle 2018-07-27 01:08:13 +02:00
Jonathan Behrens
abb704ec78 State default capacity for BufReader/BufWriter 2018-07-26 00:49:35 +01:00
Tatsuyuki Ishi
e098985939 Deny bare_trait_objects globally 2018-07-25 10:25:29 +09:00
Tatsuyuki Ishi
4f1d4e4db6 Merge remote-tracking branches 'ljedrz/dyn_libcore', 'ljedrz/dyn_libstd' and 'ljedrz/dyn_libterm' into dyn-rollup 2018-07-25 10:25:02 +09:00
Tatsuyuki Ishi
66c4dc9769 Add missing dyn 2018-07-25 10:24:31 +09:00
Mark Rousskov
c7a178ea5f
Rollup merge of #52658 - Wallacoloo:topics/use-option-methods, r=cramertj
Prefer `Option::map`/etc over `match` wherever it improves clarity

This isn't intended to change behavior anywhere. A lot of times statements like `match x { None => None, Some(y) => [...] }` can be rewritten using `Option::map` or `Option::and_then` in a way that preserves or improves clarity, so that's what I've done here.

I think it's particularly valuable to keep things in `libcore` and `libstd` pretty/idiomatic since it's not uncommon to follow the `[src]` links when browsing the rust-lang.org docs for std/core. If there's any concern about pushing style-based changes though, I'll happily back out the non-std/core commits here.
2018-07-24 16:43:49 -06:00
Mark Rousskov
28f8cb585a
Rollup merge of #52656 - jD91mZM2:stablize-uds, r=alexcrichton
Stablize Redox Unix Sockets

I don't know if I did this correctly, but I basically spammed the `#[stable]` attribute everywhere :^)
2018-07-24 16:43:48 -06:00
bors
a2af8667b1 Auto merge of #52646 - ljedrz:single_char_pattern, r=michaelwoerister
Change single char str patterns to chars

A `char` is faster.
2018-07-24 08:24:11 +00:00
Colin Wallace
4f3ab4986e libstd: Prefer Option::map/etc over match where applicable 2018-07-23 22:00:51 -07:00
jD91mZM2
1581971635
Stablize Redox Unix Sockets 2018-07-24 06:25:29 +02:00
kennytm
a98c19e24b
Rollup merge of #52548 - tko:cursor-doc, r=sfackler
Cursor: update docs to clarify Cursor only works with in-memory buffers

Reduce misconceptions about Cursor being more general than it really is.

Fixes: #52470
2018-07-24 09:49:50 +08:00
Markus Wein
ed5edcb318
Seperate summaries from rest of the comment 2018-07-23 15:38:15 +02:00
ljedrz
49c8ba91c7 Change single char str patterns to chars 2018-07-23 15:32:57 +02:00
kennytm
1208944ccb
Rollup merge of #52582 - felixrabe:patch-2, r=pietroalbini
Typo
2018-07-23 01:00:05 +08:00
kennytm
8e6971dd2d
Rollup merge of #52581 - petrochenkov:bmacrodoc, r=alexcrichton
Avoid using `#[macro_export]` for documenting builtin macros

Use a special `rustc_*` attribute instead.

cc https://github.com/rust-lang/rust/pull/52234
2018-07-23 01:00:03 +08:00
bors
3d51086303 Auto merge of #52394 - estebank:println, r=oli-obk
Improve suggestion for missing fmt str in println

Avoid using `concat!(fmt, "\n")` to improve the diagnostics being
emitted when the first `println!()` argument isn't a formatting string
literal.

Fix #52347.
2018-07-22 06:52:48 +00:00
Esteban Küber
3c817259e3 fix tidy ~ again 2018-07-21 19:19:56 -07:00
Esteban Küber
6aa17a3c68 Don't use the new eprintln for stage0 and stage1
I'm not entirely sure why (or if) this is needed.
2018-07-21 17:59:17 -07:00
Esteban Küber
a7a68370a7 Change eprintln!()
Address #30143 as well. `writeln!()` hasn't been changed.
2018-07-21 15:56:37 -07:00
Esteban Küber
00d500052c Gate format_args_nll behind feature flag 2018-07-21 15:50:46 -07:00
Felix Rabe
c581b96f39
Typo 2018-07-21 11:49:52 +02:00
bors
17eb392cef Auto merge of #52535 - alexcrichton:update-stdsimd, r=Mark-Simulacrum
Update stdsimd to undo an accidental stabilization

Closes #52403
2018-07-21 06:26:18 +00:00
Alex Crichton
d77defcca1 Update stdsimd to undo an accidental stabilization
Closes #52403
2018-07-20 22:34:09 -07:00
Vadim Petrochenkov
a18be44d63 Avoid using #[macro_export] for documenting builtin macros 2018-07-21 02:49:34 +03:00
Esteban Küber
154dee2dcc rework println 2018-07-19 23:18:07 -07:00
Esteban Küber
e613bfb701 Same change as println for eprintln 2018-07-19 23:18:07 -07:00
Esteban Küber
fbce952193 review comments: modify note wording and change println
- Don't print the newline on its own to avoid the possibility of
  printing it out of order due to `stdout` locking.
- Modify wording of `concat!()` with non-literals to not mislead into
  believing that only `&str` literals are accepted.
- Add test for `concat!()` with non-literals.
2018-07-19 23:18:07 -07:00
Esteban Küber
f53c145ef1 Improve suggestion for missing fmt str in println
Avoid using `concat!(fmt, "\n")` to improve the diagnostics being
emitted when the first `println!()` argument isn't a formatting string
literal.
2018-07-19 23:18:07 -07:00
bors
bc14d71622 Auto merge of #52349 - RalfJung:once, r=alexcrichton
sync::Once use release-acquire access modes

Nothing here makes a case distinction like "this happened before OR after that". All we need is to get happens-before edges whenever we see that the state/signal has been changed. Release-acquire is good enough for that.
2018-07-20 02:52:19 +00:00