Commit Graph

48391 Commits

Author SHA1 Message Date
mitaa 82d37f3788 Show constness for functions of reexported docs 2015-11-19 22:47:02 +01:00
mitaa 81b4c1342a Fix rustdocs `unsafe const fn` ordering 2015-11-19 22:01:49 +01:00
Tobias Bucher 06fab0ea70 Add run-pass test for paths containing the NUL character 2015-11-19 20:05:50 +00:00
Tobias Bucher 4d81c02a20 Error when paths contain NUL characters
On Windows: Previously these paths were silently truncated at these NUL
characters, now they fail with `ErrorKind::InvalidInput`.
2015-11-19 20:05:09 +00:00
Tobias Bucher 9b4f16b370 Re-unignore environment test on MinGW 2015-11-19 20:02:35 +00:00
Tobias Bucher 14983477ca 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.
2015-11-19 20:00:36 +00:00
bors 1902021032 Auto merge of #29925 - Ms2ger:fmt-trans-base, r=luqmana 2015-11-19 19:51:27 +00:00
Ariel Ben-Yehuda 3c0d55cc76 constrained_type_params: make projections depend on their trait-ref
As this is a soundness fix, it is a [breaking-change].

Fixes #29861.
2015-11-19 20:53:59 +02:00
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 fd688f4075 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.

r? @brson
2015-11-19 16:49:20 +00:00
Steve Klabnik 024aa9a345 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.
2015-11-19 11:30:18 -05:00
Tobias Bucher c5971a29da Remove unneeded `#[derive(Copy)]`
It was introduced with the change that made copy opt-in. The
implementation gives a warning, because the struct contains a raw
pointer.
2015-11-19 16:00:54 +00:00
Ms2ger 83b636930d Avoid a string allocation. 2015-11-19 12:37:13 +01:00
Ms2ger 3ccef0fdc5 Rustfmt trans/base.rs. 2015-11-19 12:36:31 +01:00
Vadim Petrochenkov c1ad5af4a6 Changes to data produced by privacy pass 2015-11-19 14:16:35 +03:00
Vadim Petrochenkov af96402cc8 Add a future compatibility note 2015-11-19 11:41:09 +03:00
Vadim Petrochenkov 4573bb8e96 Add special case for `UnitVariant(..)` patterns 2015-11-19 11:41:09 +03:00
Vadim Petrochenkov 35749923ee Fix the fallout 2015-11-19 11:41:09 +03:00
Vadim Petrochenkov 0f8519c341 Fix various bugs around empty structs and patterns 2015-11-19 11:39:18 +03:00
bors 3e48b0e380 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).

Fixes #29698
2015-11-19 02:51:15 +00:00
bors 9303055f37 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.

r? @nrc
cc @eddyb
2015-11-19 01:01:30 +00:00
Niko Matsakis 7926fa1ee9 Update unit tests in driver. 2015-11-18 19:23:30 -05:00
Niko Matsakis f8f2e2bad5 minor fixes to #[cfg(test)] code 2015-11-18 19:23:29 -05:00
Niko Matsakis cfe4c3567a ratchet down the recursion limit because, at least in my testing,
under some configurations this still causes a stack overflow and
hence a crash
2015-11-18 19:23:29 -05:00
Niko Matsakis 7c2ee5ed12 Patch graphviz tests to account for the fact that nested items are not
listed (an improvement, I think).
2015-11-18 19:23:29 -05:00
Niko Matsakis bca026efb9 Fix two long lines. 2015-11-18 19:23:29 -05:00
Niko Matsakis 06f2d9da87 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.
2015-11-18 19:23:29 -05:00
Niko Matsakis 0bc61402a9 Remove rustc_data_structures from the deps of librustc_front now
that we no longer use FnvHashMap
2015-11-18 19:23:29 -05:00
Niko Matsakis e303c250f1 Change to a BTreeMap rather than sorting the keys of a FnvHashMap. 2015-11-18 19:23:29 -05:00
Niko Matsakis db97c93c99 Add comment explaining why it is called `intravisit` 2015-11-18 19:23:29 -05:00
Niko Matsakis 1e941f8e97 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.
2015-11-18 19:23:29 -05:00
Niko Matsakis 98b046e16e Various straight-forward ports that override `visit_nested_items`
to do "in-situ" visits.
2015-11-18 19:23:29 -05:00
Niko Matsakis ac38021da1 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
2015-11-18 19:22:18 -05:00
Niko Matsakis e4ff9f71db 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.
2015-11-18 19:22:18 -05:00
Niko Matsakis e14562d515 Rework the `IdVisitor` so that it only visits item contents (and doesn't
visit nested items). This is what all clients wanted anyhow.
2015-11-18 19:22:18 -05:00
Niko Matsakis 25727d70d1 Port the `map` construction code to use the new visitor. 2015-11-18 19:22:18 -05:00
Niko Matsakis 767ee79c4c 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).
2015-11-18 19:22:18 -05:00
Niko Matsakis 66326bc665 refactorings of `lowering` that make it more amenable to using `&mut`
instead of `Cell` (but stop short of actualling switching to `&mut`)
2015-11-18 19:22:17 -05:00
Niko Matsakis 6ccd390dbd rename `_lctx` to `lctx` where appropriate 2015-11-18 19:22:17 -05:00
Niko Matsakis 6913ed0f3c 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.
2015-11-18 19:22:17 -05:00
bors 2978af09d3 Auto merge of #29910 - tbu-:pr_env_revert_mingw_weirdness, r=alexcrichton 2015-11-18 23:17:30 +00:00
bors edcfeb7996 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.

Fixes #29561
2015-11-18 21:33:34 +00:00
Joshua Holmer 51c35dbd30 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).

Fixes #29698
2015-11-18 16:21:19 -05:00
Manish Goregaokar c23cbae0cb Add long error diagnostics for E0401 2015-11-19 02:01:19 +05:30
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
Tobias Bucher 2731c822ae Revert not-ignoring weird environment variables for MinGW 2015-11-18 14:09:54 +00:00