about summary refs log tree commit diff
path: root/src/test/ui/variance
AgeCommit message (Collapse)AuthorLines
2020-09-02pretty: trim paths of unique symbolsDan Aloni-9/+9
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-06-09Relate existential associated types with variance InvariantSantiago Pastorino-0/+47
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-44/+44
Specific labels when referring to "expected" and "found" types
2019-11-18Auto merge of #58281 - mark-i-m:synthesis, r=estebankbors-0/+70
Add outlives suggestions for some lifetime errors This PR implements suggestion diagnostics for some lifetime mismatch errors. When the borrow checker finds that some lifetime 'a doesn't outlive some other lifetime 'b that it should outlive, then in addition to the current lifetime error, we also emit a suggestion for how to fix the problem by adding a bound: - If a and b are normal named regions, suggest to add the bound `'a: 'b` - If b is static, suggest to replace a with static - If b also needs to outlive a, they must be the same, so suggest unifying them We start with a simpler implementation that avoids diagnostic regression or implementation complexity: - We only makes suggestions for lifetimes the user can already name (eg not closure regions or elided regions) - For now, we only emit a help note, not an actually suggestion because it is significantly easier. Finally, there is one hack: it seems that implicit regions in async fn are given the name '_ incorrectly. To avoid suggesting '_: 'x, we simply filter out such lifetimes by name. For more info, see this internals thread: https://internals.rust-lang.org/t/mechanical-suggestions-for-some-borrow-checker-errors/9049/3 TL;DR Make suggestions to add a `where 'a: 'b` constraint for some lifetime errors. Details are in the paper linked from the internals thread above. r? @estebank TODO - [x] Clean up code - [x] Only make idiomatic suggestions - [x] don't suggest naming `&'a self` - [x] rather than `'a: 'static`, suggest replacing `'a` with `'static` - [x] rather than `'a: 'b, 'b: 'a`, suggest replacing `'a` with `'b` or vice versa - [x] Performance (maybe need a perf run when this is closer to the finish line?) - perf run was clean... - EDIT: perf run seems to only check non-error performance... How do we check that error performance didn't regress? - [x] Needs ui tests - [x] Integrate the `help` message into the main lifetime `error`
2019-11-18review comments: tweak prefix stringsEsteban Küber-12/+12
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-44/+44
2019-11-07Update ui testsGuillaume Gomez-0/+1
2019-10-27update testsMark Mansi-0/+70
2019-10-11Print lifetimes with backticksYuki Okushi-56/+56
2019-10-03typo: fix typo in E0392Ben Boeckel-9/+9
See #64931.
2019-10-02review commentEsteban Küber-9/+9
2019-09-30Reword E0392 slightlyEsteban Küber-9/+9
Make it clearer that a type or lifetime argument not being used can be fixed by referencing it in a struct's fields, not just using `PhathomData`.
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-2/+2
2019-05-29Update ui test suite to use dynmemoryruins-38/+38
2019-05-12Change compare mode to use -Zborrowck=mirMatthew Jasper-0/+397
2019-04-22update tests for migrate mode by defaultMatthew Jasper-36/+9
2019-04-19Rollup merge of #60052 - varkor:unused-parameter-diagnostic, r=estebankMazdak Farrokhzad-9/+9
Correct unused parameter diagnostic The message was incorrect for unused lifetime parameters. There's no need to be specific.
2019-04-18Update testsvarkor-9/+9
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-9/+0
2019-03-11Update NLL testsVadim Petrochenkov-3/+3
2019-03-11Update testsVadim Petrochenkov-76/+76
2018-12-25Remove licensesMark Rousskov-498/+196
2018-11-07Removed `#[rustc_error]` from tests that are all `// compile-pass`.Felix S. Klock II-21/+5
I also added `// skip-codegen` to each one, to address potential concerns that this change would otherwise slow down our test suite spending time generating code for files that are really just meant to be checks of compiler diagnostics. (However, I will say: My preference is to not use `// skip-codegen` if one can avoid it. We can use all the testing of how we drive LLVM that we can get...) (Updated post rebase.)
2018-11-07remove `#[rustc_error]` from ui/ tests that remain compile-fail tests.Felix S. Klock II-6/+6
2018-10-17Update output for borrowck=migrate compare mode.David Wood-397/+0
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-10Use the span of the user type for `AscribeUserType`Matthew Jasper-2/+2
Also change the order of the fake read for let and the AscribeUserType, so that we use the better span and message from the fake read in errors.
2018-09-27Enable NLL compare mode for more testsMatthew Jasper-75/+218
These tests were disabled due to NLL bugs that have since been fixed.
2018-09-19Update ui testsMatthew Jasper-6/+6
2018-09-01Update testsBasile Desloges-150/+0
2018-08-14Update former compile-fail testsMatthew Jasper-16/+16
2018-08-14Merged migrated compile-fail tests and ui tests. Fixes #46841.David Wood-0/+2593