Commit Graph

82312 Commits

Author SHA1 Message Date
Masaki Hara
9f0168a9f3 Add notes on unsized argument errors. 2018-08-19 08:06:42 +09:00
bors
a9fe312b98 Auto merge of #52592 - eddyb:or-default, r=Mark-Simulacrum
Use the new Entry::or_default method where possible.
2018-08-18 21:58:37 +00:00
bors
33b923fd44 Auto merge of #53324 - alexreg:self_in_typedefs, r=eddyb
`Self` in type definitions (self_in_typedefs)

This implements the [`self_in_typedefs` feature](https://github.com/rust-lang/rfcs/blob/master/text/2300-self-in-typedefs.md) ([tracking issue 49303](https://github.com/rust-lang/rust/issues/49303)).

r? @eddyb

CC @Centril
2018-08-18 19:34:24 +00:00
Alexander Regueiro
4e7d3f5a5e Added page for feature to unstable book. 2018-08-18 18:56:31 +01:00
Alexander Regueiro
7920a65c5f Added tests. 2018-08-18 18:56:31 +01:00
Alexander Regueiro
cbcabcaac8 Added feature gate. 2018-08-18 18:56:29 +01:00
Alexander Regueiro
79009ed728 Updated diagnostics. 2018-08-18 18:54:44 +01:00
Alexander Regueiro
856e84f9a3 Resolve Self within type definitions.
Currently type definitions include `struct`, `enum`, `union`, `existential type`.
2018-08-18 18:54:41 +01:00
Eduard-Mihai Burtescu
14aed81d9a Use the new Entry::or_default method where possible. 2018-08-18 20:19:45 +03:00
bors
f0341412ed Auto merge of #53436 - cuviper:trace_fn-stop, r=alexcrichton
std: stop backtracing when the frames are full

This is a defensive measure to mitigate the infinite unwind loop seen in #53372.  That case will still repeatedly unwind `__rust_try`, but now it will at least stop when `cx.frames` is full.

r? @alexcrichton
2018-08-18 17:15:31 +00:00
bors
a3ad012e2d Auto merge of #53286 - nagisa:cast-assumes, r=eddyb
Do not generate assumes for plain integer casts

I gave up on making anything more elegant for now.

r? @eddyb
2018-08-18 14:35:42 +00:00
bors
7de3dea2b7 Auto merge of #53175 - matthewjasper:more-return-stuff, r=nikomatsakis
[NLL] Returns are interesting for free regions

Based on #53088 - creating now to get feedback.

Closes #51175

* Make assigning to the return type interesting.
* Use "returning this value" instead of "return" in error messages.
* Prefer one of the explanations that we have a name for to a generic interesting cause in some cases.
* Treat causes that involve the destination of a call like assignments.
2018-08-18 11:57:46 +00:00
bors
d5b6b95aef Auto merge of #52553 - Pazzaz:vecdeque-append, r=SimonSapin
Non-naive implementation of `VecDeque.append`

Replaces the old, simple implementation with a more manual (and **unsafe** 😱) one. I've added 1 more test and verified that it covers all 6 code paths in the function.

This new implementation was about 60% faster than the old naive one when I tried benchmarking it.
2018-08-18 08:56:12 +00:00
bors
6b1ff19af3 Auto merge of #53437 - alexcrichton:fix-target-features, r=michaelwoerister
Set more llvm function attributes for __rust_try

This shim is generated elsewhere in the compiler so this commit adds support to
ensure it goes through similar paths as the rest of the compiler to set llvm
function attributes like target features.

cc #53372
2018-08-18 02:50:39 +00:00
bors
4d5ef325e0 Auto merge of #53369 - pnkfelix:partial-53351-make-some-ported-compile-fail-tests-more-robust-wrt-nll, r=davidtwco
Make some ported cfail tests robust w.r.t. NLL

Updated the most glaring instances of weak tests w.r.t. NLL that came from #53196.

See also the bulletpoint list on #53351.
2018-08-17 23:33:31 +00:00
bors
1fa944914c Auto merge of #53356 - michaelwoerister:itlto, r=alexcrichton
Preliminary work for incremental ThinLTO (CGU name edition)

Bring back the first half of #52266 but hopefully without the performance regression.
2018-08-17 21:24:22 +00:00
bors
c8c587fe4e Auto merge of #50911 - petrochenkov:macuse, r=alexcrichton
Stabilize `use_extern_macros`

Closes https://github.com/rust-lang/rust/issues/35896
2018-08-17 19:10:34 +00:00
bors
de21ea8ff5 Auto merge of #53449 - frewsxcv:rollup, r=frewsxcv
Rollup of 11 pull requests

Successful merges:

 - #52858 (Implement Iterator::size_hint for Elaborator.)
 - #53321 (Fix usage of `wasm_target_feature`)
 - #53326 ([nll] add regression test for issue #27868)
 - #53347 (rustc_resolve: don't allow paths starting with `::crate`.)
 - #53349 ([nll] add tests for #48697 and #30104)
 - #53357 (Pretty print btreemap for GDB)
 - #53358 (`{to,from}_{ne,le,be}_bytes` for unsigned integer types)
 - #53406 (Do not suggest conversion method that is already there)
 - #53407 (make more ported compile fail tests more robust w.r.t. NLL)
 - #53413 (Warn that `#![feature(rust_2018_preview)]` is implied when the edition is set to Rust 2018.)
 - #53434 (wasm: Remove --strip-debug argument to LLD)

Failed merges:

r? @ghost
2018-08-17 17:00:10 +00:00
Corey Farwell
f2146667af
Rollup merge of #53434 - alexcrichton:remove-strip-debug, r=yurydelendik
wasm: Remove --strip-debug argument to LLD

Originally added in #52887 this commit disables passing `--strip-debug` to LLD
when optimized. This bring back the original bug of emitting broken debuginfo
but currently it *also* strips the `name` section which makes it very difficult
to inspect the final binary. A real fix is happening at
https://reviews.llvm.org/D50729 and we can reevaluate once we've updated LLD to
have that commit.
2018-08-17 08:23:45 -07:00
Corey Farwell
5c7b837c4e
Rollup merge of #53413 - eddyb:featured-in-the-latest-edition, r=varkor
Warn that `#![feature(rust_2018_preview)]` is implied when the edition is set to Rust 2018.

cc @varkor @petrochenkov @joshtriplett
2018-08-17 08:23:44 -07:00
Corey Farwell
5ad7b914c0
Rollup merge of #53407 - pnkfelix:partial-53351-make-more-ported-compile-fail-tests-more-robust-wrt-nll, r=nikomatsakis
make more ported compile fail tests more robust w.r.t. NLL

This is similar to PR #53369, except it covers a disjoint (and much smaller) set of tests that I needed to look at more carefully before being 100% certain they were the same kind of issue.
2018-08-17 08:23:43 -07:00
Corey Farwell
4cdcb23581
Rollup merge of #53406 - estebank:to_string-to_string, r=michaelwoerister
Do not suggest conversion method that is already there

Fix #53348.
2018-08-17 08:23:42 -07:00
Corey Farwell
f0764433f7
Rollup merge of #53358 - SimonSapin:int-bytes, r=shepmaster
`{to,from}_{ne,le,be}_bytes` for unsigned integer types

Same as https://github.com/rust-lang/rust/pull/51919 did for signed integers.

Tracking issue: https://github.com/rust-lang/rust/issues/52963
2018-08-17 08:23:40 -07:00
Corey Farwell
18122e0db0
Rollup merge of #53357 - fukatani:pretty-print-btreemap, r=michaelwoerister
Pretty print btreemap for GDB

Merge #53112 first, please.
2018-08-17 08:23:39 -07:00
Corey Farwell
25aca443e6
Rollup merge of #53349 - memoryruins:nll-tests, r=nikomatsakis
[nll] add tests for #48697 and #30104

Adds tests for the following issues:
- #48697 ``[NLL] ICE: unexpected region for local data with reference to closure``
- #30104 ``Destructuring boxes into multiple mutable references seems broken``

r? @nikomatsakis
2018-08-17 08:23:38 -07:00
Corey Farwell
3de02d37ea
Rollup merge of #53347 - eddyb:no-crate-in-root, r=petrochenkov
rustc_resolve: don't allow paths starting with `::crate`.

cc @aturon @joshtriplett
r? @petrochenkov
2018-08-17 08:23:36 -07:00
Corey Farwell
9018807862
Rollup merge of #53326 - memoryruins:issue-27868-test, r=nikomatsakis
[nll] add regression test for issue #27868

Adds a test for #27868 ``Inconsistent evaluation order for assignment operations``

apart of #47366 ``tracking issue for bugs fixed by the MIR borrow checker or NLL``

r? @nikomatsakis
2018-08-17 08:23:35 -07:00
Corey Farwell
c3b7483559
Rollup merge of #53321 - alexcrichton:wasm-target-feature, r=nikomatsakis
Fix usage of `wasm_target_feature`

Currently usage results in:

```
error: internal compiler error: librustc_typeck/collect.rs:1928: unknown target feature gate wasm_target_feature

thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:579:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: aborting due to previous error

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.30.0-nightly (d5a448b3f 2018-08-13) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C linker=/tmp/lld-shim -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `coresimd`.

To learn more, run the command again with --verbose.
```

and hopefully this should fix the ICE!
2018-08-17 08:23:34 -07:00
Corey Farwell
2578036f47
Rollup merge of #52858 - frewsxcv:frewsxcv-elaborator, r=SimonSapin
Implement Iterator::size_hint for Elaborator.

None
2018-08-17 08:23:33 -07:00
bors
8dad6be9ad Auto merge of #53288 - RalfJung:dropck, r=nikomatsakis
unions are not always trivially dropable

Fixes #52786

r? @nikomatsakis
2018-08-17 14:16:54 +00:00
Simon Sapin
f5556a6a28 Gratuitous at byte boundaries in hex i32 literals in some doc-tests 2018-08-17 14:01:57 +02:00
bors
8b923a19ed Auto merge of #53190 - sekineh:thumb-cortex-m, r=jamesmunns
Add crate build test for `thumb*` targets. [IRR-2018-embedded]

## Summary

This PR adds `run-make` test that compiles `cortex-m` crate for all supported `thumb*-none-*` targets using `cargo` and stage2 `rustc`.

- Supported `thumb*-none-*` targets:
  - thumbv6m-none-eabi (Bare Cortex-M0, M0+, M1)
  - thumbv7em-none-eabi (Bare Cortex-M4, M7)
  - thumbv7em-none-eabihf (Bare Cortex-M4F, M7F, FPU, hardfloat)
  - thumbv7m-none-eabi (Bare Cortex-M3)

## How to run & Example output
I tested locally and all targets succeeded like below:
```
./x.py clean
./x.py test --target thumbv6m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf,thumbv7m-none-eabi src/test/run-make
```
```
Check compiletest suite=run-make mode=run-make (x86_64-unknown-linux-gnu -> thumbv6m-none-eabi)

running 5 tests
.....
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
```

## How to re-run

Remove `stamp` file for the test run.
```
rm build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-cortex-m/stamp
```
Then run `test`
```
./x.py test --target thumbv6m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf,thumbv7m-none-eabi src/test/run-make
(snip)
running 5 tests
iiii.
test result: ok. 1 passed; 0 failed; 4 ignored; 0 measured; 0 filtered out
```

## Artifacts

You can examine the artifacts under the directory below:
```
sekineh@sekineh-VirtualBox:~/rustme10$ ls -l build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-cortex-m/thumb-none-cortex-m/
total 4
drwxrwxr-x 7 sekineh sekineh 4096  8月 14 22:40 cortex-m
```
where `build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-cortex-m/thumb-none-cortex-m/` is came from TMPDIR variable.

## Other notes

For `test.rs` modification, I used the same logic as:
- d8b3c830fb/src/bootstrap/dist.rs (L652-L657)
```
            if builder.no_std(target) == Some(true) {
                // the `test` doesn't compile for no-std targets
                builder.ensure(compile::Std { compiler, target });
            } else {
                builder.ensure(compile::Test { compiler, target });
            }
```
It is a useful snippet when adding `no_std` support to `src/bootstrap` code.

CC @kennytm @jamesmunns @nerdyvaishali
2018-08-17 10:40:25 +00:00
Vadim Petrochenkov
674a5db1a5 Fix undesirable fallout
compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs - resolution change for derive helper attributes with the same name as derive itself
run-pass/macro-comma-support.rs - indeterminate resolutions for macros in expression positions
ui/issues/issue-49074.rs - diagnostics regression, not enough recovery to report the second error
ui/object-lifetime/object-lifetime-default.stderr - unstable diagnostics?
2018-08-17 13:17:39 +03:00
Vadim Petrochenkov
a0958048b6 Stabilize use_extern_macros 2018-08-17 13:14:26 +03:00
Eduard-Mihai Burtescu
9b1d3c70ac rustc_resolve: don't allow paths starting with ::crate. 2018-08-17 12:59:56 +03:00
bors
d06fa3a46f Auto merge of #53383 - nnethercote:HybridIdxSetBuf, r=nikomatsakis
Speed up NLL with HybridIdxSetBuf.

It's a sparse-when-small but dense-when-large index set that is very
efficient for sets that (a) have few elements, (b) have large
universe_size values, and (c) are cleared frequently. Which makes it
perfect for the `gen_set` and `kill_set` sets used by the new borrow
checker.

This patch reduces `tuple-stress`'s NLL-check time by 40%, and up to 12%
for several other benchmarks. And it halves the max-rss for `keccak`,
and has smaller wins for `inflate` and `clap-rs`.
2018-08-17 07:20:23 +00:00
Ralf Jung
d8f5790262 fix license 2018-08-17 09:17:35 +02:00
Corey Farwell
742ef5864a Implement Iterator::size_hint for Elaborator. 2018-08-16 21:27:08 -07:00
bors
f34933ba0a Auto merge of #53427 - eddyb:uniform-paths-diagnostics, r=varkor
rustc_resolve: overhaul `#![feature(uniform_paths)]` error reporting.

Fixes #53408 by only considering external crates to conflict within their (type/module) namespace, *not* with the value or macro namespaces, and also by adding a special-cased error for redundant `use crate_name;` imports (without actually allowing them).
Also, all canaries for a given import are grouped into one diagnostic per namespace, in order to make block-scoped ambiguities clearer.
See changed/added tests for more details.

r? @petrochenkov cc @aturon @joshtriplett
2018-08-17 00:28:16 +00:00
Eduard-Mihai Burtescu
7a87e30f41 rustc_resolve: overhaul #![feature(uniform_paths)] error reporting. 2018-08-17 01:41:06 +03:00
bors
81ba448f75 Auto merge of #53397 - varkor:feature-collector-expand-visitor, r=nikomatsakis
Visit all attributes for feature collection

Previously feature attributes were just collected on item-like "things" as well as exported macros and crate attributes. This ignored some places feature attributes could be specified, such as on enum variants.

Fixes https://github.com/rust-lang/rust/issues/53391.
2018-08-16 22:11:58 +00:00
Alex Crichton
31884427eb Set more llvm function attributes for __rust_try
This shim is generated elsewhere in the compiler so this commit adds support to
ensure it goes through similar paths as the rest of the compiler to set llvm
function attributes like target features.

cc #53372
2018-08-16 13:23:35 -07:00
Josh Stone
f4e8d57b6a std: stop backtracing when the frames are full 2018-08-16 11:28:42 -07:00
bors
b2028828db Auto merge of #53433 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests

Successful merges:

 - #52946 (Documented impl From on line 367 of libserialize/json.rs)
 - #53234 (Remove Travis shutdown debug scripts, and remove CI-specific DNS settings)
 - #53313 (Two small improvements)
 - #53360 (Addressed #51602)
 - #53364 (Warn if the user tries to use GATs)
 - #53373 (Tweak unclosed delimiter parser error)
 - #53377 (std: Use target_pointer_width for BACKTRACE_ELF_SIZE)
 - #53395 (Use #[non_exhaustive] on internal enums)
 - #53399 (Tidy: ignore non-Markdown files when linting for the Unstable Book)
 - #53412 (syntax_ext: remove leftover span_err_if_not_stage0 macro.)
2018-08-16 17:53:29 +00:00
Alex Crichton
ed39cc074a wasm: Remove --strip-debug argument to LLD
Originally added in #52887 this commit disables passing `--strip-debug` to LLD
when optimized. This bring back the original bug of emitting broken debuginfo
but currently it *also* strips the `name` section which makes it very difficult
to inspect the final binary. A real fix is happening at
https://reviews.llvm.org/D50729 and we can reevaluate once we've updated LLD to
have that commit.
2018-08-16 10:17:06 -07:00
kennytm
a68e61a9f2
Rollup merge of #53234 - kennytm:debug-9696, r=alexcrichton
Remove Travis shutdown debug scripts, and remove CI-specific DNS settings

Since the cause of the host shutdown (travis-ci/travis-ci#4924) is found, we could revert the shutdown debug attempts to shorten the logs.

Additionally, we're pretty sure a custom DNS (added in  will not help travis-ci/travis-ci#9696, so reverting that part of #51420 to reduce CI-specific settings.
2018-08-17 00:54:45 +08:00
kennytm
1cb13b296d
Rollup merge of #53412 - eddyb:stage-who, r=alexcrichton
syntax_ext: remove leftover span_err_if_not_stage0 macro.

I believe this is the right fix for #53380, although I'm not sure what happened.
My guess is this copy of the macro was accidentally missed when others were removed?

cc @matthewjasper @varkor (please do not put this in a rollup, in case it fails)
2018-08-17 00:13:29 +08:00
kennytm
ae3ebf0316
Rollup merge of #53399 - varkor:ignore-non-md-unstable_book, r=nikomatsakis
Tidy: ignore non-Markdown files when linting for the Unstable Book

Previously, any file would be assumed a `.md`, which is annoying when files like `.DS_STORE` slip in and then cause tidy errors.
2018-08-17 00:13:27 +08:00
kennytm
6e98ed9650
Rollup merge of #53395 - varkor:__Nonexhaustive-to-non_exhaustive, r=shepmaster
Use #[non_exhaustive] on internal enums

This replaces `__Nonexhaustive` variants (and variants thereof)  with `#[non_exhaustive]`. These were mostly unstable previously, with the exception of the `cloudabi` enums and `Level` in proc_macro: these were `#[doc(hidden)]`, so clearly intended not to be used directly. It should be safe to replace all of these.
2018-08-17 00:13:26 +08:00
kennytm
0c9e0e33b4
Rollup merge of #53377 - cuviper:pointer-elf_size, r=alexcrichton
std: Use target_pointer_width for BACKTRACE_ELF_SIZE

The former code used `target.contains("64")` to detect Elf64 targets,
but this is inaccurate in a few cases:

- `s390x-unknown-linux-gnu` is 64-bit
- `sparcv9-sun-solaris` is 64-bit
- `x86_64-unknown-linux-gnux32` is 32-bit

Instead the `std` build script can use `CARGO_CFG_TARGET_POINTER_WIDTH`
to reliably detect 64-bit targets for libbacktrace.

Also update to backtrace-sys 0.1.24 for alexcrichton/backtrace-rs#122.
2018-08-17 00:13:25 +08:00