about summary refs log tree commit diff
path: root/tests/ui/impl-trait/issues
AgeCommit message (Collapse)AuthorLines
2025-08-22On E0277, point at type that doesn't implement boundEsteban Küber-2/+2
When encountering an unmet trait bound, point at local type that doesn't implement the trait: ``` error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied --> $DIR/issue-64855.rs:9:19 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `Foo` is not implemented for `Bar<T>` --> $DIR/issue-64855.rs:9:1 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^ ```
2025-08-08borrowck: defer opaque type errorslcnr-0/+38
2025-07-31Remove the witness type from coroutine argsMichael Goulet-22/+4
2025-07-31Stall coroutines based off of ty::Coroutine, not ty::CoroutineWitnessMichael Goulet-9/+6
2025-07-17Eagerly unify coroutine witness in old solverMichael Goulet-4/+13
2025-06-25Add edition checks for some tests that had divergent outputEsteban Küber-5/+53
In order to expose edition dependent divergences in some tests in the test suite, add explicit `edition` annotations. Some of these tests might require additional work to *avoid* the divergences, as they might have been unintentional. These are not exhaustive changes, purely opportunistic while looking at something else.
2025-05-20Just error on recursive opaque ty in HIR typeckMichael Goulet-33/+27
2025-05-09move (and remove) impl Trait testslcnr-0/+843
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-12/+12
2025-04-03add `TypingMode::Borrowck`lcnr-29/+37
2025-03-19merge opaque types of nested bodieslcnr-23/+1
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-96/+144
2025-02-14fallout :skull_emoji:lcnr-21/+21
2025-01-03Do not project when there are unconstrained impl paramsMichael Goulet-17/+2
2024-12-14(Re-)Implement impl_trait_in_bindingsMichael Goulet-0/+24
2024-12-04Avoid `opaque type not constrained` errors in the presence of other errorsOli Scherer-15/+6
2024-11-22Stabilize the 2024 editionEric Huss-1/+1
2024-11-02Add trait diff highlighting logic and use it in E0277Esteban Küber-2/+4
When a trait is not implemented for a type, but there *is* an `impl` for another type or different trait params, we format the output to use highlighting in the same way that E0308 does for types. The logic accounts for 3 cases: - When both the type and trait in the expected predicate and the candidate are different - When only the types are different - When only the trait generic params are different For each case, we use slightly different formatting and wording.
2024-10-27Move an impl-Trait check from AST validation to AST loweringLeón Orell Valerian Liehr-3/+5
2024-10-16Stop inverting expectation in normalization errorsMichael Goulet-2/+2
2024-10-04Bless ui tests.Camille GILLOT-6/+6
2024-09-16Relate receiver invariantly in method probe for Mode::PathMichael Goulet-11/+44
2024-06-27Tighten spans for async blocksMichael Goulet-3/+3
2024-06-12Require any function with a tait in its signature to actually constrain a ↵Oli Scherer-44/+100
hidden type
2024-05-29Stop proving outlives constraints on regions we already reported errors onOli Scherer-92/+11
2024-05-06borrowck: more eagerly prepopulate opaqueslcnr-0/+3
2024-04-24Error on using `yield` without also using `#[coroutine]` on the closureOli Scherer-1/+1
And suggest adding the `#[coroutine]` to the closure
2024-04-21Use sup instead of eq when unifying self typeMichael Goulet-69/+22
2024-04-21Use fulfillment, not evaluate, during method probeMichael Goulet-26/+57
2024-03-20Bless test fallout (duplicate diagnostics)Michael Goulet-1/+14
2024-03-11Make `DefiningAnchor::Bind` only store the opaque types that may be ↵Oli Scherer-23/+14
constrained, instead of the current infcx root item. This makes `Bind` almost always be empty, so we can start forwarding it to queries, allowing us to remove `Bubble` entirely
2024-03-08Improve error message for opaque capturesMichael Goulet-12/+16
2024-03-07Merge collect_mod_item_types query into check_well_formedOli Scherer-12/+12
2024-03-07Merge `check_mod_impl_wf` and `check_mod_type_wf`Oli Scherer-2/+17
2024-03-06Auto merge of #121679 - lcnr:opaque-wf-check-2, r=oli-obkbors-14/+24
stricter hidden type wf-check [based on #115008] Original work by `@aliemjay` in #115008. A huge thanks to them for originally figuring out this approach :heart: Fixes https://github.com/rust-lang/rust/issues/114728 Fixes https://github.com/rust-lang/rust/issues/114572 Instead of adding the `WellFormed` obligations when relating opaque types, we now always emit such an obligation when defining the hidden type. This causes nested opaque types which aren't wf to error, see the comment below for the described impact. I believe this change to be desirable as it significantly reduces complexity by removing special-cases. It also caused an issue with RPITIT: in defaulted trait methods, we add a `Projection(synthetic_assoc, rpit_of_trait_method)` clause to the `param_env`. This clause is not added to the `ParamEnv` of the nested coroutines. This caused a normalization failure in `fn check_coroutine_obligations` with the new solver. I fixed that by using the env of the typeck root instead. r? `@oli-obk`
2024-03-03Use root obligation on E0277 for some casesEsteban Küber-1/+0
When encountering trait bound errors that satisfy some heuristics that tell us that the relevant trait for the user comes from the root obligation and not the current obligation, we use the root predicate for the main message. This allows to talk about "X doesn't implement Pattern<'_>" over the most specific case that just happened to fail, like "char doesn't implement Fn(&mut char)" in `tests/ui/traits/suggest-dereferences/root-obligation.rs` The heuristics are: - the type of the leaf predicate is (roughly) the same as the type from the root predicate, as a proxy for "we care about the root" - the leaf trait and the root trait are different, so as to avoid talking about `&mut T: Trait` and instead remain talking about `T: Trait` instead - the root trait is not `Unsize`, as to avoid talking about it in `tests/ui/coercion/coerce-issue-49593-box-never.rs`. ``` error[E0277]: the trait bound `&char: Pattern<'_>` is not satisfied --> $DIR/root-obligation.rs:6:38 | LL | .filter(|c| "aeiou".contains(c)) | -------- ^ the trait `Fn<(char,)>` is not implemented for `&char`, which is required by `&char: Pattern<'_>` | | | required by a bound introduced by this call | = note: required for `&char` to implement `FnOnce<(char,)>` = note: required for `&char` to implement `Pattern<'_>` note: required by a bound in `core::str::<impl str>::contains` --> $SRC_DIR/core/src/str/mod.rs:LL:COL help: consider dereferencing here | LL | .filter(|c| "aeiou".contains(*c)) | + ``` Fix #79359, fix #119983, fix #118779, cc #118415 (the suggestion needs to change).
2024-02-27when defining opaques, require the hidden type to be well-formedlcnr-14/+24
2024-02-22change error messages to be incorrect, but more helpfullcnr-2/+2
2024-02-22do not use <: in subtyping overflow msglcnr-2/+2
2024-02-22overflow errors: change source to a concrete enumlcnr-18/+9
2024-02-22freshen: resolve root varslcnr-7/+32
Without doing so we use the same candidate cache entry for `?0: Trait<?1>` and `?0: Trait<?0>`. These goals are different and we must not use the same entry for them.
2024-02-22remove `sub_relations` from infcx, recompute in diagnosticslcnr-10/+5
we don't track them when canonicalizing or when freshening, resulting in instable caching in the old solver, and issues when instantiating query responses in the new one.
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-24/+24
2024-01-15Rollup merge of #119818 - oli-obk:even_more_follow_up_errors3, r=compiler-errorsMatthias Krüger-15/+2
Silence some follow-up errors [3/x] this is one piece of the requested cleanups from https://github.com/rust-lang/rust/pull/117449 Keep error types around, even in obligations. These help silence follow-up errors, as we now figure out that some types (most notably inference variables) are equal to an error type. But it also allows figuring out more types in the presence of errors, possibly causing more errors.
2024-01-13Bless testsGeorge-lewis-0/+2
Update tests
2024-01-11Keep error types around, even in obligations.Oli Scherer-15/+2
These help silence follow up errors
2024-01-11Use the right level with `-Ztreat-err-as-bug`.Nicholas Nethercote-1/+1
Errors in `DiagCtxtInner::emit_diagnostic` are never set to `Level::Bug`, because the condition never succeeds, because `self.treat_err_as_bug()` is called *before* the error counts are incremented. This commit switches to `self.treat_next_err_as_bug()`, fixing the problem. This changes the error message output to actually say "internal compiler error".
2024-01-09Avoid silencing relevant follow-up errorsOli Scherer-6/+99
2024-01-07Split note, fix const/static impl trait errorMichael Goulet-24/+48
2024-01-02Reorder `check_item_type` diagnostics so they occur next to the ↵Oli Scherer-13/+22
corresponding `check_well_formed` diagnostics