about summary refs log tree commit diff
path: root/src/test/ui/moves
AgeCommit message (Collapse)AuthorLines
2021-01-08Change wording of noteAaron Hill-9/+9
2021-01-08Explain method-call move errors in loopsAaron Hill-1/+15
PR #73708 added a more detailed explanation of move errors that occur due to a call to a method that takes `self`. This PR extends that logic to work when a move error occurs due to a method call in the previous iteration of a loop.
2020-11-29Update tests to remove old numeric constantsbstrie-3/+1
Part of #68490. Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros. For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.
2020-10-27Make tidy happySantiago Pastorino-1/+1
2020-10-27Add unsized_locals to INCOMPLETE_FEATURES listSantiago Pastorino-13/+23
2020-09-10Note when a a move/borrow error is caused by a deref coercionAaron Hill-0/+68
Fixes #73268 When a deref coercion occurs, we may end up with a move error if the base value has been partially moved out of. However, we do not indicate anywhere that a deref coercion is occuring, resulting in an error message with a confusing span. This PR adds an explicit note to move errors when a deref coercion is involved. We mention the name of the type that the deref-coercion resolved to, as well as the `Deref::Target` associated type being used.
2020-09-02pretty: trim paths of unique symbolsDan Aloni-36/+36
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-08-26Point to a move-related span when pointing to closure upvarsAaron Hill-0/+30
Fixes #75904 When emitting move/borrow errors, we may point into a closure to indicate why an upvar is used in the closure. However, we use the 'upvar span', which is just an arbitrary usage of the upvar. If the upvar is used in multiple places (e.g. a borrow and a move), we may end up pointing to the borrow. If the overall error is a move error, this can be confusing. This PR tracks the span that caused an upvar to become captured by-value instead of by-ref (assuming that it's not a `move` closure). We use this span instead of the 'upvar' span when we need to point to an upvar usage during borrow checking.
2020-08-08Be consistent when describing a move as a 'partial' in diagnosticsAaron Hill-9/+9
When an error occurs due to a partial move, we would use the world "partial" in some parts of the error message, but not in others. This commit ensures that we use the word 'partial' in either all or none of the diagnostic messages. Additionally, we no longer describe a move out of a `Box` via `*` as a 'partial move'. This was a pre-existing issue, but became more noticable when the word 'partial' is used in more places.
2020-07-27mv std libs to library/mark-5/+5
2020-06-26Explain move errors that occur due to method calls involving `self`Aaron Hill-3/+253
This is a re-attempt of #72389 (which was reverted in #73594) Instead of using `ExpnKind::Desugaring` to represent operators, this PR checks the lang item directly.
2020-06-24Provide suggestions for some moved value errorsEsteban Küber-0/+4
When encountering an used moved value where the previous move happened in a `match` or `if let` pattern, suggest using `ref`. Fix #63988. When encountering a `&mut` value that is used in multiple iterations of a loop, suggest reborrowing it with `&mut *`. Fix #62112.
2020-06-23Rollup merge of #73600 - Aaron1011:fix/move-in-macro, r=ecstatic-morseDylan DPC-1/+33
Fix spurious 'value moved here in previous iteration of loop' messages Fixes #46099 Previously, we would check the 'move' and 'use' spans to see if we should emit this message. However, this can give false positives when macros are involved, since two distinct expressions may end up with the same span. Instead, we check the actual MIR `Location`, which eliminates false positives.
2020-06-22Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, ↵Aaron Hill-253/+3
r=nikomatsakis" This reverts commit 372cb9b69c76a042d0b9d4b48ff6084f64c84a2c, reversing changes made to 5c61a8dc34c3e2fc6d7f02cb288c350f0233f944.
2020-06-21Fix spurious 'value moved here in previous iteration of loop' messagesAaron Hill-1/+33
Fixes #46099 Previously, we would check the 'move' and 'use' spans to see if we should emit this message. However, this can give false positives when macros are involved, since two distinct expressions may end up with the same span. Instead, we check the actual MIR `Location`, which eliminates false positives.
2020-06-11Use `fn_span` to point to the actual method callAaron Hill-11/+11
2020-06-11Explain move errors that occur due to method calls involving `self`Aaron Hill-3/+253
2020-03-29Tweak `suggest_constraining_type_param`Esteban Küber-4/+3
Some of the bound restriction structured suggestions were incorrect while others had subpar output.
2020-02-09Improve reporting errors and suggestions for trait boundsPatryk Wychowaniec-3/+7
2020-02-02move_ref_patterns: introduce testsMazdak Farrokhzad-1/+1
bindings_after_at: harden tests
2020-01-18slice_patterns: remove gates in testsMazdak Farrokhzad-6/+4
2019-12-21Add more tests for slice patternsMatthew Jasper-0/+168
2019-11-28Use structured suggestion when requiring `Copy` constraint in type paramEsteban Küber-3/+3
2019-09-06Fixed grammar/style in error messages and reblessed tests.Alexander Regueiro-3/+3
2019-07-27tests: Move run-pass tests without naming conflicts to uiVadim Petrochenkov-0/+199
2019-06-03Update tests for changes to cannot move errorsMatthew Jasper-24/+17
2019-05-29Update ui test suite to use dynmemoryruins-1/+1
2019-05-03Update testsChristopher Vittal-17/+4
2019-04-23Update ui testsvarkor-2/+2
2019-04-23Remove unnecessary ignore-tidy-linelengthvarkor-2/+0
2019-04-22update tests for migrate mode by defaultMatthew Jasper-519/+170
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-2/+2
2019-03-11Update NLL testsVadim Petrochenkov-32/+32
2019-03-11Update testsVadim Petrochenkov-32/+32
2019-02-20./x.py test src/test/ui --stage 1 --bless -i --compare-mode=nllClint Frederickson-2/+2
2019-02-18re-blessing error output: ./x.py test src/test/ui --stage 1 --blessClint Frederickson-1/+1
2019-02-06error output updated by ./x.py test --stage 1 src/test/ui --incremental --blessClint Frederickson-1/+1
2019-01-24Fix --compare-mode=nll testsEsteban Küber-36/+72
2019-01-24When using value after move, point at span of localEsteban Küber-2/+2
When trying to use a value after move, instead of using a note, point at the local declaration that has a type that doesn't implement `Copy` trait.
2018-12-25Remove licensesMark Rousskov-253/+63
2018-11-18Remove mir::StatementKind::EndRegionMatthew Jasper-1/+1
Since lexical MIR borrow check is gone, and validation no longer uses these, they can be removed.
2018-10-29Don't emit cannot move errors twice in migrate modeMatthew Jasper-29/+2
2018-10-17Update output for borrowck=migrate compare mode.David Wood-2/+29
This commit updates the test output for the updated NLL compare mode that uses `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The previous commit changes `compiletest` and this commit only updates `.nll.stderr` files.
2018-10-03Clearer later use messages for callsMatthew Jasper-4/+3
Give a special message when the later use is from a call. Use the span of the callee instead of the whole expression. For conflicting borrow messages say that the later use is of the first borrow.
2018-09-28test fix for #54015Rusty Blitzerr-0/+11
2018-08-15Bless testsashtneoi-4/+7
2018-08-15Bless UI testsashtneoi-2/+8
2018-08-14Improved how upvars are detected when presenting errors using prefixes.David Wood-0/+2
2018-08-14Merged migrated compile-fail tests and ui tests. Fixes #46841.David Wood-0/+1341