]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoAdded page for feature to unstable book.
Alexander Regueiro [Tue, 14 Aug 2018 20:26:33 +0000 (21:26 +0100)]
Added page for feature to unstable book.

5 years agoAdded tests.
Alexander Regueiro [Wed, 15 Aug 2018 01:24:05 +0000 (02:24 +0100)]
Added tests.

5 years agoAdded feature gate.
Alexander Regueiro [Tue, 14 Aug 2018 17:45:44 +0000 (18:45 +0100)]
Added feature gate.

5 years agoUpdated diagnostics.
Alexander Regueiro [Tue, 14 Aug 2018 17:29:53 +0000 (18:29 +0100)]
Updated diagnostics.

5 years agoResolve `Self` within type definitions.
Alexander Regueiro [Tue, 14 Aug 2018 01:49:06 +0000 (02:49 +0100)]
Resolve `Self` within type definitions.

Currently type definitions include `struct`, `enum`, `union`, `existential type`.

5 years agoAuto merge of #53133 - Zoxc:gen-int, r=eddyb
bors [Wed, 15 Aug 2018 12:02:00 +0000 (12:02 +0000)]
Auto merge of #53133 - Zoxc:gen-int, r=eddyb

Record adjustments and original type for expressions in the generator interior

Fixes https://github.com/rust-lang/rust/issues/50878 and https://github.com/rust-lang/rust/issues/52398.

r? @eddyb

5 years agoAuto merge of #53367 - ehuss:update-cargo, r=alexcrichton
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)

5 years agoAuto merge of #53212 - sunjay:nll-raw-cast, r=nikomatsakis
bors [Wed, 15 Aug 2018 06:54:18 +0000 (06:54 +0000)]
Auto merge of #53212 - sunjay:nll-raw-cast, r=nikomatsakis

NLL - Prevent where clauses from extending the lifetime of bindings

Fixes https://github.com/rust-lang/rust/issues/53123

r? @nikomatsakis

5 years agoUpdate cargo
Eric Huss [Tue, 14 Aug 2018 21:27:26 +0000 (14:27 -0700)]
Update cargo

5 years agoAuto merge of #52716 - tromey:rustup-lldb, r=alexcrichton
bors [Wed, 15 Aug 2018 02:52:08 +0000 (02:52 +0000)]
Auto merge of #52716 - tromey:rustup-lldb, r=alexcrichton

Add lldb to the build

This optionally adds lldb (and clang, which it needs) to the build.

Because rust uses LLVM 7, and because clang 7 is not yet released, a
recent git master version of clang is used.

The lldb that is used includes the Rust plugin.

lldb is only built when asked for, or when doing a nightly build on
macOS.  Only macOS is done for now due to difficulties with the Python
dependency.

5 years agoAdd lldb to the build
Tom Tromey [Tue, 3 Jul 2018 18:24:24 +0000 (12:24 -0600)]
Add lldb to the build

This optionally adds lldb (and clang, which it needs) to the build.

Because rust uses LLVM 7, and because clang 7 is not yet released, a
recent git master version of clang is used.

The lldb that is used includes the Rust plugin.

lldb is only built when asked for, or when doing a nightly build on
macOS.  Only macOS is done for now due to difficulties with the Python
dependency.

5 years agoAuto merge of #52928 - Mark-Simulacrum:borrowck-cleanup, r=cramertj
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.

5 years agoAuto merge of #52936 - felixrabe:patch-1, r=alexcrichton
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))

5 years agoAuto merge of #53361 - Manishearth:clippyup, r=nrc
bors [Tue, 14 Aug 2018 19:38:45 +0000 (19:38 +0000)]
Auto merge of #53361 - Manishearth:clippyup, r=nrc

Update clippy

r? @kennytm @nrc

5 years agoUpdate clippy
Manish Goregaokar [Tue, 14 Aug 2018 18:29:00 +0000 (11:29 -0700)]
Update clippy

5 years agoAuto merge of #53354 - kennytm:rollup, r=kennytm
bors [Tue, 14 Aug 2018 17:24:18 +0000 (17:24 +0000)]
Auto merge of #53354 - kennytm:rollup, r=kennytm

Rollup of 11 pull requests

