Commit graph

176 commits

Author SHA1 Message Date
Yuki Okushi
9a164ff4c5
Skip tests on emscripten 2020-05-08 00:39:02 +09:00
Yuki Okushi
e69748ba4f
Move tests from test/run-fail to UI 2020-05-06 14:02:55 +09:00
Ralf Jung
3a129df39c also run some generator tests without MIR optimizations 2020-04-28 08:22:08 +02:00
bors
36b1a9296c Auto merge of #70015 - jonas-schievink:gen-needs-drop, r=matthewjasper
Make `needs_drop` less pessimistic on generators

Generators only have non-trivial drop logic when they may store (in upvars or across yields) a type that does.

This prevents generation of some unnecessary MIR in simple generators. There might be some impact on compile times, but this is probably limited in real-world applications.

~~This builds off of https://github.com/rust-lang/rust/pull/69814 since that contains some fixes that are made relevant by *this* PR (see https://github.com/rust-lang/rust/pull/69814#issuecomment-599147269).~~ (this has been merged)
2020-04-19 10:01:16 +00:00
Esteban Küber
d9a5419ef4 Add label to item source of bound obligation 2020-04-18 17:19:53 -07:00
Jonas Schievink
50c1c295ee Make needs_drop less pessimistic on generators 2020-04-17 20:30:23 +02:00
Tyler Mandry
4326d959f4 Update test after rebase 2020-04-13 19:14:26 -07:00
Tyler Mandry
df64c5d260 Incorporate feedback into diagnostics 2020-04-13 18:58:17 -07:00
Tyler Mandry
6edfd66c5d Use "generator" instead of "future" when appropriate 2020-04-13 18:48:55 -07:00
Tyler Mandry
7127ff3d94 Don't annotate type when type is opaque 2020-04-13 18:48:55 -07:00
Tyler Mandry
db0a5a1056 Improve span label 2020-04-13 18:48:55 -07:00
Tyler Mandry
a40ec13262 Add test for #68112 (existing output) 2020-04-13 18:48:55 -07:00
Esteban Küber
d605a9d969 Small tweaks to required bound span 2020-04-08 14:40:51 -07:00
Niko Matsakis
fda3378e3f introduce negative_impls feature gate and document
They used to be covered by `optin_builtin_traits` but negative impls
are now applicable to all traits, not just auto traits.

This also adds docs in the unstable book for the current state of auto traits.
2020-03-26 06:52:55 -04:00
Mazdak Farrokhzad
4118ff61ec
Rollup merge of #69837 - jonas-schievink:gen-discr-opt, r=tmandry
Use smaller discriminants for generators

Closes https://github.com/rust-lang/rust/issues/69815

