Andre Bogus [Mon, 13 Aug 2018 21:17:45 +0000 (23:17 +0200)]
Two small improvements
In `librustc_apfloat/ieee.rs`, use the iterator.[r]find methods to
simplify the code. In `libserialize/json.rs`, make use of the fact
that `Vec.last` on an empty `Vec` returns `None` to simplify the
code to a single match.
bors [Wed, 15 Aug 2018 09:08:35 +0000 (09:08 +0000)]
Auto merge of #53367 - ehuss:update-cargo, r=alexcrichton
Update cargo
- Update transitioning url (rust-lang/cargo#5889)
- Resolve some clippy lint warnings (rust-lang/cargo#5884)
- Don't kill child processes on normal exit on Windows (rust-lang/cargo#5887)
- fix a bunch of clippy warnings (rust-lang/cargo#5876)
- Add support for rustc's --error-format short (rust-lang/cargo#5879)
- Support JSON with rustdoc. (rust-lang/cargo#5878)
- Fix rustfmt instructions in CONTRIBUTING.md (rust-lang/cargo#5880)
- Allow `cargo run` in workspaces. (rust-lang/cargo#5877)
- Change target filters in workspaces. (rust-lang/cargo#5873)
- Improve verbose console and log for finding git repo in package check (rust-lang/cargo#5858)
- Meta rename (rust-lang/cargo#5871)
- fetch: skip target tests when cross_compile is disabled (rust-lang/cargo#5870)
- Fully capture rustc and rustdoc output when -Zcompile-progress is passed (rust-lang/cargo#5862)
- Fix test --example docs. (rust-lang/cargo#5867)
- Add a feature to build a vendored OpenSSL (rust-lang/cargo#5865)
bors [Wed, 15 Aug 2018 00:37:52 +0000 (00:37 +0000)]
Auto merge of #52928 - Mark-Simulacrum:borrowck-cleanup, r=cramertj
(old) borrowck cleanup
Primarily moves dataflow code based on CFG to borrowck; this is mostly so we don't forget to delete it once it becomes unused after we fully move to MIR borrowck.
bors [Tue, 14 Aug 2018 22:22:18 +0000 (22:22 +0000)]
Auto merge of #52936 - felixrabe:patch-1, r=alexcrichton
Document #39364 – Panic in mpsc::Receiver::recv_timeout
I can still reproduce #39364 with the example code at https://github.com/rust-lang/rust/issues/39364#issuecomment-320637702.
I'm opening this PR in an attempt to document this bug as a known issue in [libstd/sync/mpsc/mod.rs](https://github.com/rust-lang/rust/blob/master/src/libstd/sync/mpsc/mod.rs).
Inputs very much welcome. ([Nightly docs for `recv_timeout`.](https://doc.rust-lang.org/nightly/std/sync/mpsc/struct.Receiver.html?search=#method.recv_timeout))
kennytm [Tue, 14 Aug 2018 15:59:13 +0000 (23:59 +0800)]
Rollup merge of #53257 - faern:ip-method-idiomatic-improvement, r=TimNN
Idiomatic improvements to IP method
Since match ergonomics and slice patterns are stable this might be more idiomatic modern Rust implementations of these methods? Or well, slice patterns with `..` are not stabilized yet, so maybe we want to specify all fields but with `_`?
kennytm [Tue, 14 Aug 2018 15:59:12 +0000 (23:59 +0800)]
Rollup merge of #53246 - ljedrz:cleanup_various, r=kennytm
A few cleanups
- change `skip(1).next()` to `nth(1)`
- collapse some `if-else` expressions
- remove a few explicit `return`s
- remove an unnecessary field name
- dereference once instead of matching on multiple references
- prefer `iter().enumerate()` to indexing with `for`
- remove some unnecessary lifetime annotations
- use `writeln!()` instead of `write!()`+`\n`
- remove redundant parentheses
- shorten some enum variant names
- a few other cleanups suggested by `clippy`
kennytm [Tue, 14 Aug 2018 15:59:11 +0000 (23:59 +0800)]
Rollup merge of #53239 - cuviper:llvm5-closure-alloca, r=eddyb
rustc_codegen_llvm: Restore the closure env alloca hack for LLVM 5.
This hack was removed in #50949, but without it I found that building
`std` with full debuginfo would print many LLVM `DW_OP_LLVM_fragment`
errors, then die `LLVM ERROR: Failed to strip malformed debug info`.
It doesn't seem to be a problem for LLVM 6, so we can re-enable the hack
just for older LLVM.
kennytm [Tue, 14 Aug 2018 15:59:08 +0000 (23:59 +0800)]
Rollup merge of #53229 - varkor:rlimits_min, r=nikomatsakis
Make sure rlimit is only ever increased
`libc::setrlimit` will fail if we try to set the rlimit to a value lower than it is currently, so make sure we're never trying to do this. Fixes #52801.
It seems the way libsyntax handles the desired edition is to use a global, set via `syntax_pos::hygiene::set_default_edition`. Right now, this is set in the driver in `run_compiler`, which is the entry point for running the compiler all the way through to emitting files. Since rustdoc doesn't use this function, it wasn't properly setting this global. (When initially setting up editions in rustdoc, i'd assumed that setting `sessopts.edition` would have done this... `>_>`) This was "fixed" for doctests in https://github.com/rust-lang/rust/pull/52385, but rather than patching in a call to `set_default_edition` in all the places rustdoc sets up the compiler, i've instead moved the call in the driver to be farther in the process. This means that any use of `phase_1_parse_input` with the right session options will have the edition properly set without having to also remember to set libsyntax up separately.
bors [Tue, 14 Aug 2018 15:09:37 +0000 (15:09 +0000)]
Auto merge of #53085 - ljedrz:cleanup_syntax_structures, r=ljedrz
Move SmallVector and ThinVec out of libsyntax
- move `libsyntax::util::SmallVector` tests to `librustc_data_structures::small_vec`
- remove `libsyntax::util::SmallVector`
- move `libsyntax::util::thin_vec` to `librustc_data_structures::thin_vec`
Other than moving these data structures where they belong it allows modules using `SmallVector<T>` (`SmallVec<[T; 1]>`) to specify their own length (e.g. 8 or 32) independently from `libsyntax`.
bors [Tue, 14 Aug 2018 10:41:55 +0000 (10:41 +0000)]
Auto merge of #53335 - eddyb:issue-53333, r=petrochenkov
rustc_resolve: crates only exist in the type namespace.
Fixes #53333 by resolving `::crate_name` in `TypeNS` alone, which was overlooked in #52923 and didn't break tests, since having `use crate_name;` and a `crate_name` value in the same scope is rare.
David Wood [Wed, 8 Aug 2018 11:31:42 +0000 (13:31 +0200)]
Check error-patterns on UI tests. Fixes #52531.
Previously, even if no expected errors were supplied, if a test execution failed
then supplied error patterns would not be checked. This commit modifies the
conditional that determines whether error patterns or expected errors are checked
to remedy this.
Further, this commit modifies the error pattern checking logic so that each pattern
is checked against all lines of the string. This is required for UI tests as the
stderr is in JSON format - all on one line - so in the previous implementation when the
first pattern was found on the first line (which was actually the entire error) then
no other patterns would be found on subsequent lines (as there weren't any).
bors [Tue, 14 Aug 2018 08:32:59 +0000 (08:32 +0000)]
Auto merge of #53033 - RalfJung:manually_dro, r=SimonSapin
unsized ManuallyDrop
I think this matches what @eddyb had in https://github.com/rust-lang/rust/pull/52711 originally.
~~However, I have never added a `CoerceUnsized` before so I am not sure if I did this right. I copied the `unstable` attribute on the `impl` from elsewhere, but AFAIK it is useless because `impl`'s are insta-stable... so shouldn't this rather say "stable since 1.30"?~~
This is insta-stable and hence requires FCP, at least.
bors [Tue, 14 Aug 2018 04:22:14 +0000 (04:22 +0000)]
Auto merge of #52923 - eddyb:relative-imports, r=petrochenkov
#[feature(uniform_paths)]: allow `use x::y;` to resolve through `self::x`, not just `::x`.
_Branch originally by @cramertj, based on @petrochenkov's [description on the internals forum](https://internals.rust-lang.org/t/relative-paths-in-rust-2018/7883/30?u=petrochenkov)._
_(note, however, that the approach has significantly changed since)_
Implements `#[feature(uniform_paths)]` from #53130, by treating unqualified `use` paths as maybe-relative. That is, `use x::y;`, where `x` is a plain identifier (not a keyword), is no longer the same as `use ::x::y;`, and before picking an external crate named `x`, it first looks for an item named `x` in the same module (i.e. `self::x`) and prefers that local item instead.
Such a "maybe-relative" `x` can only resolve to an external crate if it's listed in "`extern_prelude`" (i.e. `core` / `std` and all the crates passed to `--extern`; the latter includes Cargo dependencies) - this is the same condition as being able to refer to the external crate from an unqualified, non-`use` path.
All other crates must be explicitly imported with an absolute path, e.g. `use ::x::y;`
To detect an ambiguity between the external crate and the local item with the same name, a "canary" import (e.g. `use self::x as _;`), tagged with the `is_uniform_paths_canary` flag, is injected. As the initial implementation is not sophisticated enough to handle all possible ways in which `self::x` could appear (e.g. from macro expansion), this also guards against accidentally picking the external crate, when it might actually get "shadowed" later.
Also, more canaries are injected for each block scope around the `use`, as `self::x` cannot resolve to any items named `x` in those scopes, but non-`use` paths can, and that could be confusing or even backwards-incompatible.
Errors are emitted only if the main "canary" import succeeds while an external crate exists (or if any of the block-scoped ones succeed at all), and ambiguities have custom error reporting, e.g.:
```rust
#![feature(uniform_paths)]
pub mod foo {
use std::io;
pub mod std { pub mod io {} }
}
```
```rust
error: import from `std` is ambiguous
--> test.rs:3:9
|
3 | use std::io;
| ^^^ could refer to external crate `::std`
4 | pub mod std { pub mod io {} }
| ----------------------------- could also refer to `self::std`
|
= help: write `::std` or `self::std` explicitly instead
= note: relative `use` paths enabled by `#![feature(uniform_paths)]`
```
Another example, this time with a block-scoped item shadowing a module-scoped one:
```rust
#![feature(uniform_paths)]
enum Foo { A, B }
fn main() {
enum Foo {}
use Foo::*;
}
```
```rust
error: import from `Foo` is ambiguous
--> test.rs:5:9
|
4 | enum Foo {}
| ----------- shadowed by block-scoped `Foo`
5 | use Foo::*;
| ^^^
|
= help: write `::Foo` or `self::Foo` explicitly instead
= note: relative `use` paths enabled by `#![feature(uniform_paths)]`
```
Additionally, this PR, because replacing "the `finalize_import` hack" was a blocker:
* fixes #52140
* fixes #52141
* fixes #52705
bors [Mon, 13 Aug 2018 17:10:04 +0000 (17:10 +0000)]
Auto merge of #53270 - petrochenkov:macuse-regr, r=alexcrichton
Fix a few regressions from enabling macro modularization
The first commit restores the old behavior for some minor unstable stuff (`rustc_*` and `derive_*` attributes) and adds a new feature gate for arbitrary tokens in non-macro attributes.
The second commit fixes https://github.com/rust-lang/rust/issues/53205
The third commit fixes https://github.com/rust-lang/rust/issues/53144.
Same technique is used as for other things blocking expansion progress - if something causes indeterminacy too often, then prohibit it.
In this case referring to crate-local macro-expanded `#[macro_export]` macros via module-relative paths is prohibited, see comments in code for more details.
bors [Mon, 13 Aug 2018 02:28:13 +0000 (02:28 +0000)]
Auto merge of #53051 - varkor:trait-method-pattern-arguments-error, r=petrochenkov
Emit error for pattern arguments in trait methods
The error and check for this already existed, but the parser didn't try to parse trait method arguments as patterns, so the error was never emitted. This surfaces the error, so we get better errors than simple parse errors.
This improves the error message described in https://github.com/rust-lang/rust/issues/53046.
bors [Sun, 12 Aug 2018 21:52:22 +0000 (21:52 +0000)]
Auto merge of #53297 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 15 pull requests
Successful merges:
- #52955 (Update compiler test documentation)
- #53019 (Don't collect() when size_hint is useless)
- #53025 (Consider changing assert! to debug_assert! when it calls visit_with)
- #53059 (Remove explicit returns where unnecessary)
- #53165 ( Add aarch64-unknown-netbsd target)
- #53210 (Deny future duplication of rustc-ap-syntax)
- #53223 (A few cleanups for rustc_data_structures)
- #53230 ([nll] enable feature(nll) on various crates for bootstrap: part 4)
- #53231 (Add let keyword doc)
- #53240 (Add individual documentation for <integer>`.swap_bytes`/.`reverse_bits`)
- #53253 (Remove unwanted console log)
- #53264 (Show that Command can be reused and remodified)
- #53267 (Fix styles)
- #53273 (Add links to std::char::REPLACEMENT_CHARACTER from docs.)
- #53283 (wherein we suggest float for integer literals where a float was expected)
Guillaume Gomez [Sun, 12 Aug 2018 21:27:04 +0000 (23:27 +0200)]
Rollup merge of #53273 - frewsxcv:frewsxcv-ufffd, r=GuillaumeGomez
Add links to std::char::REPLACEMENT_CHARACTER from docs.
There are a few places where we mention the replacement character in the
docs, and it could be helpful for users to utilize the constant which is
available in the standard library, so let’s link to it!
Guillaume Gomez [Sun, 12 Aug 2018 21:27:01 +0000 (23:27 +0200)]
Rollup merge of #53264 - Havvy:patch-3, r=GuillaumeGomez
Show that Command can be reused and remodified
The prior documentation did not make it clear this was possible.
I wanted to make the `list_dir` example work on Windows, but I don't know if passing "/" will error or show the root of the current volume (e.g. `C:`).