Commit Graph

82289 Commits

Author SHA1 Message Date
varkor
84edc0a089 Move lifetime calculation outside loop 2018-08-19 20:02:32 +01:00
varkor
b6eef180cd Supress consecutive errors 2018-08-19 20:02:32 +01:00
varkor
d8ba103334 Fix param_idx calculation 2018-08-19 20:02:32 +01:00
varkor
d5e24dc121 Fix integer overflow 2018-08-19 20:02:32 +01:00
varkor
734ce4ae1a Fix tidy check 2018-08-19 20:02:32 +01:00
varkor
335770267a Replace generics_require_inlining with generics.requires_monomorphization 2018-08-19 20:02:32 +01:00
varkor
88d5b2f4b4 Refactor mod/check (part vi) 2018-08-19 20:02:32 +01:00
varkor
c9941a8a85 Refactor mod/check (part v) 2018-08-19 20:02:32 +01:00
varkor
e812b55d8f Refactor mod/check (part iv) 2018-08-19 20:02:32 +01:00
varkor
96379e1659 Refactor mod/check (part iii) 2018-08-19 20:02:32 +01:00
varkor
5fe9aeb402 Refactor mod/check (part ii) 2018-08-19 20:02:32 +01:00
varkor
d1a82af235 Refactor mod/check (part i) 2018-08-19 20:02:32 +01:00
varkor
2317abdd01 Fix quadratic loop in confirm.rs 2018-08-19 20:02:32 +01:00
varkor
651215e283 Replace for_each with for 2018-08-19 20:02:32 +01:00
varkor
11adc1300c Address minor comments 2018-08-19 20:02:32 +01:00
bors
bfc3b20663 Auto merge of #53248 - nikomatsakis:nll-trivial-sized-predicate, r=eddyb
skip trivial `Sized` predicates

This came to about a 2% win for me in cargo. Small, but hey.

r? @eddyb
2018-08-19 15:22:18 +00:00
bors
b355906919 Auto merge of #51131 - qnighy:unsized-locals, r=eddyb
Implement Unsized Rvalues

This PR is the first step to implement RFC1909: unsized rvalues (#48055).

## Implemented

- `Sized` is removed for arguments and local bindings. (under `#![feature(unsized_locals)]`)
- Unsized locations are allowed in MIR
- Unsized places and operands are correctly translated at codegen

## Not implemented in this PR

- Additional `Sized` checks:
  - tuple struct constructor (accidentally compiles now)
  - closure arguments at closure generation (accidentally compiles now)
  - upvars (ICEs now)
- Generating vtable for `fn method(self)` (ICEs now)
- VLAs: `[e; n]` where `n` isn't const
- Reduce unnecessary allocations

## Current status

- [x] Fix `__rust_probestack` (rust-lang-nursery/compiler-builtins#244)
  - [x] Get the fix merged
- [x] `#![feature(unsized_locals)]`
  - [x] Give it a tracking issue number
- [x] Lift sized checks in typeck and MIR-borrowck
  - [ ] <del>Forbid `A(unsized-expr)`</del> will be another PR
- [x] Minimum working codegen
- [x] Add more examples and fill in unimplemented codegen paths
- [ ] <del>Loosen object-safety rules (will be another PR)</del>
- [ ] <del>Implement `Box<FnOnce>` (will be another PR)</del>
- [ ] <del>Reduce temporaries (will be another PR)</del>
2018-08-19 12:21:56 +00:00
bors
8928de7439 Auto merge of #52972 - RalfJung:from_raw_parts_align, r=alexcrichton
debug_assert to ensure that from_raw_parts is only used properly aligned

This does not help nearly as much as I would hope because everybody uses the distributed libstd which is compiled without debug assertions. For this reason, I am not sure if this is even worth it. OTOH, this would have caught the misalignment fixed by https://github.com/rust-lang/rust/issues/42789 *if* there had been any tests actually using ZSTs with alignment >1 (we have a CI runner which has debug assertions in libstd enabled), and it seems to currently [fail in the rg testsuite](https://ci.appveyor.com/project/rust-lang/rust/build/1.0.8403/job/v7dfdcgn8ay5j6sb). So maybe it is worth it, after all.

I have seen the attribute `#[rustc_inherit_overflow_checks]` in some places, does that make it so that the *caller's* debug status is relevant? Is there a similar attribute for `debug_assert!`? That could even subsume `rustc_inherit_overflow_checks`: Something like `rustc_inherit_debug_flag` could affect *all* places that change the generated code depending on whether we are in debug or release mode. In fact, given that we have to keep around the MIR for generic functions anyway, is there ever a reason *not* to handle the debug flag that way? I guess currently we apply debug flags like `cfg` so this is dropped early during the MIR pipeline?

EDIT: I learned from @eddyb that because of how `debug_assert!` works, this is not realistic. Well, we could still have it for the rustc CI runs and then maybe, eventually, when libstd gets compiled client-side and there is both a debug and a release build... then this will also benefit users.^^
2018-08-19 09:40:36 +00:00
Masaki Hara
c488d59add Integrate OperandValue::UnsizedRef into OperandValue::Ref. 2018-08-19 08:07:33 +09:00
Masaki Hara
6e15e7c126 Integrate PassMode::UnsizedIndirect into PassMode::Indirect. 2018-08-19 08:07:33 +09:00
Masaki Hara
a0c422a752 Remove a now-unnecessary paragraph.
The paragraph described a case where we can't optimize away repetitive
dynamic stack allocation. However, as arielb1 pointed out, it can
actually optimizable by dynamically delaying the stack unwinding.
2018-08-19 08:07:33 +09:00
Masaki Hara
438edc3d5e Update the unstable book regarding [e; dyn n]. 2018-08-19 08:07:33 +09:00
Masaki Hara
c72e87e30a Add an unstable-book article about unsized_locals. 2018-08-19 08:07:33 +09:00
Masaki Hara
800f2c13a3 Implement simple codegen for unsized rvalues. 2018-08-19 08:07:33 +09:00
Masaki Hara
e2b95cb70e Lift some Sized checks. 2018-08-19 08:07:33 +09:00
Masaki Hara
7f05304068 Add #![feature(unsized_locals)]. 2018-08-19 08:07:33 +09:00
Masaki Hara
cd0476a390 Add Builder::array_alloca. 2018-08-19 08:06:42 +09:00
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