Commit Graph

82306 Commits

Author SHA1 Message Date
varkor
49c45734c0 Refactor generic argument count check in astconv 2018-08-19 20:02:34 +01:00
varkor
a14bc713e7 Add Default for GenericParamCount 2018-08-19 20:02:34 +01:00
varkor
7c9f7c2fa3 Args first, then params 2018-08-19 20:02:34 +01:00
varkor
9d3d4b1a19 Refactor lock-step 2018-08-19 20:02:34 +01:00
varkor
6a96cf12c1 Clean match statement 2018-08-19 20:02:34 +01:00
varkor
e79bc410bf Consolidate into create_substs_for_generic_args 2018-08-19 20:02:34 +01:00
varkor
ccef306b96 Revert broken test 2018-08-19 20:02:34 +01:00
varkor
b524991f03 Refactor astconv.rs (part ii) 2018-08-19 20:02:33 +01:00
varkor
5d07db436d Refactor confirm.rs (part ii) 2018-08-19 20:02:33 +01:00
varkor
08d49a65e7 Refactor mod/check (part viii) 2018-08-19 20:02:33 +01:00
varkor
5f2588f020 Fix behaviour in error condition 2018-08-19 20:02:33 +01:00
varkor
db94efab39 Refactor mod/check (part vii) 2018-08-19 20:02:33 +01:00
varkor
9bb40b09b7 Make prohibit_generics take IntoIterators 2018-08-19 20:02:33 +01:00
varkor
9cfe92c8ae "Fix" annoying test 2018-08-19 20:02:33 +01:00
varkor
e02642dbb3 Fix confirm.rs 2018-08-19 20:02:32 +01:00
varkor
340a7fc4f5 Refactor astconv.rs 2018-08-19 20:02:32 +01:00
varkor
35ddd46a2d Refactor confirm.rs 2018-08-19 20:02:32 +01:00
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