Commit Graph

50274 Commits

Author SHA1 Message Date
Oliver 'ker' Schneider
73fa9b2da2 [breaking-change] don't glob export ast::Mutablity variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
14e09ad468 [breaking-change] don't glob export ast::MetaItem_ 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
e797e1961d [breaking-change] don't glob export ast::MacStmtStyle 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
798974cae5 [breaking-change] don't glob export ast::KleeneOp variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
019614f03d [breaking-change] don't glob export ast::Item_ variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
0d6ddd1903 [breaking-change] don't glob export ast::ForeignItem_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
8290c950a8 [breaking-change] don't pub export ast::Stmt_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
498a2e416e [breaking-change] don't pub export ast::IntLitType variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
69072c4f5d [breaking-change] don't pub export ast::Lit_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
05d4cefd63 [breaking-change] don't pub export ast::Ty_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
ec61e632c0 [breaking-change] remove unused enum ast::PrimTy 2016-02-11 12:34:48 +01:00
Oliver Schneider
08e35d4dec remove unit test that can't be tested anymore 2016-02-11 12:34:48 +01:00
Oliver Schneider
bfa66bb389 [breaking-change] remove the sign from integer literals in the ast 2016-02-11 12:34:48 +01:00
Oliver Schneider
625e78b700 [breaking-change] don't glob export ast::{UintTy, IntTy} variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
ccf48bcd40 [breaking-change] don't glob export ast::FloatTy variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
80bf9ae18a [breaking-change] don't glob export ast::Expr_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
1c4d437158 [breaking-change] don't glob export ast::ExplicitSelf_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
79fa657abc [breaking-change] don't glob export ast::Decl_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
8516ba367d [breaking-change] don't glob export ast::CaptureClause variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
243a30c931 [breaking-change] don't glob import/export syntax::abi enum variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
47b0784ba8 [breaking-change] don't glob export ast::BlockCheckMode variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
3b57d40fe5 [breaking-change] don't glob import ast::FunctionRetTy variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
05e25de4f0 [breaking-change] don't glob export ast::BinOp_ 2016-02-11 12:34:48 +01:00
Oliver Schneider
f875f4c4c2 [breaking-change] don't glob export ast::UnOp variants 2016-02-11 12:34:48 +01:00
bors
060848c315 Auto merge of #31507 - dirk:dirk/fix-rustdoc-undeclared-type-ice, r=nrc
Fixes #31451.
2016-02-11 09:01:12 +00:00
bors
b9732ed147 Auto merge of #31357 - rthomas:hashers, r=alexcrichton
add a public hasher function for HashSet and HashMap
2016-02-11 06:48:54 +00:00
Ryan Thomas
ca7f550a6e Add a public hasher function for HashSet and HashMap 2016-02-11 05:01:04 +00:00
bors
1de70d33f7 Auto merge of #31461 - jseyfried:remove_import_resolutions, r=nrc
This PR adds to `NameBinding` so it can more fully represent bindings from imports as well from items, refactors away `Target`, generalizes `ImportResolution` to a simpler type `NameResolution`, and uses a single `NameResolution`-valued map in place the existing maps `children` and `import_resolutions` (of `NameBinding`s and `ImportResolution`s, respectively), simplifying duplicate checking and name resolution.