I'm not yet sure about the runtime performance impact of this, so I'll try running this on some benchmarks (if I can find any). (Update: No impact on the benchmarks I've measured on)

* [x] Add test with a generator that has exactly 256 total states
* [x] Add test with a generator that has more than 256 states so that it needs to use a u16 discriminant
* [x] Add tests for the size of `Option<[generator]>`
* [x] Add tests for the `discriminant_value` intrinsic in all cases
2020-03-18 18:03:37 +01:00
Dylan DPC
8f2482b801
Rollup merge of #69867 - ayushmishra2005:doc/61137-add-long-error-code-e0628, r=Dylan-DPC
Add long error explanation for E0628

Add long explanation for the E0628 error code
Part of #61137

r? @GuillaumeGomez
2020-03-16 13:16:42 +01:00
Jonas Schievink
49aabd8a60 Fix rebase fallout 2020-03-14 14:14:50 +01:00
Jonas Schievink
4266807e44 Add a test for generator discriminants 2020-03-14 14:09:48 +01:00
Jonas Schievink
b2779d8596 Use smaller discriminants for generators 2020-03-14 14:09:48 +01:00
bors
5ed3453af9 Auto merge of #69716 - jonas-schievink:generator-size, r=tmandry
Don't store locals in generators that are immediately overwritten with the resume argument

This fixes https://github.com/rust-lang/rust/issues/69672 and makes https://github.com/rust-lang/rust/pull/69033 pass the async fn size tests again (in other words, there will be no size regression of async fn if both this and https://github.com/rust-lang/rust/pull/69033 land).

~~This is a small botch and I'd rather have a more precise analysis, but that seems much harder to pull off, so this special-cases `Yield` terminators that store the resume argument into a simple local (ie. without any field projections) and explicitly marks that local as "not live" in the suspend point of that yield. We know that this local does not need to be stored in the generator for this suspend point because the next resume would immediately overwrite it with the passed-in resume argument anyways. The local might still end up in the state if it is used across another yield.~~ (this now properly updates the dataflow framework to handle this case)
2020-03-14 02:04:49 +00:00
Ayush Kumar Mishra
7b75c346d5 Add long error explanation for E0628 #61137 2020-03-10 02:04:48 +05:30
Yuki Okushi
95d478546f
Add test for issue-64620 2020-03-09 09:12:41 +09:00
Jonas Schievink
b26e27c5f3 Add test for generator sizes with resume arguments 2020-03-06 01:45:45 +01:00
Jonas Schievink
2070ea26e1 Move stray generator test into the generator dir 2020-03-05 23:01:57 +01:00
Jonas Schievink
3b6a5fbece Move formatting to different function
This slims down the generator MIR considerably, which makes debugging
easier
2020-03-04 21:32:57 +01:00
Jonas Schievink
fc2702c96c Add regression test 2020-02-20 00:14:55 +01:00
Esteban Küber
e5b2c66dea Do not ICE when encountering yield inside async block 2020-02-16 18:53:52 -08:00
Esteban Küber
c376fc0017 Account for Pin::new(_) and Pin::new(Box::new(_)) when Box::pin(_) would be applicable 2020-02-12 15:13:05 -08:00
Chris Simpkins
53b16fb5f2 add main function to issue-69017 test 2020-02-10 13:47:52 -05:00
Chris Simpkins
fc3ecb22b9 add issue 69017 test 2020-02-10 12:03:49 -05:00
Jonas Schievink
9d7b214ac6 Ignore panic-drops-resume.rs on wasm/emscripten
It does not have unwinding support
2020-02-06 15:00:36 +01:00
Jonas Schievink
72776e6b5d Remove obsolete test 2020-02-04 13:35:43 +01:00
Jonas Schievink
cc66d29e43 Update error message with too many parameters 2020-02-04 13:35:38 +01:00
Jonas Schievink
341eaf5f55 Add more tests for generator resume arguments 2020-02-04 13:18:29 +01:00
Jonas Schievink
392e59500a Fix miscompilation 2020-02-03 14:08:57 +01:00
Jonas Schievink
9fa46fe153 Teach dropck about resume arguments 2020-02-02 13:20:58 +01:00
Jonas Schievink
4ee857c4c3 Add test for E0628 (too many generator parameters) 2020-02-02 13:20:57 +01:00
Jonas Schievink
fca614eb57 Add tests for generator resume arguments 2020-02-02 13:20:57 +01:00
Jonas Schievink
5b2059b257 Fix error message on type mismatch in generator
Instead of "closure is expected to take 0 arguments"
we now get the expected type mismatch error.
2020-02-02 13:20:57 +01:00
Jonas Schievink
2101a1fec0 Adjust tests to type inference changes
This makes some error messages ungreat, but those seem to be preexisting
bugs that also apply to closures / return position `impl Trait` in
general.
2020-02-02 13:20:57 +01:00
Jonas Schievink
044fe0f558 Add a resume type parameter to Generator 2020-02-02 13:20:57 +01:00
bors
bc4a339064 Auto merge of #68672 - jonas-schievink:dedup-witness, r=Zoxc
Deduplicate types in the generator witness

For the `await-call-tree` benchmark this often reduces the types inside the witness from 12 to 2.
2020-02-02 03:02:41 +00:00
Jonas Schievink
791123d2c4 Deduplicate generator interior types 2020-02-01 20:02:56 +01:00
bors
5371ddf8c6 Auto merge of #68080 - varkor:declared-here, r=petrochenkov
Address inconsistency in using "is" with "declared here"

"is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout.

r? @Centril
2020-01-31 15:13:51 +00:00
varkor
f4f96e2943 Normalise diagnostics with respect to "the X is declared/defined here" 2020-01-24 16:24:49 +00:00
Matthew Jasper
f30a8186f7 Make pointers to statics internal 2020-01-23 21:38:15 +00:00
csmoe
4eb47ded54 wrap expr id into GeneratorInteriorTypeCause 2020-01-15 15:13:51 +08:00
Vadim Petrochenkov
b82cd9f639 Address review comments + Update NLL tests 2020-01-09 21:49:32 +03:00
Vadim Petrochenkov
642669c74d Update tests 2020-01-09 21:23:12 +03:00
Donough Liu
587d03bea8 Yield is an expression form, not a statement. 2019-12-23 21:07:13 +08:00