summary refs log tree commit diff
path: root/src/test/ui/traits
AgeCommit message (Collapse)AuthorLines
2019-12-14Revert "Remove `#![feature(never_type)]` from tests."Niko Matsakis-1/+1
This reverts commit 8f6197f39f7d468dfc5b2bd41dae4769992a2f83.
2019-12-11Add more context for type parametersEsteban Küber-1/+1
2019-12-10Deduplicate logicEsteban Küber-2/+4
2019-12-05Rollup merge of #67011 - Aaron1011:fix/expected-found-span, r=Dylan-DPCMazdak Farrokhzad-3/+7
Include a span in more `expected...found` notes 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-12-04Auto merge of #66408 - nnethercote:greedy-process_obligations, r=nmatsakisbors-1/+3
Make `process_obligations()` greedier. `process_obligations()` adds new nodes, but it does not process these new nodes until the next time it is called. This commit changes it so that it does process these new nodes within the same call. This change reduces the number of calls to `process_obligations()` required to complete processing, sometimes giving significant speed-ups. The change required some changes to tests. - The output of `cycle-cache-err-60010.rs` is slightly different. - The unit tests required extra cases to handle the earlier processing of the added nodes. I mostly did these in the simplest possible way, by making the added nodes be ignored, thus giving outcomes the same as with the old behaviour. But I changed `success_in_grandchildren()` more extensively so that some obligations are completed earlier than they used to be. r? @nikomatsakis
2019-12-03Include a span in more `expected...found` notesAaron Hill-3/+7
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-26Fix spelling typosBrian Wignall-1/+1
2019-11-24fixup! Add negative tests where the diagnostic message would be wrongTimo Freiberg-14/+103
2019-11-24Add version mismatch help message for unimplemented traitTimo Freiberg-7/+48
Issue #22750 The error reporting for E0277 (the trait `X` is not implemented for `Foo`) now checks whether `Foo` implements a trait with the same path as `X`, which probably means that the programmer wanted to actually use only one version of the trait `X` instead of the two.
2019-11-21Auto merge of #66610 - alexreg:trait-upcasting-cosmetic, r=Centrilbors-2/+2
Aggregation of drive-by cosmetic changes for trait-upcasting PR Cherry-picked from #60900. As requested by @Centril (and @nikomatsakis, I believe). r? @Centril
2019-11-21Aggregation of drive-by cosmetic changes.Alexander Regueiro-2/+2
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-15/+12
Specific labels when referring to "expected" and "found" types
2019-11-21Remove `#![feature(never_type)]` from tests.Mazdak Farrokhzad-1/+1
Also remove `never_type` the feature-gate test.
2019-11-18Surround types with backticks in type errorsEsteban Küber-2/+2
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-3/+0
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-10/+10
2019-11-16Account for `rustc_on_unimplemented`Esteban Küber-4/+6
2019-11-16Remove unnecessary noteEsteban Küber-2/+0
2019-11-16Modify primary label message to be inline with error messageEsteban Küber-2/+2
2019-11-16Suggest borrowing when it would satisfy an unmet trait boundEsteban Küber-6/+12
When there are multiple implementors for the same trait that is present in an unmet binding, modify the E0277 error to refer to the parent obligation and verify whether borrowing the argument being passed in would satisfy the unmet bound. If it would, suggest it.
2019-11-15Make `process_obligations()` greedier.Nicholas Nethercote-1/+3
`process_obligations()` adds new nodes, but it does not process these new nodes until the next time it is called. This commit changes it so that it does process these new nodes within the same call. This change reduces the number of calls to `process_obligations()` required to complete processing, sometimes giving significant speed-ups. The change required some changes to tests. - The output of `cycle-cache-err-60010.rs` is slightly different. - The unit tests required extra cases to handle the earlier processing of the added nodes. I mostly did these in the simplest possible way, by making the added nodes be ignored, thus giving outcomes the same as with the old behaviour. But I changed `success_in_grandchildren()` more extensively so that some obligations are completed earlier than they used to be.
2019-11-08Rollup merge of #66049 - RalfJung:missing-spans, r=alexcrichtonYuki Okushi-9/+8
consistent handling of missing sysroot spans Due to https://github.com/rust-lang/rust/issues/53081, sysroot spans (pointing to code in libcore/libstd/...) fails to print on some x86 runners. This consolidates the ignore directives for that and references the relevant issue. I also did that for the generated derive-error-span tests -- but there the script and the tests were not entirely in sync any more since https://github.com/rust-lang/rust/pull/64151. Cc @estebank @varkor
2019-11-04Use check-pass in ui tests where appropriateTomasz Miąsko-1/+1
2019-11-02consistent handling of missing sysroot spansRalf Jung-9/+8
2019-10-27Point at local similarly named element and tweak references to variantsEsteban Küber-2/+6
Point at the span for the definition of ADTs internal to the current crate. Look at the leading char of the ident to determine whether we're expecting a likely fn or any of a fn, a tuple struct or a tuple variant. Turn fn `add_typo_suggestion` into a `Resolver` method.
2019-10-27Auto merge of #65288 - estebank:point-at-assoc-type, r=nikomatsakisbors-4/+9
Point at associated type for some obligations Partially address #57663.
2019-10-26Rollup merge of #65773 - estebank:sugg-whitespace, r=CentrilMazdak Farrokhzad-0/+1
Increase spacing for suggestions in diagnostics Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages. r? @Centril
2019-10-24Increase spacing for suggestions in diagnosticsEsteban Küber-0/+1
Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages.
2019-10-24syntax: reject `trait Foo: Bar = Baz;`.Mazdak Farrokhzad-5/+20
Add test for rejecting `trait A: B1 = B2;`. Also test rejection of `trait A: = B;`.
2019-10-23Auto merge of #57545 - bovinebuddha:object_safe_for_dispatch, r=nikomatsakisbors-0/+2
Object safe for dispatch cc #43561
2019-10-22review comments: move code, fix indentation and change spanEsteban Küber-7/+6
2019-10-22Point at associated type for some obligationsEsteban Küber-5/+11
2019-10-22RFC 2027: "first draft" of implementationMathias Blikstad-0/+2
These are a squashed series of commits.
2019-10-19Rollup merge of #65192 - estebank:restrict-bound, r=matthewjasperMazdak Farrokhzad-18/+21
Use structured suggestion for restricting bounds When a trait bound is not met and restricting a type parameter would make the restriction hold, use a structured suggestion pointing at an appropriate place (type param in param list or `where` clause). Account for opaque parameters where instead of suggesting extending the `where` clause, we suggest appending the new restriction: `fn foo(impl Trait + UnmetTrait)`. Fix #64565, fix #41817, fix #24354, cc #26026, cc #37808, cc #24159, fix #37138, fix #24354, cc #20671.
2019-10-16update ui testsGuillaume Gomez-0/+1
2019-10-15Rollup merge of #65308 - GuillaumeGomez:long-err-explanation-E0574, ↵Tyler Mandry-0/+1
r=matthewjasper Add long error explanation for E0574 Part of #61137.
2019-10-15Remove useless `help`Esteban Küber-2/+0
2019-10-15Consider trait aliasesEsteban Küber-3/+4
2019-10-15Handle more casesEsteban Küber-7/+7
2019-10-15Use structured suggestion for restricting boundsEsteban Küber-6/+10
When a trait bound is not met and restricting a type parameter would make the restriction hold, use a structured suggestion pointing at an appropriate place (type param in param list or `where` clause). Account for opaque parameters where instead of suggesting extending the `where` clause, we suggest appending the new restriction: `fn foo(impl Trait + UnmetTrait)`.
2019-10-14Rollup merge of #65292 - JohnTitor:add-backticks, r=varkor,CentrilMazdak Farrokhzad-6/+6
Print lifetimes with backticks Fixes #65287 r? @varkor
2019-10-13Update ui testsGuillaume Gomez-0/+1
2019-10-11Print lifetimes with backticksYuki Okushi-6/+6
2019-10-10Update ui testsGuillaume Gomez-1/+2
2019-10-07update ui testsGuillaume Gomez-0/+1
2019-09-30Fixed grammar in one diagnostic and blessed tests.Alexander Regueiro-4/+4
2019-09-26Auto merge of #62661 - arielb1:never-reserve, r=nikomatsakisbors-0/+145
reserve `impl<T> From<!> for T` this is necessary for never-type stabilization. cc #57012 #35121 I think we wanted a crater run for this @nikomatsakis? r? @nikomatsakis
2019-09-25address rebase damageAriel Ben-Yehuda-2/+2
2019-09-24Remove blanket silencing of "type annotation needed" errorsEsteban Küber-2/+2
Remove blanket check for existence of other errors before emitting "type annotation needed" errors, and add some eager checks to avoid adding obligations when they refer to types that reference `[type error]` in order to reduce unneded errors.
2019-09-24nit: update text to avoid "lattice specialization" termNiko Matsakis-5/+8