It also unifies the `resolve_name_in_module` in `lib.rs` with its namesake in `resolve_imports.rs`, clarifying and improving the core logic (fixes #31403 and fixes #31404) while maintaining clear future-comparability with shadowable globs (i.e., never reporting that a resolution is a `Success` or is `Failing` unless this would also be knowable with shadowable globs).

Since it fixes #31403, this is technically a [breaking-change], but it is exceedingly unlikely to cause breakage in practice. The following is an example of code that would break:
```rust
mod foo {
    pub mod bar {} // This defines bar in the type namespace
    pub use alpha::bar; // This defines bar in the value namespace

    // This should define baz in both namespaces, but it only defines baz in the type namespace.
    pub use self::bar as baz;
    pub fn baz() {} // This should collide with baz, but now it does not.
}

pub fn f() {}
mod alpha {
    pub use self::f as bar; // Changing this to `pub fn bar() {}` causes the collision right now.
    pub use super::*;
}
```

r? @nrc
2016-02-11 04:27:13 +00:00
bors
106070b905 Auto merge of #31479 - kamalmarhubi:fmt-pointer-unsized, r=alexcrichton
This allows printing pointers to unsized types with the {:p} formatting
directive. The following impls are extended to unsized types:
 - impl<'a, T: ?Sized> Pointer for &'a T
 - impl<'a, T: ?Sized> Pointer for &'a mut T
 - impl<T: ?Sized> Pointer for *const T
 - impl<T: ?Sized> Pointer for *mut T
 - impl<T: ?Sized> fmt::Pointer for Box<T>
 - impl<T: ?Sized> fmt::Pointer for Rc<T>
 - impl<T: ?Sized> fmt::Pointer for Arc<T>
2016-02-11 01:54:15 +00:00
bors
3f4227af13 Auto merge of #31409 - alexcrichton:command-exec, r=aturon
These commits are an implementation of https://github.com/rust-lang/rfcs/pull/1359 which is tracked via https://github.com/rust-lang/rust/issues/31398. The `before_exec` implementation fit easily with the current process spawning framework we have, but unfortunately the `exec` implementation required a bit of a larger refactoring. The stdio handles were all largely managed as implementation details of `std::process` and the `exec` function lived in `std::sys`, so the two didn't have access to one another.

I took this as a sign that a deeper refactoring was necessary, and I personally feel that the end result is cleaner for both Windows and Unix. The commits should be separated nicely for reviewing (or all at once if you're feeling ambitious), but the changes made here were:

* The process spawning on Unix was refactored in to a pre-exec and post-exec function. The post-exec function isn't allowed to do any allocations of any form, and management of transmitting errors back to the parent is managed by the pre-exec function (as it's the one that actually forks).
* Some management of the exit status was pushed into platform-specific modules. On Unix we must cache the return value of `wait` as the pid is consumed after we wait on it, but on Windows we can just keep querying the system because the handle stays valid.
* The `Stdio::None` variant was renamed to `Stdio::Null` to better reflect what it's doing.
* The global lock on `CreateProcess` is now correctly positioned to avoid unintended inheritance of pipe handles that other threads are sending to their child processes. After a more careful reading of the article referenced the race is not in `CreateProcess` itself, but rather the property that handles are unintentionally shared.
* All stdio management now happens in platform-specific modules. This provides a cleaner implementation/interpretation for `FromFraw{Fd,Handle}` for each platform as well as a cleaner transition from a configuration to what-to-do once we actually need to do the spawn.

With these refactorings in place, implementing `before_exec` and `exec` ended up both being pretty trivial! (each in their own commit)
2016-02-10 22:51:43 +00:00
bors
5d771cd5b3 Auto merge of #31455 - tmiasko:expected-tokens, r=alexcrichton
Previously when breaking tokens into smaller pieces, the replace_token
function have been used. It replaced current token and updated span
information, but it did not clear the list of expected tokens, neither
did it update remaining info about last token. This could lead to
incorrect error message, like one described in the issue #24780:

    expected one of ... `>` ...  found `>`
2016-02-10 20:55:53 +00:00
Alex Crichton
d9c6a51c3b std: Move constant back to where it needs to be
Lost track of this during the std::process refactorings
2016-02-10 09:28:49 -08:00
Alex Crichton
efb23db79a std: Use macros from libc instead of locally
Helps cut down on #[cfg]!
2016-02-10 09:28:49 -08:00
Alex Crichton
b37477c03e std: Implement CommandExt::exec
This commit implements the `exec` function proposed in [RFC 1359][rfc] which is
a function on the `CommandExt` trait to execute all parts of a `Command::spawn`
without the `fork` on Unix. More details on the function itself can be found in
the comments in the commit.

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

cc #31398
2016-02-10 09:28:49 -08:00
Alex Crichton
d15db1d392 std: Push process stdio setup in std::sys
Most of this is platform-specific anyway, and we generally have to jump through
fewer hoops to do the equivalent operation on Windows. One benefit for Windows
today is that this new structure avoids an extra `DuplicateHandle` when creating
pipes. For Unix, however, the behavior should be the same.

Note that this is just a pure refactoring, no functionality was added or
removed.
2016-02-10 09:28:48 -08:00
Alex Crichton
18f9a79c23 std: Lift out Windows' CreateProcess lock a bit
The function `CreateProcess` is not itself unsafe to call from many threads, the
article in question is pointing out that handles can be inherited by unintended
child processes. This is basically the same race as the standard Unix
open-then-set-cloexec race.

Since the intention of the lock is to protect children from inheriting
unintended handles, the lock is now lifted out to before the creation of the
child I/O handles (which will all be inheritable). This will ensure that we only
have one process in Rust at least creating inheritable handles at a time,
preventing unintended inheritance to children.
2016-02-10 09:28:48 -08:00
Alex Crichton
b8bd8f3d7c std: Rename Stdio::None to Stdio::Null
This better reflects what it's actually doing as we don't actually have an
option for "leave this I/O slot as an empty hole".
2016-02-10 09:28:48 -08:00
Alex Crichton
627515a7ff std: Push Child's exit status to sys::process
On Unix we have to be careful to not call `waitpid` twice, but we don't have to
be careful on Windows due to the way process handles work there. As a result the
cached `Option<ExitStatus>` is only necessary on Unix, and it's also just an
implementation detail of the Unix module.

At the same time. also update some code in `kill` on Unix to avoid a wonky
waitpid with WNOHANG. This was added in 0e190b9a to solve #13124, but the
`signal(0)` method is not supported any more so there's no need to for this
workaround. I believe that this is no longer necessary as it's not really doing
anything.
2016-02-10 09:28:48 -08:00
Alex Crichton
b1898db0f1 std: Implement CommandExt::before_exec
This is a Unix-specific function which adds the ability to register a closure to
run pre-exec to configure the child process as required (note that these
closures are run post-fork).

cc #31398
2016-02-10 09:28:48 -08:00
Alex Crichton
6c41984690 std: Refactor process spawning on Unix
* Build up the argp/envp pointers while the `Command` is being constructed
  rather than only when `spawn` is called. This will allow better sharing of
  code between fork/exec paths.
* Rename `child_after_fork` to `exec` and have it only perform the exec half of
  the spawning. This also means the return type has changed to `io::Error`
  rather than `!` to represent errors that happen.
2016-02-10 09:28:48 -08:00
bors
b5da60d03a Auto merge of #30686 - wesleywiser:rustdoc_display_since, r=steveklabnik
Here's some screenshots after this change:

![screen shot 2016-01-03 at 11 38 30 am](https://cloud.githubusercontent.com/assets/831192/12079661/23da4e38-b20f-11e5-8c84-ba51d7a59c3f.png)
![screen shot 2016-01-03 at 11 40 39 am](https://cloud.githubusercontent.com/assets/831192/12079663/23e00012-b20f-11e5-9f01-408cc8d43687.png)
![screen shot 2016-01-03 at 11 42 17 am](https://cloud.githubusercontent.com/assets/831192/12079662/23dfe6c2-b20f-11e5-9998-53abc643e2ef.png)

I tried to click through the `std` docs and make sure everything that can have stability attributes has it rendered but I'm probably missing some. I'd also appreciate any feedback on the css changes. I had difficulty getting the `since` labels aligning correctly for enum variants. If anyone has a better idea for that, I'd be glad to implement it.

Fixes #27607
2016-02-10 17:23:40 +00:00
bors
052b3fd4a0 Auto merge of #31499 - kamalmarhubi:cfg-flag-invalid-cfgs, r=brson
A spec like `#[cfg(foo(bar))]` is not allowed as an attribute. This
makes the same spec be rejected by the compiler if passed in as a
`--cfg` argument.

Fixes #31495
2016-02-10 14:24:41 +00:00
bors
32d962d16f Auto merge of #31420 - bluss:deque-equality, r=Gankro
collections: Use slice parts in PartialEq for VecDeque

This improves == for VecDeque by using the slice representation.

This will also improve further if codegen for slice comparison improves.

Benchmark run of 1000 u64 elements, comparing for equality (all equal).
Cpu time to compare the vecdeques is reduced to less than 50% of what it
was before.

```
test test_eq_u64       ... bench:  1,885 ns/iter (+/- 163) = 4244 MB/s
test test_eq_new_u64   ... bench:    802 ns/iter (+/- 100) = 9975 MB/s
```
2016-02-10 10:04:46 +00:00
bors
523fa1331e Auto merge of #31494 - alexcrichton:ar-gnu-by-default, r=brson
The compiler currently vendors its own version of "llvm-ar" (not literally the
binary but rather the library support) and uses it for all major targets by
default (e.g. everything defined in `src/librustc_back/target`). All custom
target specs, however, still search for an `ar` tool by default. This commit
changes this default behavior to using the internally bundled llvm-ar with the
GNU format.

Currently all targets use the GNU format except for OSX which uses the BSD
format (surely makes sense, right?), and custom targets can change the format
via the `archive-format` key in custom target specs.

I suspect that we can outright remove support for invoking an external `ar`
utility, but I figure for now there may be some crazy target relying on that so
we should leave support in for now.
2016-02-10 08:03:06 +00:00
bors
9a20bfc856 Auto merge of #31465 - nagisa:mir-free-fix, r=nikomatsakis
Fixes #31463
2016-02-10 04:34:15 +00:00
Wesley Wiser
75acee2bde Rustdoc - display since version for stable items
Fixes #27607
2016-02-09 21:20:41 -05:00
bors
0542745768 Auto merge of #31438 - aturon:stab-ip-addr, r=alexcrichton
After [considerable pushback](https://github.com/rust-lang/rfcs/issues/1451), it's clear that there is a community consensus around providing `IpAddr` in the standard library, together with other APIs using it.

This commit reverts from deprecated status directly to stable. The deprecation landed in 1.6, which has already been released, so the stabilization is marked for 1.7 (currently in beta; will require a backport).

r? @alexcrichton
2016-02-10 01:05:42 +00:00
bors
32b2ef7add Auto merge of #31523 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #31473, #31513, #31514, #31515, #31516, #31520
- Failed merges:
2016-02-09 22:28:45 +00:00
Steve Klabnik
af1a0a3466 Rollup merge of #31520 - steveklabnik:doc_num, r=alexcrichton
This commit does two things:

* Re-works the module-level documentation.
* Cleaning up wording and adding links to where error types are used.

Part of #29364
2016-02-09 16:58:59 -05:00
Steve Klabnik
4c50d76298 Rollup merge of #31516 - steveklabnik:doc_tuples, r=brson
Fixes #29339
2016-02-09 16:58:59 -05:00