about summary refs log tree commit diff
path: root/src/test/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-22/+22
2019-11-18Update test outputAaron Hill-57/+45
2019-11-18Fix 'type annotations needed' error with opaque typesAaron Hill-5/+20
Related: #66426 This commit adds handling for opaque types during inference variable fallback. Type variables generated from the instantiatino of opaque types now fallback to the opque type itself. Normally, the type variable for an instantiated opaque type is either unified with the concrete type, or with the opaque type itself (e.g when a function returns an opaque type by calling another function). However, it's possible for the type variable to be left completely unconstrained. This can occur in code like this: ```rust pub type Foo = impl Copy; fn produce() -> Option<Foo> { None } ``` Here, we'll instantatiate the `Foo` in `Option<Foo>` to a fresh type variable, but we will never unify it with anything due to the fact that we return a `None`. This results in the error message: `type annotations needed: cannot resolve `_: std::marker::Copy`` pointing at `pub type Foo = impl Copy`. This message is not only confusing, it's incorrect. When an opaque type inference variable is completely unconstrained, we can always fall back to using the opaque type itself. This effectively turns that particular use of the opaque type into a non-defining use, even if it appears in a defining scope.
2019-11-14TAIT: adjust testsMazdak Farrokhzad-16/+26
2019-11-13Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r=Dylan-DPCYuki Okushi-1/+2
Add long error explanation for E0623 Part of #61137. r? @Dylan-DPC
2019-11-08Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obkMazdak Farrokhzad-175/+36
Transition future compat lints to {ERROR, DENY} - Take 2 Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992. - `legacy_ctor_visibility` (ERROR) -- closes #39207 - `legacy_directory_ownership` (ERROR) -- closes #37872 - `safe_extern_static` (ERROR) -- closes #36247 - `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238 - `duplicate_macro_exports` (ERROR) - `nested_impl_trait` (ERROR) -- closes #59014 - `ill_formed_attribute_input` (DENY) -- transitions #57571 - `patterns_in_fns_without_body` (DENY) -- transitions #35203 r? @varkor cc @petrochenkov
2019-11-08Rollup merge of #66049 - RalfJung:missing-spans, r=alexcrichtonYuki Okushi-5/+4
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-07Rollup merge of #66087 - tmiasko:ui-mode, r=CentrilMazdak Farrokhzad-5/+5
Update some build-pass ui tests to use check-pass where applicable Helps with issue https://github.com/rust-lang/rust/issues/62277.
2019-11-07Update ui testsGuillaume Gomez-1/+2
2019-11-06Suggest missing item from `trait` in `impl`Esteban Küber-1/+1
2019-11-06nested_impl_trait -> errorMazdak Farrokhzad-175/+36
2019-11-04Use check-pass in ui tests where appropriateTomasz Miąsko-5/+5
2019-11-02consistent handling of missing sysroot spansRalf Jung-5/+4
2019-11-02Prettify mismatched types error message in a special caseDmitry Kadashev-4/+2
Type parameters are referenced in the error message after the previous few commits (using span label). But when the main error message already references the very same type parameter it becomes clumsy. Do not show the additional label in this case as per code review comment by @estebank. Also this contains a small style fix.
2019-11-02Update testsDmitry Kadashev-6/+17
Update the tests to reflect changes to how type mismatch errors are reported (two previous commits).
2019-10-27Rollup merge of #65855 - ObsidianMinor:extended_error/E0666, r=varkorMazdak Farrokhzad-1/+2
Add long error explaination for E0666 In the spirit of the month of spooks, here's a long explanation for E0666 for #61137.
2019-10-27Rollup merge of #65777 - matthewjasper:allow-impl-trait-expansion, r=davidtwcoMazdak Farrokhzad-24/+42
Don't ICE for completely unexpandable `impl Trait` types Save the resolution of these types (to themselves) to the typeck tables so that they will eventually reach E0720. closes #65561
2019-10-27update testsMark Mansi-0/+6
2019-10-26Add detailed explaination for E0666Sydney Acksman-1/+2
2019-10-26Rollup merge of #65773 - estebank:sugg-whitespace, r=CentrilMazdak Farrokhzad-0/+9
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-25Apply suggestions from code reviewmatthewjasper-2/+2
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-10-24Don't ICE for completely unexpandable `impl Trait` typesMatthew Jasper-24/+42
2019-10-24Increase spacing for suggestions in diagnosticsEsteban Küber-0/+9
Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages.
2019-10-24Changed APIT with explicit generic args span to specific arg spansSydney Acksman-4/+6
2019-10-21Rollup merge of #65614 - varkor:apit-explicit-generics, r=matthewjasperMazdak Farrokhzad-4/+4
Improve error message for APIT with explicit generic arguments This is disallowed with type or const generics. cc https://github.com/rust-lang/rust/issues/61410.
2019-10-20Improve error message for APIT with explicit generic parametersvarkor-4/+4
This is disallowed with type or const generics.
2019-10-15Handle more cases involving `impl` and `trait`Esteban Küber-2/+5
2019-10-11Print lifetimes with backticksYuki Okushi-9/+9
2019-09-30Fixed grammar in one diagnostic and blessed tests.Alexander Regueiro-6/+6
2019-09-25Rollup merge of #64746 - estebank:elide-impl-trait-obligations-on-err, ↵Mazdak Farrokhzad-46/+60
r=cramertj Remove blanket silencing of "type annotation needed" errors 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 unneeded errors. Fix #64084.
2019-09-24Add additional tests for type alias impl trait coherenceAaron Hill-0/+71
2019-09-24Remove blanket silencing of "type annotation needed" errorsEsteban Küber-46/+60
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-22On obligation errors point at the unfulfilled binding when possibleEsteban Küber-3/+3
2019-09-18Add explanation to type mismatch involving type params and assoc typesEsteban Küber-0/+12
2019-09-09Auto merge of #64237 - estebank:tweak-method-not-found, r=Centrilbors-29/+29
Give method not found a primary span label
2019-09-08Give method not found a primary span labelEsteban Küber-29/+29
2019-09-08Update test stderr with results of enabling unused lintsMark Rousskov-7/+5
2019-09-05Rollup merge of #64038 - matthewjasper:deny-mutual-impl-trait-recursion, ↵Mazdak Farrokhzad-0/+60
r=varkor Check impl trait substs when checking for recursive types closes #64004
2019-09-03Rollup merge of #64056 - estebank:arbitrary-self-types, r=CentrilMazdak Farrokhzad-0/+8
Account for arbitrary self types in E0599 Fix https://github.com/rust-lang/rust/issues/62373
2019-09-01Account for arbitrary self types in E0599Esteban Küber-0/+8
2019-08-31Check impl trait substs when checking for recursive typesMatthew Jasper-0/+60
This prevents mutual `async fn` recursion
2019-08-31Use span label instead of note for cause in E0631Esteban Küber-15/+9
2019-08-20--bless post no async_await gates in tests.Mazdak Farrokhzad-7/+7
2019-08-20Remove async_await gates from tests.Mazdak Farrokhzad-3/+2
2019-08-19use static as object-lifetime default for type XX in `Foo<Item=XX>`Niko Matsakis-0/+27
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-08-19distinguish object-lifetime-default elision from other elisionNiko Matsakis-0/+50
Object-lifetime-default elision is distinct from other forms of elision; it always refers to some enclosing lifetime *present in the surrounding type* (e.g., `&dyn Bar` expands to `&'a (dyn Bar + 'a)`. If there is no enclosing lifetime, then it expands to `'static`. Therefore, in an `impl Trait<Item = dyn Bar>` setting, we don't expand to create a lifetime parameter for the `dyn Bar + 'X` bound. It will just be resolved to `'static`. Annoyingly, the responsibility for this resolution is spread across multiple bits of code right now (`middle::resolve_lifetimes`, `lowering`). The lowering code knows that the default is for an object lifetime, but it doesn't know what the correct result would be. Probably this should be fixed, but what we do now is a surgical fix: we have it generate a different result for elided lifetimes in a object context, and then we can ignore those results when figuring out the lifetimes that are captured in the opaque type.
2019-08-16Update stderr files with --blesssd234678-3/+3
2019-08-16Remove meaningless comments in src/testsd234678-6/+0
2019-08-12typeck: Prohibit RPIT types that inherit lifetimesDavid Wood-5/+13
This commit prohibits return position `impl Trait` types that "inherit lifetimes" from the parent scope. The intent is to forbid cases that are challenging until they can be addressed properly.
2019-08-10Fix calls to resolver from rustdoc and HIR loweringVadim Petrochenkov-1/+1
Cleanup some surrounding code. Support resolution of intra doc links in unnamed block scopes. (Paths from rustdoc now use early resolution and no longer need results of late resolution like all the built ribs.) Fix one test hitting file path limits on Windows.