about summary refs log tree commit diff
path: root/src/test/ui/object-lifetime
AgeCommit message (Collapse)AuthorLines
2021-02-02Update ui tests (nll)Jesus Rubio-0/+1
2020-09-02pretty: trim paths of unique symbolsDan Aloni-3/+3
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-07-22Further tweak wording of E0759 and introduce E0767Esteban Küber-2/+2
2020-06-15Change E0758 to E0759 to avoid conflict with #72912Esteban Küber-2/+2
2020-06-15small tweaksEsteban Küber-1/+1
2020-06-15Register new eror codeEsteban Küber-1/+2
2020-06-15review comments: wordingEsteban Küber-1/+1
2020-06-15Tweak wording and add error codeEsteban Küber-4/+4
2020-06-15Reduce verbosity of suggestion message and mention lifetime in labelEsteban Küber-2/+2
2020-06-15When `'static` is explicit, suggest constraining argument with itEsteban Küber-1/+1
2020-05-30Tweak wording and spans of `'static` `dyn Trait`/`impl Trait` requirementsEsteban Küber-12/+5
2020-05-30Update nll testsEsteban Küber-3/+3
2020-05-30review comment: tweak wording and account for span overlapEsteban Küber-4/+1
2020-05-30Account for returned `dyn Trait` evaluating to `'static` lifetimeEsteban Küber-6/+21
Provide a suggestion for `dyn Trait + '_` when possible.
2020-05-27Fix spacing of expected/found notes without a labelEsteban Küber-4/+4
2020-05-12add long error explanation for E0228Jade McGough-0/+4
2019-12-03Include a span in more `expected...found` notesAaron Hill-6/+14
In most places, we use a span when emitting `expected...found` errors. However, there were a couple of places where we didn't use any span, resulting in hard-to-interpret error messages. This commit attaches the relevant span to these notes, and additionally switches over to using `note_expected_found` instead of manually formatting the message
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-6/+6
Specific labels when referring to "expected" and "found" types
2019-11-18Auto merge of #58281 - mark-i-m:synthesis, r=estebankbors-0/+10
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-18Specific labels when referring to "expected" and "found" typesEsteban Küber-6/+6
2019-11-07Update ui testsGuillaume Gomez-1/+2
2019-10-27update testsMark Mansi-0/+10
2019-10-11Print lifetimes with backticksYuki Okushi-7/+7
2019-10-07update ui testsGuillaume Gomez-0/+1
2019-08-19use static as object-lifetime default for type XX in `Foo<Item=XX>`Niko Matsakis-0/+132
Currently the default is "inherited" from context, so e.g. `&impl Foo<Item = dyn Bar>` would default to `&'x impl Foo<Item = dyn Bar + 'x>`, but this triggers an ICE and is not very consistent. This patch doesn't implement what I expect would be the correct semantics, because those are likely too complex. Instead, it handles what I'd expect to be the common case -- where the trait has no lifetime parameters.
2019-06-30Make sure `#[rustc_doc_only_macro]` and other rustc attributes are registeredVadim Petrochenkov-24/+24
2019-06-03Update tests for changes to cannot move errorsMatthew Jasper-2/+2
2019-05-29Update ui test suite to use dynmemoryruins-53/+53
2019-05-12Change compare mode to use -Zborrowck=mirMatthew Jasper-0/+82
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-4/+1
2019-03-11Update testsVadim Petrochenkov-13/+13
2018-12-25Remove licensesMark Rousskov-106/+36
2018-10-17Update output for borrowck=migrate compare mode.David Wood-82/+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-09-26apply `process_registered_region_obligations` at the end of regionckNiko Matsakis-1/+1
We used to apply it repeatedly as we went, relying on the current value of the `region_bound_pairs_accum` vector. But now we save those values into a map, so we can just process all the registered region obligations at the end.
2018-09-19Update ui testsMatthew Jasper-6/+6
2018-09-01Update testsBasile Desloges-42/+0
2018-08-27Also use smaller spans for unsize adjustmentsMatthew Jasper-11/+6
2018-08-25Use smaller span for adjustments on block expressionsMatthew Jasper-13/+8
2018-08-18Auto merge of #53175 - matthewjasper:more-return-stuff, r=nikomatsakisbors-2/+2
[NLL] Returns are interesting for free regions Based on #53088 - creating now to get feedback. Closes #51175 * Make assigning to the return type interesting. * Use "returning this value" instead of "return" in error messages. * Prefer one of the explanations that we have a name for to a generic interesting cause in some cases. * Treat causes that involve the destination of a call like assignments.
2018-08-17Fix undesirable falloutVadim Petrochenkov-24/+24
compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs - resolution change for derive helper attributes with the same name as derive itself run-pass/macro-comma-support.rs - indeterminate resolutions for macros in expression positions ui/issues/issue-49074.rs - diagnostics regression, not enough recovery to report the second error ui/object-lifetime/object-lifetime-default.stderr - unstable diagnostics?
2018-08-14Update former compile-fail testsMatthew Jasper-2/+2
2018-08-14Merged migrated compile-fail tests and ui tests. Fixes #46841.David Wood-0/+675