Successful merges:

 - #53112 (pretty print BTreeSet)
 - #53208 (Don't panic on std::env::vars() when env is null.)
 - #53226 (driver: set the syntax edition in phase 1)
 - #53229 (Make sure rlimit is only ever increased)
 - #53233 (targets: aarch64: Add bare-metal aarch64 target)
 - #53239 (rustc_codegen_llvm: Restore the closure env alloca hack for LLVM 5.)
 - #53246 (A few cleanups)
 - #53257 (Idiomatic improvements to IP method)
 - #53274 (Remove statics field from CodegenCx)
 - #53290 (Make LLVM emit assembly comments with -Z asm-comments)
 - #53317 (Mark prior failure to avoid ICE)

5 years agoRollup merge of #53317 - estebank:abolish-ice, r=oli-obk
kennytm [Tue, 14 Aug 2018 15:59:17 +0000 (23:59 +0800)]
Rollup merge of #53317 - estebank:abolish-ice, r=oli-obk

Mark prior failure to avoid ICE

Fix #53251

5 years agoRollup merge of #53290 - whitequark:fix-35741, r=nagisa
kennytm [Tue, 14 Aug 2018 15:59:16 +0000 (23:59 +0800)]
Rollup merge of #53290 - whitequark:fix-35741, r=nagisa

Make LLVM emit assembly comments with -Z asm-comments

Fixes #35741, and makes `-Z asm-comments` actually do something useful.

Before:
```
.section .text.main,"ax",@progbits
.globl main
.p2align 4, 0x90
.type main,@function
main:
.cfi_startproc
pushq %rax
.cfi_def_cfa_offset 16
movslq %edi, %rax
leaq _ZN1t4main17he95a7d4f1843730eE(%rip), %rdi
movq %rsi, (%rsp)
movq %rax, %rsi
movq (%rsp), %rdx
callq _ZN3std2rt10lang_start17h3121da83b2bc3697E
movl %eax, %ecx
movl %ecx, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end8:
.size main, .Lfunc_end8-main
.cfi_endproc
```

After:
```
.section .text.main,"ax",@progbits
.globl main                    # -- Begin function main
.p2align 4, 0x90
.type main,@function
main:                                   # @main
.cfi_startproc
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
movslq %edi, %rax
leaq _ZN1t4main17he95a7d4f1843730eE(%rip), %rdi
movq %rsi, (%rsp)            # 8-byte Spill
movq %rax, %rsi
movq (%rsp), %rdx            # 8-byte Reload
callq _ZN3std2rt10lang_start17h3121da83b2bc3697E
movl %eax, %ecx
movl %ecx, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end8:
.size main, .Lfunc_end8-main
.cfi_endproc
                                        # -- End function
```

5 years agoRollup merge of #53274 - bjorn3:remove_statics_field, r=nagisa
kennytm [Tue, 14 Aug 2018 15:59:15 +0000 (23:59 +0800)]
Rollup merge of #53274 - bjorn3:remove_statics_field, r=nagisa

Remove statics field from CodegenCx

It doesnt seem to be used anywhere.

5 years agoRollup merge of #53257 - faern:ip-method-idiomatic-improvement, r=TimNN
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 `_`?

5 years agoRollup merge of #53246 - ljedrz:cleanup_various, r=kennytm
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`

5 years agoRollup merge of #53239 - cuviper:llvm5-closure-alloca, r=eddyb
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.

This reverts commit da579ef75e4a8ca11fb98b24a0a3ea0c7ccffeeb.
Fixes #53204.
r? @eddyb

5 years agoRollup merge of #53233 - andre-richter:master, r=alexcrichton
kennytm [Tue, 14 Aug 2018 15:59:09 +0000 (23:59 +0800)]
Rollup merge of #53233 - andre-richter:master, r=alexcrichton

targets: aarch64: Add bare-metal aarch64 target

A generic AArch64 target that can be used for writing bare-metal code
for 64-bit ARM architectures.

5 years agoRollup merge of #53229 - varkor:rlimits_min, r=nikomatsakis
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.

5 years agoRollup merge of #53226 - QuietMisdreavus:editions-for-all, r=estebank
kennytm [Tue, 14 Aug 2018 15:59:07 +0000 (23:59 +0800)]
Rollup merge of #53226 - QuietMisdreavus:editions-for-all, r=estebank

driver: set the syntax edition in phase 1

Fixes https://github.com/rust-lang/rust/issues/53203

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.

r? @rust-lang/compiler

5 years agoRollup merge of #53208 - BurntPizza:protect-the-environment, r=alexcrichton
kennytm [Tue, 14 Aug 2018 15:59:05 +0000 (23:59 +0800)]
Rollup merge of #53208 - BurntPizza:protect-the-environment, r=alexcrichton

Don't panic on std::env::vars() when env is null.

Fixes #53200.

Reviewer(s):
* Do I need to do any `#[cfg()]` here?
* Is this use of libc ok for a dev-dependency?

