Commit Graph

48187 Commits

Author SHA1 Message Date
Alex Crichton
c6eb8527e0 std: Add Instant and SystemTime to std::time
This commit is an implementation of [RFC 1288][rfc] which adds two new unstable
types to the `std::time` module. The `Instant` type is used to represent
measurements of a monotonically increasing clock suitable for measuring time
withing a process for operations such as benchmarks or just the elapsed time to
do something. An `Instant` favors panicking when bugs are found as the bugs are
programmer errors rather than typical errors that can be encountered.

[rfc]: https://github.com/rust-lang/rfcs/pull/1288

The `SystemTime` type is used to represent a system timestamp and is not
monotonic. Very few guarantees are provided about this measurement of the system
clock, but a fixed point in time (`UNIX_EPOCH`) is provided to learn about the
relative distance from this point for any particular time stamp.

This PR takes the same implementation strategy as the `time` crate on crates.io,
namely:

|  Platform  |  Instant                 |  SystemTime              |
|------------|--------------------------|--------------------------|
| Windows    | QueryPerformanceCounter  | GetSystemTimeAsFileTime  |
| OSX        | mach_absolute_time       | gettimeofday             |
| Unix       | CLOCK_MONOTONIC          | CLOCK_REALTIME           |

These implementations can perhaps be refined over time, but they currently
satisfy the requirements of the `Instant` and `SystemTime` types while also
being portable across implementations and revisions of each platform.
2015-11-19 09:32:38 -08:00
bors
22e31f10c2 Auto merge of #29083 - petrochenkov:stability3, r=alexcrichton
What this patch does:
- Stability annotations are now based on "exported items" supplied by rustc_privacy and not "public items". Exported items are as accessible for external crates as directly public items and should be annotated with stability attributes.
- Trait impls require annotations now.
- Reexports require annotations now.
- Crates themselves didn't require annotations, now they do.
- Exported macros are annotated now, but these annotations are not used yet.
- Some useless annotations are detected and result in errors
- Finally, some small bugs are fixed - deprecation propagates from stable deprecated parents, items in blocks are traversed correctly (fixes https://github.com/rust-lang/rust/issues/29034) + some code cleanup.
2015-11-18 19:49:33 +00:00
Vadim Petrochenkov
64b90f81c3 Fix buildbot failures 2015-11-18 21:16:20 +03:00
bors
3c68f646e9 Auto merge of #29886 - michaelwoerister:mir-erase-regions, r=nikomatsakis
This change adds a `MirPass` erasing all early-bound regions from MIR, right before storing it in the MIR map. I've added some assertions at neuralgic points in `trans::mir` doing cheap checks whether region have actually been erased.

Here are some assumptions that I worked under:
- AdtDef references stay untouched. It's the `Substs` accompanying them that need to be handled (e.g. in `AggregateKind::Adt`).
- We can't really get rid of late-bound regions at this point because there is no version `BareFnTy` (for example) that comes without one. These still have to be handled on demand in trans.

Are this assumptions right?

r? @nikomatsakis
2015-11-18 18:06:30 +00:00
Michael Woerister
c533902285 MIR: Add pass that erases all regions right before trans 2015-11-18 17:26:24 +01:00
bors
64a65692a2 Auto merge of #29906 - ranma42:doc-typo, r=steveklabnik 2015-11-18 15:54:28 +00:00
bors
28f6b88978 Auto merge of #29902 - huonw:smart-quotes, r=alexcrichton
cc https://github.com/rust-lang/rust/pull/29837#issuecomment-157540449
2015-11-18 10:58:04 +00:00
Andrea Canciani
64555321ce Fix typo in libcore documentation 2015-11-18 11:35:29 +01:00
bors
1715f1cf7f Auto merge of #29904 - Zoxc:ar_json, r=alexcrichton
This allows targets to drop the dependency on AR.
2015-11-18 07:13:39 +00:00
Huon Wilson
41f7f0c341 Add some unicode aliases for ". 2015-11-18 17:16:32 +11:00
bors
8ed8679b2e Auto merge of #29897 - alexcrichton:process-wait-with-output, r=brson
Previously this function used channels but this isn't necessary any more now
that threads have return values. This also has the added bonus of appropriately
waiting for the thread to exit to ensure that the function doesn't still have
running threads once it returns.
2015-11-18 04:00:43 +00:00
bors
50b969d3b2 Auto merge of #29882 - devonhollowood:master, r=Manishearth
Implement #14615
2015-11-18 02:02:00 +00:00
John Kåre Alsaker
9e1d9e4884 Expose archive_format to target specifications 2015-11-18 02:39:46 +01:00
bors
277416edcd Auto merge of #29900 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #29612, #29888, #29889, #29890, #29891, #29892
- Failed merges:
2015-11-17 23:55:53 +00:00
Steve Klabnik
5c99fb78c6 Rollup merge of #29892 - steveklabnik:doc_fromiterator, r=alexcrichton
And modifying IntoIterator for consisntency with it.

Part of #29360
2015-11-17 18:13:06 -05:00
Steve Klabnik
6e4f6c8f5f Rollup merge of #29891 - steveklabnik:gh29470, r=alexcrichton
Fixes #29470
2015-11-17 18:13:06 -05:00
Steve Klabnik
370b793969 Rollup merge of #29890 - steveklabnik:gh29742, r=Manishearth
FIxes #29742
2015-11-17 18:13:06 -05:00
Steve Klabnik
8adfcf1b7c Rollup merge of #29889 - steveklabnik:gh29801, r=manishearth
First, re-word the section on if let/while let to be more clear.

Second, actually call them let statements in the statement section

Fixes #29801
2015-11-17 18:13:05 -05:00
Steve Klabnik
fb6687150c Rollup merge of #29888 - steveklabnik:gh29762, r=sanxiyn
Fixes #29762
2015-11-17 18:13:05 -05:00
Steve Klabnik
cffd88110c Rollup merge of #29612 - steveklabnik:gh29502, r=alexcrichton
libcore does have a few deps, like noted in https://github.com/rust-lang/rust/issues/29390

Fixes #29502

r? @alexcrichton
2015-11-17 18:13:05 -05:00
Steve Klabnik
9d663a3e4a More docs for FromIterator
And modifying IntoIterator for consisntency with it.

Part of #29360
2015-11-17 18:12:50 -05:00
Steve Klabnik
60c84eed42 Remove claims of dependency-free libcore
libcore does have a few deps, like noted in https://github.com/rust-lang/rust/issues/29390

Fixes #29502
2015-11-17 18:04:36 -05:00
Steve Klabnik
cf384c21ea Clear up the reference around let
First, re-word the section on if let/while let to be more clear.

Second, actually call them let statements in the statement section

Fixes #29801
2015-11-17 17:41:26 -05:00
Vadim Petrochenkov
5cdfd8401b Review fixes 2015-11-18 01:24:22 +03:00
Vadim Petrochenkov
7e2ffc7090 Add missing annotations and some tests 2015-11-18 01:24:21 +03:00
Vadim Petrochenkov
52acc05f63 Rework stability annotation pass 2015-11-18 01:24:20 +03:00
bors
841e36eb21 Auto merge of #29797 - oli-obk:remove-fromb, r=nikomatsakis
the const evaluator has a bool constant value, no need to use integers

the `fromb` function is very old. It took me a while of git-blame until i found where it was created. I think it was just a hack. All tests still pass.

I also forbade `&&` and `||` on integral types
2015-11-17 22:12:07 +00:00
Alex Crichton
33353668fc std: Use join() in Process::wait_with_output
Previously this function used channels but this isn't necessary any more now
that threads have return values. This also has the added bonus of appropriately
waiting for the thread to exit to ensure that the function doesn't still have
running threads once it returns.
2015-11-17 13:37:44 -08:00
Devon Hollowood
0823ee6940 Add changes to liblibc 2015-11-17 13:16:09 -08:00
bors
b2f539375a Auto merge of #29887 - sanxiyn:match-ref-pats, r=sfackler 2015-11-17 20:10:25 +00:00
bors
b31cc644d1 Auto merge of #29766 - oli-obk:impl_item, r=nikomatsakis
[breaking change]

I'm not sure if those renames are ok. [TokenType::Tt* to TokenType::*](https://github.com/rust-lang/rust/pull/29582) was obvious, but for all those Item-enums it's less obvious to me what the right way forward is due to the underscore.
2015-11-17 18:24:19 +00:00
Steve Klabnik
9ca257a5b6 Fix up escapes in the reference
Fixes #29470
2015-11-17 11:54:20 -05:00
Steve Klabnik
dcf7e4da69 Clarify comment about structs and lifetimes
FIxes #29742
2015-11-17 11:42:17 -05:00
Steve Klabnik
0f5ba5459b Mention libc from crates.io in TRPL: FFI
Fixes #29762
2015-11-17 11:12:57 -05:00
bors
8809a33c34 Auto merge of #29531 - bltavares:issue-28586, r=sanxiyn
Cloases #28586
2015-11-17 15:39:10 +00:00
Seo Sanghyeon
95f6ea920d Fix match_ref_pats flagged by Clippy 2015-11-17 23:24:49 +09:00
bors
c61e8fd61a Auto merge of #29883 - Manishearth:rollup, r=Manishearth
- Successful merges: #29868, #29873, #29874, #29875, #29876, #29880, #29881
- Failed merges:
2015-11-17 09:42:31 +00:00
Manish Goregaokar
e81c72e78e Rollup merge of #29881 - jeanm:patch-1, r=Manishearth
Change conditional perfect to past perfect.
2015-11-17 15:12:15 +05:30
Manish Goregaokar
c063c521ec Rollup merge of #29880 - dignati:fix-freebsd-libc, r=alexcrichton
With this change the build on FreeBSD is almost working again.
2015-11-17 15:12:15 +05:30
Manish Goregaokar
3d1f3c9d38 Rollup merge of #29876 - cardoe:i586-build-fix, r=alexcrichton
On distros that use i486 or i586 in their CHOST, Rust will fail to build
because it is not handling i486 or i586 like i686 is handled. This
changes the match to do work for all instances of i?86 instead of just
i686. The Yocto Project still uses i586 as a target.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2015-11-17 15:12:15 +05:30
Manish Goregaokar
bf565467c0 Rollup merge of #29875 - steveklabnik:gh29784, r=Manishearth
Fixes #29784
2015-11-17 15:12:15 +05:30
Manish Goregaokar
e0adabf0ee Rollup merge of #29874 - steveklabnik:gh29711, r=alexcrichton
in their API docs

Fixes #29711
2015-11-17 15:12:14 +05:30
Manish Goregaokar
ff2f74561d Rollup merge of #29873 - steveklabnik:gh29493, r=nikomatsakis
Fixes #29493
2015-11-17 15:12:14 +05:30
Manish Goregaokar
98b18f5e8e Rollup merge of #29868 - petrochenkov:gv, r=sanxiyn
r? @arielb1
2015-11-17 15:12:14 +05:30
Devon Hollowood
5e8225af91 Remove unused imports 2015-11-17 01:19:14 -08:00
Devon Hollowood
07e108f038 Remove 'raw_pointer_derive' lint (#14615) 2015-11-17 01:19:14 -08:00
Oliver Schneider
96cfac6301 add unit test for the new and the changed errors 2015-11-17 10:00:34 +01:00
bors
1b2614847d Auto merge of #29837 - Wafflespeanut:unicode_chars, r=Manishearth
fixes #25957
2015-11-17 07:42:03 +00:00
Ravi Shankar
7f63c7cf4c Detect confusing unicode characters and show the alternative 2015-11-17 12:14:28 +05:30
bors
c124cd523a Auto merge of #29870 - petrochenkov:typaren, r=nrc
Like d21bfff78c, but for the type grammar.

r? @nrc
2015-11-17 05:55:07 +00:00