summary refs log tree commit diff
path: root/tests/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2024-06-06Add regression testsOli Scherer-0/+80
(cherry picked from commit 526090b901cbedcef7e1eec132e217917606a54d)
2024-04-24Fix tests and blessGary Guo-4/+3
2024-04-24Error on using `yield` without also using `#[coroutine]` on the closureOli Scherer-18/+22
And suggest adding the `#[coroutine]` to the closure
2024-04-23Rollup merge of #124169 - compiler-errors:parser-fatal, r=oli-obkMatthias Krüger-0/+25
Don't fatal when calling `expect_one_of` when recovering arg in `parse_seq` In `parse_seq`, when parsing a sequence of token-separated items, if we don't see a separator, we try to parse another item eagerly in order to give a good diagnostic and recover from a missing separator: https://github.com/rust-lang/rust/blob/d1a0fa5ed3ffe52d72f761d3c95cbeb0a9cdfe66/compiler/rustc_parse/src/parser/mod.rs#L900-L901 If parsing the item itself calls `expect_one_of`, then we will fatal because of #58903: https://github.com/rust-lang/rust/blob/d1a0fa5ed3ffe52d72f761d3c95cbeb0a9cdfe66/compiler/rustc_parse/src/parser/mod.rs#L513-L516 For `precise_capturing` feature I implemented, we do end up calling `expected_one_of`: https://github.com/rust-lang/rust/blob/d1a0fa5ed3ffe52d72f761d3c95cbeb0a9cdfe66/compiler/rustc_parse/src/parser/ty.rs#L712-L714 This leads the compiler to fatal *before* having emitted the first error, leading to absolutely no useful information for the user about what happened in the parser. This PR makes it so that we stop doing that. Fixes #124195
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-04-21Auto merge of #124203 - lukas-code:delete-deleting-caches, r=compiler-errorsbors-0/+4
fix normalizing in different `ParamEnv`s with the same `InferCtxt` This PR changes the key of the projection cache from just `AliasTy` to `(AliasTy, ParamEnv)` to allow normalizing in different `ParamEnv`s without resetting caches. Previously, normalizing the same alias in different param envs would always reuse the cached result from the first normalization, which is incorrect if the projection clauses in the param env have changed. Fixing this bug allows us to get rid of `InferCtxt::clear_caches`, which was only used by the `AutoTraitFinder`, because it requires normalizing in different param envs. r? `@fmease`
2024-04-21also remap RPITITs nested in other types back to their opaquesLukas Markeffsky-0/+4
2024-04-20Explicitly mention `Self`Michael Goulet-5/+5
2024-04-20Flip spans for precise capturing syntax not capturing a ty/ct paramMichael Goulet-14/+16
2024-04-19Fix capturing duplicated lifetimes via parentMichael Goulet-0/+66
2024-04-19Don't fatal when calling expect_one_of when recovering arg in parse_seqMichael Goulet-0/+25
2024-04-15More polishingMichael Goulet-1/+53
2024-04-15Use a path instead of an ident (and stop manually resolving)Michael Goulet-14/+24
2024-04-15Some ordering and duplication checksMichael Goulet-0/+53
2024-04-15Add hir::Node::PreciseCapturingNonLifetimeArgMichael Goulet-31/+68
2024-04-15Validation and other thingsMichael Goulet-1/+203
2024-04-15Begin AST lowering for precise capturesMichael Goulet-0/+56
2024-04-08Ensure the canonical_param_env_cache does not contain inconsistent ↵Oli Scherer-0/+27
information about the defining anchor
2024-04-08Pass list of defineable opaque types into canonical queriesOli Scherer-38/+5
2024-04-08Add regression testOli Scherer-0/+32
2024-04-07add test for ICE: failed to resolve instance for <fn() -> impl ...> #123145Matthias Krüger-0/+35
Fixes https://github.com/rust-lang/rust/issues/123145
2024-04-07add test for ice called Option::unwrap() on a None value in ↵Matthias Krüger-0/+58
collector.rs:934:13 #105488 Fixes https://github.com/rust-lang/rust/issues/105488
2024-04-04Rollup merge of #123363 - lcnr:normalizes-to-zero-to-inf, r=BoxyUwUJacob Pratt-8/+26
change `NormalizesTo` to fully structurally normalize notes in https://hackmd.io/wZ016dE4QKGIhrOnHLlThQ need to also update the dev-guide once this PR lands. in short, the setup is now as follows: `normalizes-to` internally implements one step normalization, applying that normalization to the `goal.predicate.term` causes the projected term to get recursively normalized. With this `normalizes-to` normalizes until the projected term is rigid, meaning that we normalize as many steps necessary, but at least 1. To handle rigid aliases, we add another candidate only if the 1 to inf step normalization failed. With this `normalizes-to` is now full structural normalization. We can now change `AliasRelate` to simply emit `normalizes-to` goals for the rhs and lhs. This avoids the concerns from https://github.com/rust-lang/trait-system-refactor-initiative/issues/103 and generally feels cleaner
2024-04-04Auto merge of #121394 - oli-obk:define_opaque_types, r=compiler-errorsbors-6/+6
some smaller DefiningOpaqueTypes::No -> Yes switches r? `@compiler-errors` These are some easy cases, so let's get them out of the way first. I added tests exercising the specialization code paths that I believe weren't tested so far. follow-up to https://github.com/rust-lang/rust/pull/117348
2024-04-04amend to Switch `can_eq` and `can_sub` to `DefineOpaqueTypes::Yes`Oli Scherer-2/+2
2024-04-04Switch `can_eq` and `can_sub` to `DefineOpaqueTypes::Yes`Oli Scherer-4/+4
They are mostly used in diagnostics anyway
2024-04-04Rollup merge of #123218 - compiler-errors:synthetic-hir-parent, r=petrochenkovMatthias Krüger-0/+38
Add test for getting parent HIR for synthetic HIR node Fixes #122991, which was actually fixed by #123415
2024-04-04unconstrained `NormalizesTo` term for opaqueslcnr-8/+26
2024-04-03Tests for getting parent of synthetic HIRMichael Goulet-0/+38
2024-04-03Stop chopping off args for no reasonMichael Goulet-1/+19
2024-03-28Auto merge of #116891 - aliemjay:opaque-region-infer-rework-2, ↵bors-26/+252
r=compiler-errors,oli-obk rework opaque type region inference User-facing changes are documented in [this comment](https://github.com/rust-lang/rust/pull/116891#issuecomment-1973774412). The design document is in [this comment](https://github.com/rust-lang/rust/pull/116891#issuecomment-1836900102). --- \- Fix Ice in check_unique; ICE -> Error; fixes #122782. \- Ignore uncaptured lifetime args; ICE -> Pass; fixes #111906, fixes #110623, fixes #109059, fixes #122307 \- Except equal parameters from the uniqueness check; Pass -> Error; fixes #113916. \- Check RPITs for invalid args; Pass -> Error; fixes #111935; ICE -> Error; fixes #110726. \- Rework opaque types region inference; Pass -> Error; fixes #113971, fixes #112841. \- Reject external lifetimes as invalid args; Pass -> Error; fixes #105498. r? `@ghost`
2024-03-28remove test FIXME re once-module-regionAli MJ Al-Nasrawy-8/+6
2024-03-28simplify check_uniqueAli MJ Al-Nasrawy-56/+20
2024-03-28check RPITs for invalid argsAli MJ Al-Nasrawy-27/+114
2024-03-28except equal parameters from the uniqueness checkAli MJ Al-Nasrawy-0/+74
2024-03-27Sort a diagnostic by `DefPathStr` instead of `DefId`Oli Scherer-4/+4
2024-03-27Use `TraitRef::to_string` sorting in favor of `TraitRef::ord`, as the latter ↵Oli Scherer-10/+10
compares `DefId`s which we need to avoid
2024-03-26ignore uncaptured lifetimes when checking opaquesAli MJ Al-Nasrawy-3/+106
2024-03-24add test for ICE: no errors encountered even though delay_span_bug issued, ↵Matthias Krüger-0/+35
expected ReFree to map to ReEarlyBound #108580 Fixes https://github.com/rust-lang/rust/issues/108580
2024-03-24Rollup merge of #122943 - matthiaskrgr:ice-tests-9xxxx-to-12xxxx, r=fmeaseMatthias Krüger-0/+36
add a couple more ice tests Fixes rust-lang/rust#104779 Fixes rust-lang/rust#106423 Fixes rust-lang/rust#106444 Fixes rust-lang/rust#101852 Fixes rust-lang/rust#106874 Fixes rust-lang/rust#105047 Fixes rust-lang/rust#107228 Fixes rust-lang/rust#99945
2024-03-23add test for opaque type with non-universal region substs #101852Matthias Krüger-0/+36
Fixes #101852
2024-03-22Delay a bug if no RPITITs were foundLeón Orell Valerian Liehr-17/+71
2024-03-22add test for https://github.com/rust-lang/rust/issues/112823Matthias Krüger-0/+61
Fixes #112823
2024-03-21Auto merge of #121123 - compiler-errors:item-assumptions, r=oli-obkbors-8/+67
Split an item bounds and an item's super predicates This is the moral equivalent of #107614, but instead for predicates this applies to **item bounds**. This PR splits out the item bounds (i.e. *all* predicates that are assumed to hold for the alias) from the item *super predicates*, which are the subset of item bounds which share the same self type as the alias. ## Why? Much like #107614, there are places in the compiler where we *only* care about super-predicates, and considering predicates that possibly don't have anything to do with the alias is problematic. This includes things like closure signature inference (which is at its core searching for `Self: Fn(..)` style bounds), but also lints like `#[must_use]`, error reporting for aliases, computing type outlives predicates. Even in cases where considering all of the `item_bounds` doesn't lead to bugs, unnecessarily considering irrelevant bounds does lead to a regression (#121121) due to doing extra work in the solver. ## Example 1 - Trait Aliases This is best explored via an example: ``` type TAIT<T> = impl TraitAlias<T>; trait TraitAlias<T> = A + B where T: C; ``` The item bounds list for `Tait<T>` will include: * `Tait<T>: A` * `Tait<T>: B` * `T: C` While `item_super_predicates` query will include just the first two predicates. Side-note: You may wonder why `T: C` is included in the item bounds for `TAIT`? This is because when we elaborate `TraitAlias<T>`, we will also elaborate all the predicates on the trait. ## Example 2 - Associated Type Bounds ``` type TAIT<T> = impl Iterator<Item: A>; ``` The `item_bounds` list for `TAIT<T>` will include: * `Tait<T>: Iterator` * `<Tait<T> as Iterator>::Item: A` But the `item_super_predicates` will just include the first bound, since that's the only bound that is relevant to the *alias* itself. ## So what This leads to some diagnostics duplication just like #107614, but none of it will be user-facing. We only see it in the UI test suite because we explicitly disable diagnostic deduplication. Regarding naming, I went with `super_predicates` kind of arbitrarily; this can easily be changed, but I'd consider better names as long as we don't block this PR in perpetuity.
2024-03-20register opaques that reference errorsAli MJ Al-Nasrawy-13/+24
2024-03-20make `type_flags(ReError) & HAS_ERROR`Ali MJ Al-Nasrawy-77/+17
2024-03-20Bless test fallout (duplicate diagnostics)Michael Goulet-8/+67
2024-03-19Auto merge of #116935 - oli-obk:different_lifetime_taits_in_same_sig, ↵bors-21/+0
r=compiler-errors Prevent opaque types being instantiated twice with different regions within the same function addresses https://github.com/orgs/rust-lang/projects/22/views/1?pane=issue&itemId=41329537 r? `@compiler-errors`
2024-03-19Auto merge of #122392 - BoxyUwU:misc_cleanup, r=lcnrbors-8/+8
misc cleanups from debugging something rename `instantiate_canonical_with_fresh_inference_vars` to `instantiate_canonical` the substs for the canonical are not solely infer vars as that would be wildly wrong and it is rather confusing to see this method called and think that the entire canonicalization setup is completely broken when it is not :thumbsup: also update region debug printing to be more like the custom impls for Ty/Const, right now regions in debug output are horribly verbose and make it incredibly hard to read but with this atleast boundvars and placeholders when debugging the new solver do not take up excessive amounts of space. r? `@lcnr`