5 years agoRollup merge of #53112 - fukatani:pretty-print-btreeset, r=michaelwoerister
kennytm [Tue, 14 Aug 2018 15:59:04 +0000 (23:59 +0800)]
Rollup merge of #53112 - fukatani:pretty-print-btreeset, r=michaelwoerister

pretty print BTreeSet

I want pretty printing for BTreeSet.
```rust
use std::collections::*;

fn main() {
  let mut s = BTreeSet::new();
  s.insert(5);
  s.insert(3);
  s.insert(7);
  s.remove(&3);
  println!("{:?}", s);
}
```

```
(gdb) b 9
(gdb) p s
$1 = BTreeSet<i32> with 2 elements = {[0] = 5, [1] = 7}
```
This is analogy of pretty printing for C++ std::set.

5 years agoAuto merge of #53085 - ljedrz:cleanup_syntax_structures, r=ljedrz
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`.

5 years agoAuto merge of #53196 - davidtwco:compile-fail-to-ui, r=nikomatsakis
bors [Tue, 14 Aug 2018 12:55:23 +0000 (12:55 +0000)]
Auto merge of #53196 - davidtwco:compile-fail-to-ui, r=nikomatsakis

Move `compile-fail` tests to `ui`

Fixes #46841, #52531, #44844.

r? @nikomatsakis

5 years agoAuto merge of #53335 - eddyb:issue-53333, r=petrochenkov
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.

5 years agoMoved problematic tests on x86_64-gnu-nopt back to compile-fail.
David Wood [Tue, 14 Aug 2018 09:11:58 +0000 (11:11 +0200)]
Moved problematic tests on x86_64-gnu-nopt back to compile-fail.

5 years agoMoved problematic tests on x86_64-pc-windows-gnu back to compile-fail.
David Wood [Mon, 13 Aug 2018 22:38:05 +0000 (00:38 +0200)]
Moved problematic tests on x86_64-pc-windows-gnu back to compile-fail.

5 years agoMoved problematic tests on armhf-gnu back to compile-fail.
David Wood [Mon, 13 Aug 2018 17:23:51 +0000 (19:23 +0200)]
Moved problematic tests on armhf-gnu back to compile-fail.

5 years agoMoved problematic tests on wasm32-unknown back to compile-fail.
David Wood [Mon, 13 Aug 2018 15:12:20 +0000 (17:12 +0200)]
Moved problematic tests on wasm32-unknown back to compile-fail.

5 years agoMoved problematic tests on dist-x86_64-musl back to compile-fail.
David Wood [Mon, 13 Aug 2018 09:56:01 +0000 (11:56 +0200)]
Moved problematic tests on dist-x86_64-musl back to compile-fail.

5 years agoMoved problematic tests on i586-unknown-linux-gnu back to compile-fail.
David Wood [Fri, 10 Aug 2018 23:51:17 +0000 (01:51 +0200)]
Moved problematic tests on i586-unknown-linux-gnu back to compile-fail.

5 years agoNormalize tests for i686 Windows.
David Wood [Fri, 10 Aug 2018 21:46:59 +0000 (22:46 +0100)]
Normalize tests for i686 Windows.

5 years agoFixed 'no such file or directory' mismatch between Windows and Linux.
David Wood [Fri, 10 Aug 2018 10:27:46 +0000 (12:27 +0200)]
Fixed 'no such file or directory' mismatch between Windows and Linux.

5 years agoMoved problematic tests on Windows back to compile-fail.
David Wood [Fri, 10 Aug 2018 10:17:49 +0000 (12:17 +0200)]
Moved problematic tests on Windows back to compile-fail.

5 years agoMoved tests back to compile-test if they don't work on ui.
David Wood [Thu, 9 Aug 2018 16:11:35 +0000 (18:11 +0200)]
Moved tests back to compile-test if they don't work on ui.

5 years agoFix no-link-with-link-args by introducing another normalization.
David Wood [Thu, 9 Aug 2018 15:17:20 +0000 (17:17 +0200)]
Fix no-link-with-link-args by introducing another normalization.

5 years agoNormalize crateresolve1.rs to support different candidate ordering between executions.
David Wood [Thu, 9 Aug 2018 14:19:11 +0000 (16:19 +0200)]
Normalize crateresolve1.rs to support different candidate ordering between executions.

5 years agoSuggested trait implementation ordering is now deterministic.
David Wood [Thu, 9 Aug 2018 12:37:27 +0000 (14:37 +0200)]
Suggested trait implementation ordering is now deterministic.

5 years agoFixed truncated path not being normalized.
David Wood [Thu, 9 Aug 2018 10:48:31 +0000 (12:48 +0200)]
Fixed truncated path not being normalized.

5 years agoNormalize test build directory and root build directory.
David Wood [Thu, 9 Aug 2018 08:58:16 +0000 (10:58 +0200)]
Normalize test build directory and root build directory.

5 years agoTidy no longer fails when there are no files or subdirectories in a test directory.
David Wood [Wed, 8 Aug 2018 19:37:58 +0000 (21:37 +0200)]
Tidy no longer fails when there are no files or subdirectories in a test directory.

5 years agoMerged migrated compile-fail tests and ui tests. Fixes #46841.
David Wood [Wed, 8 Aug 2018 12:50:16 +0000 (14:50 +0200)]
Merged migrated compile-fail tests and ui tests. Fixes #46841.

5 years agoUpdated new UI tests to pass with NLL compare-mode
David Wood [Wed, 8 Aug 2018 16:01:04 +0000 (18:01 +0200)]
Updated new UI tests to pass with NLL compare-mode

These tests need a review to ensure that those marked as
ignore-compare-mode-nll should be ignored and that this isn't a bug in NLL.

5 years agoMoved compile-fail tests to ui tests.
David Wood [Wed, 8 Aug 2018 12:28:26 +0000 (14:28 +0200)]
Moved compile-fail tests to ui tests.

5 years agoCheck error-patterns on UI tests. Fixes #52531.
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).

5 years agoAuto merge of #53033 - RalfJung:manually_dro, r=SimonSapin
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.

Fixes https://github.com/rust-lang/rust/issues/47034

5 years agorustc_resolve: crates only exist in the type namespace.
Eduard-Mihai Burtescu [Tue, 14 Aug 2018 08:26:44 +0000 (11:26 +0300)]
rustc_resolve: crates only exist in the type namespace.

5 years agoAuto merge of #52895 - draganmladjenovic:minmax_qnan, r=alexcrichton
bors [Tue, 14 Aug 2018 06:31:10 +0000 (06:31 +0000)]
Auto merge of #52895 - draganmladjenovic:minmax_qnan, r=alexcrichton

run-pass/simd-intrinsic-float-minmax: Force use of qNaN on Mips

Workaround for #52746.
r? @gnzlbg

5 years agoAuto merge of #52923 - eddyb:relative-imports, r=petrochenkov
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

cc @aturon @joshtriplett

5 years agorustc_resolve: also inject canaries to detect block scopes shadowing `uniform_paths...
Eduard-Mihai Burtescu [Mon, 13 Aug 2018 15:24:08 +0000 (18:24 +0300)]
rustc_resolve: also inject canaries to detect block scopes shadowing `uniform_paths` imports.

