bors [Thu, 19 Nov 2015 23:57:07 +0000 (23:57 +0000)]
Auto merge of #29894 - alexcrichton:stdtime, r=brson
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.
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:
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.
Tobias Bucher [Tue, 17 Nov 2015 23:33:34 +0000 (23:33 +0000)]
Ignore malformed environment variables on Windows too
Leading equals symbols are treated as part of the variable name, if
there is no other equality symbol or none at all, the environment string
is ignored.
Alex Crichton [Tue, 17 Nov 2015 01:36:14 +0000 (17:36 -0800)]
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.
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:
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.
bors [Thu, 19 Nov 2015 16:49:20 +0000 (16:49 +0000)]
Auto merge of #29932 - steveklabnik:trpl_book, r=brson
The book was located under 'src/doc/trpl' because originally, it was
going to be hosted under that URL. Late in the game, before 1.0, we
decided that /book was a better one, so we changed the output, but
not the input. This causes confusion for no good reason. So we'll change
the source directory to look like the output directory, like for every
other thing in src/doc.
Steve Klabnik [Thu, 19 Nov 2015 16:30:18 +0000 (11:30 -0500)]
src/doc/trpl -> src/doc/book
The book was located under 'src/doc/trpl' because originally, it was
going to be hosted under that URL. Late in the game, before 1.0, we
decided that /book was a better one, so we changed the output, but
not the input. This causes confusion for no good reason. So we'll change
the source directory to look like the output directory, like for every
other thing in src/doc.
bors [Thu, 19 Nov 2015 02:51:15 +0000 (02:51 +0000)]
Auto merge of #29917 - shssoichiro:doc-sidebar-order, r=alexcrichton
A race condition in Javascript was causing unpredictable ordering
of the sidebar boxes when loading documentation generated by
rustdoc, due to the script that adds the Crates box being executed
asynchronously. Disabling the asynchronous execution and deferring
this script should ensure that the Crates box always appears last
in the sidebox (this seemed to be the more common ordering prior
to this change).
bors [Thu, 19 Nov 2015 01:01:30 +0000 (01:01 +0000)]
Auto merge of #29903 - nikomatsakis:incr-comp-ool-items, r=mw,nrc
This PR moves items into a separate map stored in the krate, rather than storing them inline in the HIR. The HIR visitor is also modified to skip visiting nested items by default. The goal here is to ensure that if you get access to the HIR for one item, you don't automatically get access to a bunch of other items, for better dependency tracking.
Niko Matsakis [Wed, 18 Nov 2015 10:38:50 +0000 (05:38 -0500)]
Modify trans to use an outer walk and ensure that we rotate as we
encounter each module. This is somewhat different than how it used to
work; it should ensure a more equitable distribution of work than
before. The reason is that, before, when we rotated, we would rotate
before we had seen the full contents of the current module. So e.g. if
we have `mod a { mod b { .. } .. }`, then we rotate when we encounter
`b`, but we haven't processed the remainder of `a` yet. Unclear if this
makes any difference in practice, but it seemed suboptimal. Also, this
structure (with an outer walk over modules) is closer to what we will
want for an incremental setting.
Niko Matsakis [Tue, 17 Nov 2015 23:57:04 +0000 (18:57 -0500)]
Port trans to use visit_all_items: this was mostly straight-forward, but
noteworthy because trans got mildly simpler, since it doesn't have to
ensure that we walk the contents of all things just to find all the
hidden items.
Niko Matsakis [Tue, 17 Nov 2015 23:54:21 +0000 (18:54 -0500)]
Port entry code to `visit_all_items` -- since this was tracking whether
the main fn appeared at the top level, if now consults the `DefPath` to
get this information
Niko Matsakis [Tue, 17 Nov 2015 22:51:44 +0000 (17:51 -0500)]
Port a bunch of code new-visitor; all of these ports were
straightforward uses of `visit_all_items`. In some cases I had to remove
empty `visit_item` calls that were just to suppress visiting nested
items.
Niko Matsakis [Tue, 17 Nov 2015 22:32:12 +0000 (17:32 -0500)]
Refactor the HIR so that items are stored in a map in the `Crate`,
rather being stored inline. Refactor (and rename) the visitor so that
(by default) it only visits the interior content of an item not nested
items.
This is a [breaking-change] for anyone who uses the HIR visitor. Besides
changing `visit::` to `intravisit::`, you need to refactor your visitor
in one of two ways, depending on what it requires:
1. If you just want to visit all items (most common), you should call
`krate.visit_all_items(&mut visitor)`.
2. If you need to visit nested items in the middle of the parent items,
you should override `visit_nested_item` with something like:
`self.visit_item(self.tcx.map.expect_item(item.id))`, presuming you
have access to a tcx (or at least a HIR map).
Niko Matsakis [Sat, 31 Oct 2015 13:24:30 +0000 (09:24 -0400)]
Remove seemingly pointless case -- this customized variant avoided
walking the patterns in a type fn decl, but those patterns are ignored
by this visitor anyway.
bors [Wed, 18 Nov 2015 21:33:34 +0000 (21:33 +0000)]
Auto merge of #29878 - wthrowe:libdir2, r=brson
Rather than modifying the installer to disable directory rewriting,
this patch modifies the directory structure passed to the installer so
that the rewriting gives the correct results. This means that if a
non-standard --libdir is passed to configure then the same --libdir
option (relative to the --prefix) must be passed to the install
script. In the `make install` case this is handled automatically.
Binary distributions are generally generated using the default
--libdir and then have paths optionally rewritten by the installer,
which should continue to work.
This has the advantage of not complicating the installer interface
intended for end-user use.
Joshua Holmer [Wed, 18 Nov 2015 21:21:19 +0000 (16:21 -0500)]
Fix unpredictable ordering of sidebar boxes in rustdoc
A race condition in Javascript was causing unpredictable ordering
of the sidebar boxes when loading documentation generated by
rustdoc, due to the script that adds the Crates box being executed
asynchronously. Disabling the asynchronous execution and deferring
this script should ensure that the Crates box always appears last
in the sidebox (this seemed to be the more common ordering prior
to this change).
bors [Wed, 18 Nov 2015 19:49:33 +0000 (19:49 +0000)]
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.
bors [Wed, 18 Nov 2015 18:06:30 +0000 (18:06 +0000)]
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.
bors [Wed, 18 Nov 2015 04:00:43 +0000 (04:00 +0000)]
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.
bors [Tue, 17 Nov 2015 22:12:07 +0000 (22:12 +0000)]
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.
Alex Crichton [Tue, 17 Nov 2015 21:37:44 +0000 (13:37 -0800)]
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.
bors [Tue, 17 Nov 2015 18:24:19 +0000 (18:24 +0000)]
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.
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.
bors [Tue, 17 Nov 2015 04:08:11 +0000 (04:08 +0000)]
Auto merge of #29860 - steveklabnik:stackheapfixes, r=huonw
Fixes #29853
Fixes #29852
While these points are true, we're not going for 100% accuracy here,
this is introductory material. Changing these things would be more
confusing, but it is important to note that we're presenting an
abstraction here.
bors [Tue, 17 Nov 2015 02:21:20 +0000 (02:21 +0000)]
Auto merge of #29794 - semarie:openbsd-stdcpp-path, r=alexcrichton
under openbsd, the library path of libstdc++ need to be explicit (due
to the fact the default linker `cc` is gcc-4.2, and not gcc-4.9).
but when a recent LLVM is installed, rustc compilation pikes the bad
LLVM version (which live in /usr/local/lib, which is same directory of
libestdc++.so for gcc-4.9).
this patch move the libstdc++ path from RUST_FLAGS_<target> to special
variable, and use it *after* LLVM_LIBDIR_RUSTFLAGS_<target> in
arguments.
William Throwe [Mon, 16 Nov 2015 23:35:17 +0000 (18:35 -0500)]
Fix --libdir installs
Rather than modifying the installer to disable directory rewriting,
this patch modifies the directory structure passed to the installer so
that the rewriting gives the correct results. This means that if a
non-standard --libdir is passed to configure then the same --libdir
option (relative to the --prefix) must be passed to the install
script. In the `make install` case this is handled automatically.
Binary distributions are generally generated using the default
--libdir and then have paths optionally rewritten by the installer,
which should continue to work.
This has the advantage of not complicating the installer interface
intended for end-user use.
Tobias Bucher [Sun, 25 Oct 2015 12:05:34 +0000 (12:05 +0000)]
Ignore malformed environment strings like glibc does
Otherwise, the iterator and the functions for getting specific
environment variables might disagree, for environments like
FOOBAR
Variable names starting with equals sign are OK:
glibc only interprets equals signs not in the first position as
separators between variable name and variable value. Instead of skipping
them entirely, a leading equals sign is interpreted to be part of the
variable name.
Doug Goldstein [Mon, 16 Nov 2015 23:01:58 +0000 (17:01 -0600)]
mk/platform: support i486 and i586 target CHOST
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.