summary refs log tree commit diff
path: root/tests/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2023-07-21allow opaques to be defined by trait queriesAli MJ Al-Nasrawy-0/+12
2023-07-08Auto merge of #113491 - matthiaskrgr:rollup-mueqz7h, r=matthiaskrgrbors-2/+2
Rollup of 6 pull requests Successful merges: - #113005 (Don't call `query_normalize` when reporting similar impls) - #113064 (std: edit [T]::swap docs) - #113138 (Add release notes for 1.71.0) - #113217 (resolve typerelative ctors to adt) - #113254 (Use consistent formatting in Readme) - #113482 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-08Rollup merge of #113005 - compiler-errors:dont-query-normalize, r=cjgillotMatthias Krüger-2/+2
Don't call `query_normalize` when reporting similar impls Firstly, It's sketchy to be using `query_normalize` at all during HIR typeck -- it's asking for an ICE 😅. Secondly, we're normalizing an impl trait ref that potentially has parameter types in `ty::ParamEnv::empty()`, which is kinda sketchy as well. The only UI test change from removing this normalization is that we don't evaluate anonymous constants in impls, which end up giving us really ugly suggestions: ``` error[E0277]: the trait bound `[X; 35]: Default` is not satisfied --> /home/gh-compiler-errors/test.rs:4:5 | 4 | <[X; 35] as Default>::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[X; 35]` | = help: the following other types implement trait `Default`: &[T] &mut [T] [T; 32] [T; core::::array::{impl#30}::{constant#0}] [T; core::::array::{impl#31}::{constant#0}] [T; core::::array::{impl#32}::{constant#0}] [T; core::::array::{impl#33}::{constant#0}] [T; core::::array::{impl#34}::{constant#0}] and 27 others ``` So just fold the impls with a `BottomUpFolder` that calls `ty::Const::eval`. This doesn't work totally correctly with generic-const-exprs, but it's fine for stable code, and this is error reporting after all.
2023-07-08Rollup merge of #113335 - compiler-errors:reveal-opaques-in-new-solver, r=lcnrMatthias Krüger-0/+11
Reveal opaques in new solver We were testing against the wrong reveal mode :fearful: Also a couple of misc commits that I don't want to really put in separate prs r? ``@lcnr``
2023-07-08Auto merge of #113474 - compiler-errors:rollup-07x1up7, r=compiler-errorsbors-0/+51
Rollup of 8 pull requests Successful merges: - #113413 (Add needs-triage to all new issues) - #113426 (Don't ICE in `resolve_bound_vars` when associated return-type bounds are in bad positions) - #113427 (Remove `variances_of` on RPITIT GATs, remove its one use-case) - #113441 (miri: check that assignments do not self-overlap) - #113453 (Remove unused from_method from rustc_on_unimplemented) - #113456 (Avoid calling report_forbidden_specialization for RPITITs) - #113466 (Update cargo) - #113467 (Fix comment of `fn_can_unwind`) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-07Add regression test for RPITITsSantiago Pastorino-0/+51
2023-07-07Normalize opaques during codegen in new solverMichael Goulet-0/+11
2023-07-07Require TAITs to be mentioned in the signatures of functions that register ↵Oli Scherer-22/+89
hidden types for them
2023-07-05Add some extra information to opaque type cycle errorsOli Scherer-7/+149
2023-07-04Auto merge of #113303 - compiler-errors:yeet-chalk, r=lcnrbors-5/+3
Remove chalk support from the compiler Removes chalk (`-Ztrait-solver=chalk`) from the compiler and prunes any dead code resulting from this, mainly: * Remove the chalk compatibility layer in `compiler/rustc_traits/src/chalk` * Remove the chalk flag `-Ztrait-solver=chalk` and its `TraitEngine` implementation * Remove `TypeWellFormedFromEnv` (and its many `bug!()` match arms) * Remove the chalk migration mode from compiletest * Remove the `chalkify` UI tests (do we want to keep any of these, but migrate them to `-Ztrait-solver=next`??) Fulfills rust-lang/types-team#93. r? `@jackh726`
2023-07-04Auto merge of #113215 - compiler-errors:rpitit-predicates-tweaks, r=spastorinobors-15/+52
Make RPITITs assume/require their parent method's predicates Removes a FIXME from the `param_env` query where we were manually adding the parent function's predicates to the RPITIT's assumptions. r? `@spastorino`
2023-07-03Remove compare modeMichael Goulet-2/+0
2023-07-03Remove chalk from the compilerMichael Goulet-3/+3
2023-07-01Rollup merge of #113182 - compiler-errors:rpit-stricter-captures, r=oli-obkMatthias Krüger-24/+167
Error when RPITITs' hidden types capture more lifetimes than their trait definitions This implements a stricter set of captures rules for RPITITs. They now may only capture: 1. Lifetimes from the impl header (both the self type and any trait substs -- we may want to restrict just to the self type's lifetimes, but the PR makes that easy to do, too) 2. Lifetimes mentioned by the `impl Trait` in the trait method's definition. Namely, they may not mention lifetimes from the method (early or late) that are not mentioned in the `impl Trait`. cc #105258 which I think was trying to do this too, though I'm not super familiar with what exactly differs from that or why that one was broken. cc #112194 (doesn't fix this issue per se, because it's still an open question, but I think this is objectively better than the status quo, and gets us closer to resolving that issue.) Technically is a fix for the ICE in #108580, but it turns that issue into an error now. We can decide separately whether or not nested RPITITs should capture lifetimes from their parents. r? ``@oli-obk``
2023-06-30Additional wf testMichael Goulet-10/+51
2023-06-30RPITITs inherit method predicatesMichael Goulet-5/+1
2023-06-30Rollup merge of #113171 - spastorino:new-rpitit-25, r=compiler-errorsMatthias Krüger-0/+19
Properly implement variances_of for RPITIT GAT This fixes some of the issues found by crater run in https://github.com/rust-lang/rust/pull/112988#issuecomment-1610019572 r? ``@compiler-errors``
2023-06-30Rollup merge of #113165 - compiler-errors:rpitits-foreign-bounds, r=spastorinoMatthias Krüger-0/+4
Encode item bounds for `DefKind::ImplTraitPlaceholder` This was lost in a refactoring -- `hir::ItemKind::OpaqueTy` doesn't always map to `DefKind::Opaque`, specifically for RPITITs, so the check was migrated subtly wrong, and unfortunately I never had a test for this 🙃 Fixes #113155 r? ``@cjgillot``
2023-06-30Rollup merge of #113071 - ↵Matthias Krüger-9/+3
compiler-errors:no-parent-non-lifetime-args-in-apit, r=eholk Account for late-bound vars from parent arg-position impl trait We should be reporting an error like we do for late-bound args coming from a parent APIT. Fixes #113016
2023-06-30Adapt tests from #105258Michael Goulet-6/+151
2023-06-30Flip the order of binder instantiation for better diagnosticsMichael Goulet-13/+7
2023-06-30Error for RPITIT hidden tys that capture more than their trait defnMichael Goulet-17/+21
2023-06-29Properly implement variances_of for RPITIT GATSantiago Pastorino-0/+19
2023-06-29Encode item bounds for DefKind::ImplTraitPlaceholderMichael Goulet-0/+4
2023-06-27Don't sort strings right after we just sorted by typesMichael Goulet-2/+2
2023-06-27More testsMichael Goulet-0/+27
2023-06-26migrate lifetime tooMichael Goulet-9/+3
2023-06-25Rollup merge of #113036 - TaKO8Ki:fix-112094, r=compiler-errorsMatthias Krüger-0/+12
Accept `ReStatic` for RPITIT Fixes #112094 Regression in https://github.com/rust-lang/rust/commit/8216b7f22934cea2422c79565df9c30ac8db93e0 If there is a better suggestion, I will go with that.
2023-06-26accept `ReStatic` for RPITITTakayuki Maeda-0/+12
add an ui test for #112094
2023-06-22Handle weak type aliases by immediately resolving them to their aliased typeOli Scherer-5/+0
2023-06-22Point to argument/return type instead of the whole function headerOli Scherer-8/+8
2023-06-21Liberate bound vars properly when suggesting missing AFITMichael Goulet-4/+12
2023-06-19Rollup merge of #112596 - compiler-errors:missing-sig-with-rpitit, r=b-naberMichael Goulet-0/+59
Suggest correct signature on missing fn returning RPITIT/AFIT Add `async` and unpeel the future's output type if the function is async Fixes #108195
2023-06-18Treat TAIT equation as always ambiguous in coherenceMichael Goulet-0/+45
2023-06-16Add `AliasKind::Weak` for type aliases.Oli Scherer-30/+23
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-06-14Error on unconstrained lifetime in RPITITMichael Goulet-79/+135
2023-06-13Suggest correct signature on missing fn returning RPITIT/AFITMichael Goulet-0/+59
2023-06-11Don't suggest boxing an empty if/else armMichael Goulet-0/+25
2023-06-01Rollup merge of #111980 - compiler-errors:unmapped-substs, r=lcnrDylan DPC-76/+6
Preserve substs in opaques recorded in typeck results This means that we now prepopulate MIR with opaques with the right substs. The first commit is a hack that I think we discussed, having to do with `DefiningAnchor::Bubble` basically being equivalent to `DefiningAnchor::Error` in the new solver, so having to use `DefiningAnchor::Bind` instead, lol. r? `@lcnr`
2023-05-31Check that RPITs are compatible with the opaques inferred during HIR typeck tooMichael Goulet-76/+6
2023-05-27Check nested obligations during coercion unifyMichael Goulet-0/+2
2023-05-26Rollup merge of #111947 - obeis:issue-111943, r=compiler-errorsMatthias Krüger-0/+38
Add test for RPIT defined with different hidden types with different substs Close #111943
2023-05-26Add test for RPIT defined with different hidden types with different substsObei Sideg-0/+38
2023-05-25Don't print newlines in APITsMichael Goulet-0/+44
2023-05-18Remove return type sized check hack from hir typeckMichael Goulet-51/+5
2023-05-18Simplify suggestion when returning bare dyn traitMichael Goulet-90/+84
2023-05-16Use error term if missing associated item in new solverMichael Goulet-1/+15
2023-05-13improve error for `impl<..> impl Trait for Type`y21-0/+64
2023-05-13Rollup merge of #111451 - compiler-errors:note-cast-origin, r=b-naberDylan DPC-4/+2
Note user-facing types of coercion failure When coercing, for example, `Box<A>` into `Box<dyn B>`, make sure that any failure notes mention *those* specific types, rather than mentioning inner types, like "the cast from `A` to `dyn B`". I expect end-users are often confused when we skip layers of types and only mention the "innermost" part of a coercion, especially when other notes point at HIR, e.g. #111406.
2023-05-12Use the opaque_types_defined_by query to cheaply check for whether a hidden ↵Oli Scherer-0/+134
type may be registered for an opaque type