5 years agorustc_resolve: inject ambiguity "canaries" when #![feature(uniform_paths)] is enabled.
Eduard-Mihai Burtescu [Sat, 11 Aug 2018 08:13:57 +0000 (11:13 +0300)]
rustc_resolve: inject ambiguity "canaries" when #![feature(uniform_paths)] is enabled.

5 years ago#[feature(uniform_paths)]: allow `use x::y;` to resolve through `self::x`, not just...
Taylor Cramer [Fri, 13 Jul 2018 19:38:49 +0000 (12:38 -0700)]
#[feature(uniform_paths)]: allow `use x::y;` to resolve through `self::x`, not just `::x`.

5 years agorustc_resolve: fix special-case for one-segment import paths.
Eduard-Mihai Burtescu [Thu, 9 Aug 2018 13:29:22 +0000 (16:29 +0300)]
rustc_resolve: fix special-case for one-segment import paths.

5 years agosyntax: gensym the injected std/core extern crates in the Rust 2018 edition.
Eduard-Mihai Burtescu [Fri, 10 Aug 2018 13:01:32 +0000 (16:01 +0300)]
syntax: gensym the injected std/core extern crates in the Rust 2018 edition.

5 years agoMark prior failure to avoid ICE
Esteban Küber [Mon, 13 Aug 2018 22:28:18 +0000 (15:28 -0700)]
Mark prior failure to avoid ICE

