about summary refs log tree commit diff
path: root/tests/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2024-06-04Add another test for hidden types capturing lifetimes that outlive but arent ↵Michael Goulet-0/+53
mentioned in substs
2024-06-04Rollup merge of #125667 - oli-obk:taintify, r=TaKO8KiMichael Goulet-135/+23
Silence follow-up errors directly based on error types and regions During type_of, we used to just return an error type if there were any errors encountered. This is problematic, because it means a struct declared as `struct Foo<'static>` will end up not finding any inherent or trait impls because those impl blocks' `Self` type will be `{type error}` instead of `Foo<'re_error>`. Now it's the latter, silencing nonsensical follow-up errors about `Foo` not having any methods. Unfortunately that now allows for new follow-up errors, because borrowck treats `'re_error` as `'static`, causing nonsensical errors about non-error lifetimes not outliving `'static`. So what I also did was to just strip all outlives bounds that borrowck found, thus never letting it check them. There are probably more nuanced ways to do this, but I worried there would be other nonsensical errors if some outlives bounds were missing. Also from the test changes, it looked like an improvement everywhere.
2024-05-29Use parenthetical notation for `Fn` traitsEsteban Küber-2/+2
Always use the `Fn(T) -> R` format when printing closure traits instead of `Fn<(T,), Output = R>`. Fix #67100: ``` error[E0277]: expected a `Fn()` closure, found `F` --> file.rs:6:13 | 6 | call_fn(f) | ------- ^ expected an `Fn()` closure, found `F` | | | required by a bound introduced by this call | = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `call_fn` --> file.rs:1:15 | 1 | fn call_fn<F: Fn() -> ()>(f: &F) { | ^^^^^^^^^^ required by this bound in `call_fn` help: consider further restricting this bound | 5 | fn call_any<F: std::any::Any + Fn()>(f: &F) { | ++++++ ```
2024-05-29Stop proving outlives constraints on regions we already reported errors onOli Scherer-135/+23
2024-05-25Rollup merge of #124080 - oli-obk:define_opaque_types10, r=compiler-errorsMatthias Krüger-32/+117
Some unstable changes to where opaque types get defined None of these can be reached from stable afaict. r? ``@compiler-errors`` cc https://github.com/rust-lang/rust/issues/116652
2024-05-24Add regression testsOli Scherer-0/+80
2024-05-23When checking whether an impl applies, constrain hidden types of opaque types.Oli Scherer-32/+26
We already handle this case this way on the coherence side, and it matches the new solver's behaviour. While there is some breakage around type-alias-impl-trait (see new "type annotations needed" in tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs), no stable code breaks, and no new stable code is accepted.
2024-05-23Add more testsOli Scherer-0/+91
2024-05-20Inline get_node_fn_decl into get_fn_decl, simplify/explain logic in ↵Michael Goulet-1/+3
report_return_mismatched_types
2024-05-16Report better WF obligation leaf obligations in new solverMichael Goulet-3/+6
2024-05-13And finally add testsMichael Goulet-0/+133
2024-05-13Warn against redundant use<...>Michael Goulet-1/+71
2024-05-06borrowck: more eagerly prepopulate opaqueslcnr-0/+9
2024-04-28add test for ice future has no bound vars.Matthias Krüger-0/+29
Fixes https://github.com/rust-lang/rust/issues/112347
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