about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2020-05-24Rollup merge of #72388 - Aaron1011:fix/deep-tokenstream-equality, r=petrochenkovRalf Jung-0/+30
Recursively expand `TokenKind::Interpolated` in `probably_equal_for_proc_macro` Fixes #68430 When comparing the captured and re-parsed `TokenStream` for a `TokenKind::Interpolated`, we currently treat any nested `TokenKind::Interpolated` tokens as unequal. If a `TokenKind::Interpolated` token shows up in the captured `TokenStream` due to a `macro_rules!` expansion, we will throw away the captured `TokenStream`, losing span information. This PR recursively invokes `nt_to_tokenstream` on nested `TokenKind::Interpolated` tokens, effectively flattening the stream into a sequence of non-interpolated tokens. This allows it to compare equal with the re-parsed stream, allowing us to keep the original captured `TokenStream` (with span information). This requires all of the `probably_equal_for_proc_macro` methods to be moved from `librustc_ast` to `librustc_parse` so that they can call `nt_to_tokenstream`.
2020-05-24Added comment about static variablesMichal Sudwoj-0/+1
2020-05-24Fixed testsMichal Sudwoj-69/+61
2020-05-24Minor fixes, as requested in PR reviewMichal Sudwoj-22/+53
2020-05-24NVPTX support for new asm!Michal Sudwoj-0/+109
2020-05-24Auto merge of #72362 - matthewjasper:remove-rescope, r=nikomatsakisbors-883/+462
Remove ReScope `ReScope` is unnecessary now that AST borrowck is gone and we're erasing the results of region inference in function bodies. This removes about as much of the old regionck code as possible without having to enable NLL fully. cc #68261 r? @nikomatsakis
2020-05-24Clear MIR local type annotations after borrowckJonas Schievink-17/+17
2020-05-24Properly handle InlineAsmOperand::SymFn when collecting monomorphized itemsAmanieu d'Antras-0/+38
Fixes #72484
2020-05-24Rollup merge of #72502 - RalfJung:generator-discr-ty, r=jonas-schievinkDylan DPC-2/+2
fix discriminant type in generator transform The generator transform assumed that the discriminant type is always `isize`, which is not correct, leading to [ICEs in Miri](https://github.com/rust-lang/rust/pull/72419/files#r429543536) when some extra sanity checking got enabled. r? @jonas-schievink @eddyb
2020-05-24Rollup merge of #72400 - Aaron1011:fix/asm-incr-ice, r=AmanieuDylan DPC-0/+22
Add missing ASM arena declarations to librustc_middle Fixes #72386 These types also need to get allocated on the `librustc_middle` arena when we deserialize MIR. @Amanieu: If we end up using your approach in https://github.com/rust-lang/rust/pull/72392 instead, feel free to copy the test I added over to your PR.
2020-05-24Rollup merge of #71618 - ecstatic-morse:issue-71394, r=nikomatsakisDylan DPC-1/+16
Preserve substitutions when making trait obligations for suggestions Resolves #71394. I *think* `map_bound_ref` is correct here. In any case, I think a lot of the diagnostic code is using `skip_binder` more aggressively than it should be, so I doubt that this is worse than the status quo. The assertion that `new_self_ty` has no escaping bound vars should be enough. r? @estebank cc @nikomatsakis Is the call to `skip_binder` on line 551 (and elsewhere in this file) appropriate? https://github.com/rust-lang/rust/blob/46ec74e60f238f694b46c976d6217e7cf8d4cf1a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs#L537-L565
2020-05-23Add missing ASM arena declaration to librustc_middleAaron Hill-0/+22
Fixes #72386 This type also needs to get allocated on the `librustc_middle` arena when we deserialize MIR.
2020-05-23Remove out-of-date commentNadrieril-1/+0
2020-05-23Work around type normalization issuesNadrieril-0/+23
2020-05-23Rollup merge of #72492 - JohnTitor:add-tests, r=matthewjasperDylan DPC-16/+46
Add some regression tests Closes #69415 Closes #72455 r? @matthewjasper
2020-05-23bless mir-opt testsRalf Jung-2/+2
2020-05-23Add test for #72455Yuki Okushi-0/+27
2020-05-23Add test for #69415Yuki Okushi-16/+19
2020-05-23Merge spans for the suggestionStanislav Tkach-13/+13
2020-05-22Bless other example of #71394Dylan MacKenzie-1/+0
2020-05-22Add regression test for #71394Dylan MacKenzie-0/+16
2020-05-22Rollup merge of #71289 - xliiv:70802-intra-self, r=GuillaumeGomezDylan DPC-0/+88
Allow using `Self::` in doc Closes #70802
2020-05-22Add test for macro_rules! invoking a proc-macro with capture groupsAaron Hill-0/+30
2020-05-22Update testsMatthew Jasper-883/+462
2020-05-22Rollup merge of #72123 - jsgf:stabilize-arg0, r=sfacklerRalf Jung-4/+0
Stabilize process_set_argv0 feature for Unix This stabilizes process_set_argv0 targeting 1.45.0. It has been useful in practice and seems useful as-is. The equivalent feature could be implemented for Windows, but as far as I know nobody has. That can be done separately. Tracking issue: #66510
2020-05-22Rollup merge of #71829 - kper:issue71136, r=matthewjasperRalf Jung-0/+21
Fix suggestion to borrow in struct The corresponding issue is #71136. The compiler suggests that borrowing `the_foos` might solve the problem. This is obviously incorrect. ``` struct Foo(u8); #[derive(Clone)] struct FooHolster { the_foos: Vec<Foo>, } ``` I propose as fix to check if there is any colon in the span. However, there might a case where `my_method(B { a: 1, b : foo })` would be appropriate to show a suggestion for `&B ...`. To fix that too, we can simply check if there is a bracket in the span. This is only possible because both spans are different. Issue's span: `the_foos: Vec<Foo>` other's span: `B { a : 1, b : foo }`
2020-05-22Allow using `Self::` in docTymoteusz Jankowski-0/+88
2020-05-22Rollup merge of #72306 - Aaron1011:feature/turbo-spacing, r=petrochenkovRalf Jung-2/+46
Break tokens before checking if they are 'probably equal' Fixes #68489 Fixes #70987 When checking two `TokenStreams` to see if they are 'probably equal', we ignore the `IsJoint` information associated with each `TokenTree`. However, the `IsJoint` information determines whether adjacent tokens will be 'glued' (if possible) when construction the `TokenStream` - e.g. `[Gt Gt]` can be 'glued' to `BinOp(Shr)`. Since we are ignoring the `IsJoint` information, 'glued' and 'unglued' tokens are equivalent for determining if two `TokenStreams` are 'probably equal'. Therefore, we need to 'unglue' all tokens in the stream to avoid false negatives (which cause us to throw out the cached tokens, losing span information).
2020-05-22bless issue-72442csmoe-1/+16
2020-05-22Rewrite `Parser::collect_tokens`Aaron Hill-2/+2
The previous implementation did not work when called on an opening delimiter, or when called re-entrantly from the same `TokenCursor` stack depth.
2020-05-22add mcve for issue 72442csmoe-0/+25
2020-05-22Auto merge of #71956 - ecstatic-morse:remove-requires-storage-analysis, ↵bors-2/+2
r=tmandry Clean up logic around live locals in generator analysis Resolves #69902. Requires #71893. I've found it difficult to make changes in the logic around live locals in `generator/transform.rs`. It uses a custom dataflow analysis, `MaybeRequiresStorage`, that AFAICT computes whether a local is either initialized or borrowed. That analysis is using `before` effects, which we should try to avoid if possible because they are harder to reason about than ones only using the unprefixed effects. @pnkfelix has suggested removing "before" effects entirely to simplify the dataflow framework, which I might pursue someday. This PR replaces `MaybeRequiresStorage` with a combination of the existing `MaybeBorrowedLocals` and a new `MaybeInitializedLocals`. `MaybeInitializedLocals` is just `MaybeInitializedPlaces` with a coarser resolution: it works on whole locals instead of move paths. As a result, I was able to simplify the logic in `compute_storage_conflicts` and `locals_live_across_suspend_points`. This is not exactly equivalent to the old logic; some generators are now smaller than before. I believe this was because the old logic was too conservative, but I'm not as familiar with the constraints as the original implementers were, so I could be wrong. For example, I don't see a reason the size of the `mixed_sizes` future couldn't be 5K. It went from 7K to 6K in this PR. r? @jonas-schievink @tmandry
2020-05-21Auto merge of #72433 - RalfJung:rollup-srft8nx, r=RalfJungbors-10/+67
Rollup of 7 pull requests Successful merges: - #72055 (Intern predicates) - #72149 (Don't `type_of` on trait assoc ty without default) - #72347 (Make intra-link resolve links for both trait and impl items) - #72350 (Improve documentation of `slice::from_raw_parts`) - #72382 (Show default values for debug-assertions & debug-assertions-std) - #72421 (Fix anchor display when hovering impl) - #72425 (fix discriminant_value sign extension) Failed merges: r? @ghost
2020-05-21Rollup merge of #72347 - xliiv:72340-impl-for-default, r=GuillaumeGomezRalf Jung-0/+19
Make intra-link resolve links for both trait and impl items Closes #72340
2020-05-21Rollup merge of #72149 - estebank:icemation, r=eddybRalf Jung-10/+48
Don't `type_of` on trait assoc ty without default Fix #72076.
2020-05-21Auto merge of #71930 - Nadrieril:exhaustiveness-remove-tyerr, r=varkorbors-0/+22
De-abuse TyKind::Error in exhaustiveness checking Replaces https://github.com/rust-lang/rust/pull/71074. Context: https://github.com/rust-lang/rust/issues/70866. In order to remove the use of `TyKind::Error`, I had to make sure we skip over those fields whose inhabitedness should not be observed. This is potentially error-prone however, since we must be careful not to mix filtered and unfiltered lists of patterns. I managed to hide away most of the filtering behind a new `Fields` struct, that I used everywhere relevant. I quite like the result; I think the twin concepts of `Constructor` and `Fields` make a good mental model. As usual, I tried to separate commits that shuffle code around from commits that require more thought to review. cc @varkor @Centril
2020-05-21Adjust according to petrochenkov's review commentsmibac138-48/+5
2020-05-21Auto merge of #71718 - NeoRaider:ffi_const_pure, r=Amanieubors-0/+105
Experimentally add `ffi_const` and `ffi_pure` extern fn attributes Add FFI function attributes corresponding to clang/gcc/... `const` and `pure`. Rebased version of #58327 by @gnzlbg with the following changes: - Switched back from the `c_ffi_const` and `c_ffi_pure` naming to `ffi_const` and `ffi_pure`, as I agree with https://github.com/rust-lang/rust/pull/58327#issuecomment-462718772 and this nicely aligns with `ffi_returns_twice` - (Hopefully) took care of all of @hanna-kruppe's change requests in the original PR r? @hanna-kruppe
2020-05-21Suggest using std::mem::drop function instead of explicit destructor callStanislav Tkach-4/+16
2020-05-21Auto merge of #72205 - ecstatic-morse:nrvo, r=oli-obkbors-47/+108
Dumb NRVO This is a very simple version of an NRVO pass, which scans backwards from the `return` terminator to see if there is an an assignment like `_0 = _1`. If a basic block with two or more predecessors is encountered during this scan without first seeing an assignment to the return place, we bail out. This avoids running a full "reaching definitions" dataflow analysis. I wanted to see how much `rustc` would benefit from even a very limited version of this optimization. We should be able to use this as a point of comparison for more advanced versions that are based on live ranges. r? @ghost
2020-05-21Auto merge of #70705 - lcnr:generic_discriminant, r=nikomatsakisbors-15/+204
Use `T`'s discriminant type in `mem::Discriminant<T>` instead of `u64`. fixes #70509 Adds the lang-item `discriminant_kind`. Updates the function signature of `intrinsics::discriminant_value`. Adds the *probably permanently unstable* trait `DiscriminantKind`. `mem::Discriminant` should now be smaller in some cases. r? @ghost
2020-05-20Add regression test for #72394Dylan MacKenzie-0/+24
2020-05-20Adjust according to estebank's review commentsmibac138-16/+16
2020-05-20Fix testsAaron Hill-3/+10
2020-05-20Auto merge of #72378 - Dylan-DPC:rollup-m87bp2d, r=Dylan-DPCbors-36/+125
Rollup of 6 pull requests Successful merges: - #71863 (Suggest fixes and add error recovery for `use foo::self`) - #72139 (Make `fold` standalone.) - #72275 (Continue lowering for unsupported async generator instead of returning an error.) - #72361 (split_inclusive: add tracking issue number (72360)) - #72364 (Remove unused dependencies) - #72366 (Adjust the zero check in `RawVec::grow`.) Failed merges: r? @ghost
2020-05-20Error recovery for `let` with `+=`mibac138-2/+10
2020-05-20Expand partial error recovery for `let` with `BinOpEq`mibac138-2/+20
2020-05-20Implement partial error recovery for `let` with `BinOpEq`mibac138-0/+45
When parsing `let x: i8 += 1` the compiler interprets `i8` as a trait which makes it more complicated to do error recovery. More advanced error recovery is not implemented in this commit.
2020-05-20refactor check_for_castBastian Kauschke-2/+76
2020-05-20fix is_const_contextBastian Kauschke-73/+0