Fix #53251

5 years agosyntax: add `uniform_paths` feature-gate.
Eduard-Mihai Burtescu [Thu, 9 Aug 2018 20:50:04 +0000 (23:50 +0300)]
syntax: add `uniform_paths` feature-gate.

5 years agoMove SmallVec and ThinVec out of libsyntax
ljedrz [Sun, 5 Aug 2018 10:04:56 +0000 (12:04 +0200)]
Move SmallVec and ThinVec out of libsyntax

5 years agoAuto merge of #53270 - petrochenkov:macuse-regr, r=alexcrichton
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.

cc https://github.com/rust-lang/rust/pull/50911

5 years agofix behavior
Unknown [Mon, 13 Aug 2018 14:01:48 +0000 (23:01 +0900)]
fix behavior

5 years agoAuto merge of #53161 - michaelwoerister:cstrings, r=wesleywiser
bors [Mon, 13 Aug 2018 11:19:07 +0000 (11:19 +0000)]
Auto merge of #53161 - michaelwoerister:cstrings, r=wesleywiser

Avoid many allocations for CStrings during codegen.

Giving in to my irrational fear of dynamic allocations. Let's see what perf says to this.

5 years agobug fix
Unknown [Mon, 13 Aug 2018 08:30:09 +0000 (17:30 +0900)]
bug fix

5 years agoAuto merge of #53238 - nrc:update, r=kennytm
bors [Mon, 13 Aug 2018 06:42:15 +0000 (06:42 +0000)]
Auto merge of #53238 - nrc:update, r=kennytm

Update RLS

Should fix RLS toolstate

5 years agoAuto merge of #53051 - varkor:trait-method-pattern-arguments-error, r=petrochenkov
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.

r? @petrochenkov

5 years agoAuto merge of #53297 - GuillaumeGomez:rollup, r=GuillaumeGomez
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)

Failed merges:

r? @ghost

5 years agoRollup merge of #53283 - zackmdavis:and_the_case_of_the_flotation_device, r=estebank
Guillaume Gomez [Sun, 12 Aug 2018 21:27:05 +0000 (23:27 +0200)]
Rollup merge of #53283 - zackmdavis:and_the_case_of_the_flotation_device, r=estebank

wherein we suggest float for integer literals where a float was expected

@sunjay pointed out that this is a nice thing that we could do.

Resolves #53280.

r? @estebank

5 years agoRollup merge of #53273 - frewsxcv:frewsxcv-ufffd, r=GuillaumeGomez
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!

5 years agoRollup merge of #53267 - GuillaumeGomez:fix-styles, r=QuietMisdreavus
Guillaume Gomez [Sun, 12 Aug 2018 21:27:02 +0000 (23:27 +0200)]
Rollup merge of #53267 - GuillaumeGomez:fix-styles, r=QuietMisdreavus

Fix styles

Fixes #53262.

r? @QuietMisdreavus

5 years agoRollup merge of #53264 - Havvy:patch-3, r=GuillaumeGomez
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:`).

r? @GuillaumeGomez

5 years agoRollup merge of #53253 - GuillaumeGomez:remove-console, r=kennytm
Guillaume Gomez [Sun, 12 Aug 2018 21:26:59 +0000 (23:26 +0200)]
Rollup merge of #53253 - GuillaumeGomez:remove-console, r=kennytm

Remove unwanted console log

Forgot to remove a `console.log`, now it's fixed.

r? @QuietMisdreavus

5 years agoRollup merge of #53240 - llogiq:doc-num-swap-reverse, r=joshtriplett
Guillaume Gomez [Sun, 12 Aug 2018 21:26:58 +0000 (23:26 +0200)]
Rollup merge of #53240 - llogiq:doc-num-swap-reverse, r=joshtriplett

Add individual documentation for <integer>`.swap_bytes`/.`reverse_bits`

5 years agoRollup merge of #53231 - GuillaumeGomez:let-keyword, r=QuietMisdreavus
Guillaume Gomez [Sun, 12 Aug 2018 21:26:57 +0000 (23:26 +0200)]
Rollup merge of #53231 - GuillaumeGomez:let-keyword, r=QuietMisdreavus

Add let keyword doc

Part of #34601.

r? @rust-lang/docs

5 years agoRollup merge of #53230 - memoryruins:nll_bootstrap_4, r=nikomatsakis
Guillaume Gomez [Sun, 12 Aug 2018 21:26:56 +0000 (23:26 +0200)]
Rollup merge of #53230 - memoryruins:nll_bootstrap_4, r=nikomatsakis

[nll] enable feature(nll) on various crates for bootstrap: part 4

#53172

r? @nikomatsakis

5 years agoRollup merge of #53223 - ljedrz:cleanup_data_structures, r=oli-obk
Guillaume Gomez [Sun, 12 Aug 2018 21:26:55 +0000 (23:26 +0200)]
Rollup merge of #53223 - ljedrz:cleanup_data_structures, r=oli-obk

A few cleanups for rustc_data_structures

- remove a redundant `clone()`
- make some calls to `.iter()` implicit
- collapse/simplify a few operations
- remove some explicit `return`s
- make `SnapshotMap::{commit, rollback_to}` take references
- remove unnecessary struct field names
- change `transmute()`s in `IdxSet::{from_slice, from_slice_mut}` to casts
- remove some unnecessary lifetime annotations
- split 2 long literals

5 years agoRollup merge of #53210 - alexcrichton:deny-rustc-syntax, r=nrc
Guillaume Gomez [Sun, 12 Aug 2018 21:26:54 +0000 (23:26 +0200)]
Rollup merge of #53210 - alexcrichton:deny-rustc-syntax, r=nrc

Deny future duplication of rustc-ap-syntax

Enable the tidy check to forbid this!

Closes #53006

5 years agoRollup merge of #53165 - jakllsch:netbsd-ad22a005-b917-47f3-8156-f717d36f6bbe, r...
Guillaume Gomez [Sun, 12 Aug 2018 21:26:52 +0000 (23:26 +0200)]
Rollup merge of #53165 - jakllsch:netbsd-ad22a005-b917-47f3-8156-f717d36f6bbe, r=estebank

 Add aarch64-unknown-netbsd target

Depends on #53116.

5 years agoRollup merge of #53059 - ljedrz:unneeded_returns, r=kennytm
Guillaume Gomez [Sun, 12 Aug 2018 21:26:51 +0000 (23:26 +0200)]
Rollup merge of #53059 - ljedrz:unneeded_returns, r=kennytm

Remove explicit returns where unnecessary

5 years agoRollup merge of #53025 - ljedrz:debug_asserts_limited, r=varkor
Guillaume Gomez [Sun, 12 Aug 2018 21:26:50 +0000 (23:26 +0200)]
Rollup merge of #53025 - ljedrz:debug_asserts_limited, r=varkor

Consider changing assert! to debug_assert! when it calls visit_with

The perf run from #52956 revealed that there were 3 benchmarks that benefited most from changing `assert!`s to `debug_assert!`s:

- issue #46449: avg -4.7% for -check
- deeply-nested (AKA #38528): avg -3.4% for -check
- regression #31157: avg -3.2% for -check

I analyzed their fixing PRs and decided to look for potentially heavy assertions in the files they modified. I noticed that all of the non-trivial ones contained indirect calls to `visit_with()`.

It might be a good idea to consider changing `assert!` to `debug_assert!` in those places in order to get the performance wins shown by the benchmarks.

5 years agoRollup merge of #53019 - ljedrz:bad_collects, r=estebank
Guillaume Gomez [Sun, 12 Aug 2018 21:26:49 +0000 (23:26 +0200)]
Rollup merge of #53019 - ljedrz:bad_collects, r=estebank

Don't collect() when size_hint is useless

This adjusts PRs #52738 and #52697 by falling back to calculating capacity and extending or pushing in a loop where `collect()` can't be trusted to calculate the right capacity.

It is a performance win.

5 years agoRollup merge of #52955 - tromey:compiler-test-docs, r=nikomatsakis
Guillaume Gomez [Sun, 12 Aug 2018 21:26:48 +0000 (23:26 +0200)]
Rollup merge of #52955 - tromey:compiler-test-docs, r=nikomatsakis

Update compiler test documentation

Update the compiler test documentation to document ignore-gdb-version
and min-system-llvm-version; and expand the min-gdb-version,
min-lldb-version, and min-llvm-version documentation a little.

5 years agoProhibit using macro-expanded `macro_export` macros through module-relative paths
Vadim Petrochenkov [Sat, 11 Aug 2018 11:33:43 +0000 (14:33 +0300)]
Prohibit using macro-expanded `macro_export` macros through module-relative paths

5 years agoMake LLVM emit assembly comments with -Z asm-comments.
whitequark [Sun, 12 Aug 2018 17:59:18 +0000 (17:59 +0000)]
Make LLVM emit assembly comments with -Z asm-comments.

Fixes #35741.

5 years agowherein we suggest float for integer literals where a float was expected
Zack M. Davis [Sun, 12 Aug 2018 05:54:57 +0000 (22:54 -0700)]
wherein we suggest float for integer literals where a float was expected

Sunjay Varma pointed out that this is a nice thing that we could do.

Resolves #53280.

5 years agoClean up and add extra tests
varkor [Sat, 11 Aug 2018 20:25:48 +0000 (21:25 +0100)]
Clean up and add extra tests

5 years agoAdd E0642 to parser error
varkor [Fri, 10 Aug 2018 00:49:45 +0000 (01:49 +0100)]
Add E0642 to parser error

5 years agoEmit an error during parsing
varkor [Thu, 9 Aug 2018 22:23:08 +0000 (23:23 +0100)]
Emit an error during parsing

5 years agoImprove diagnostics
varkor [Mon, 6 Aug 2018 23:03:26 +0000 (00:03 +0100)]
Improve diagnostics

5 years agoFix handling of trait methods with bodies and improve efficiency
varkor [Mon, 6 Aug 2018 17:14:57 +0000 (18:14 +0100)]
Fix handling of trait methods with bodies and improve efficiency

5 years agoSuggest replacing patterns with underscores
varkor [Sat, 4 Aug 2018 10:48:33 +0000 (11:48 +0100)]
Suggest replacing patterns with underscores

5 years agoEmit error for pattern arguments in trait methods
varkor [Sat, 4 Aug 2018 01:23:21 +0000 (02:23 +0100)]
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.

5 years agoFix indent
Havvy (Ryan Scheel) [Sat, 11 Aug 2018 20:02:49 +0000 (13:02 -0700)]
Fix indent

5 years agoAdd links to std::char::REPLACEMENT_CHARACTER from docs.
Corey Farwell [Sat, 11 Aug 2018 18:09:59 +0000 (14:09 -0400)]
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!

5 years agoA few cleanups for fmt_macros, graphviz, apfloat, target, serialize and term
ljedrz [Fri, 10 Aug 2018 11:13:50 +0000 (13:13 +0200)]
A few cleanups for fmt_macros, graphviz, apfloat, target, serialize and term

5 years agoAdd let keyword doc
Guillaume Gomez [Sat, 11 Aug 2018 15:02:31 +0000 (17:02 +0200)]
Add let keyword doc

5 years agoRemove statics field from CodegenCx
bjorn3 [Sat, 11 Aug 2018 16:54:36 +0000 (18:54 +0200)]
Remove statics field from CodegenCx

5 years agoDo not consider built-in attributes as candidates when resolving non-attribute macro...
Vadim Petrochenkov [Sat, 11 Aug 2018 13:58:28 +0000 (16:58 +0300)]
Do not consider built-in attributes as candidates when resolving non-attribute macro invocations

This is needed to avoid regressions on stable channel