about summary refs log tree commit diff
path: root/tests/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2023-03-21Rollup merge of #109240 - compiler-errors:dont-binder-twice, r=oli-obknils-0/+6
Walk un-shifted nested `impl Trait` in trait when setting up default trait method assumptions Fixes a double subtraction in some binder math in return-position `impl Trait` in trait handling code. Fixes #109239
2023-03-20Rollup merge of #109277 - spastorino:new-rpitit-14, r=compiler-errorsMatthias Krüger-1/+24
Fix generics_of for impl's RPITIT synthesized associated type The only useful commit is the last one. This makes `generics_of` for the impl side RPITIT copy from the trait's associated type and avoid the fn on the impl side which was previously wrongly used. This solution is better but we still need to fix resolution of the generated generics. r? ``@compiler-errors``
2023-03-20Walk un-shifted nested `impl Trait` in trait when setting up default trait ↵Michael Goulet-0/+6
method assumptions
2023-03-18Rollup merge of #109238 - spastorino:new-rpitit-12, r=compiler-errorsMatthias Krüger-1/+16
Fix generics mismatch errors for RPITITs on -Zlower-impl-trait-in-trait-to-assoc-ty This PR stops reporting errors due to different count of generics on the new synthesized associated types for RPITITs. Those were already reported when we compare the function on the triat with the function on the impl. r? ``@compiler-errors``
2023-03-17Fix generics_of for impl's RPITIT synthesized associated typeSantiago Pastorino-0/+8
2023-03-17Fix impl_trait_ty_to_ty substsSantiago Pastorino-1/+16
2023-03-17Add revisions for -Zlower-impl-trait-in-trait-to-assoc-ty fixed testsSantiago Pastorino-5/+51
2023-03-17Fix generics mismatch errors for RPITITs on ↵Santiago Pastorino-1/+16
-Zlower-impl-trait-in-trait-to-assoc-ty
2023-03-16Don't install default opaque projection predicates in RPITIT associated ↵Michael Goulet-3/+46
type's param-env
2023-03-16Install projection from RPITIT to default trait method opaque correctlyMichael Goulet-1/+14
2023-03-15Add revisions to fixed tests in -Zlower-impl-trait-in-trait-to-assoc-tySantiago Pastorino-7/+90
2023-03-14Rollup merge of #108923 - spastorino:new-rpitit-9, r=compiler-errorsMatthias Krüger-0/+2
Make fns from other crates with RPITIT work for -Zlower-impl-trait-in-trait-to-assoc-ty Only the last two commits are meaningful. r? `@compiler-errors`
2023-03-14Rollup merge of #108909 - spastorino:new-rpitit-7, r=compiler-errorsMatthias Krüger-9/+98
Fix object safety checks for new RPITITs This one goes on top of #108869 r? `@compiler-errors`
2023-03-14Rollup merge of #108880 - spastorino:new-rpitit-6, r=compiler-errorsMatthias Krüger-36/+91
Remove tests/ui/impl-trait/in-trait/new-lowering-strategy in favor of using revisions on existing tests r? `@compiler-errors` This one again sits on top of existing approved PRs and it still needs to add revisions to tests in `tests/ui/impl-trait/in-trait` as it only does so for async in traits.
2023-03-14Make fns from other crates with RPITIT workSantiago Pastorino-0/+2
2023-03-14Auto merge of #104833 - Swatinem:async-identity-future, r=compiler-errorsbors-13/+27
Remove `identity_future` indirection This was previously needed because the indirection used to hide some unexplained lifetime errors, which it turned out were related to the `min_choice` algorithm. Removing the indirection also solves a couple of cycle errors, large moves and makes async blocks support the `#[track_caller]`annotation. Fixes https://github.com/rust-lang/rust/issues/104826.
2023-03-12Fix object safety checks for new RPITITsSantiago Pastorino-6/+59
2023-03-12Filter out RPITITs in astconv when checking for missing associated typesSantiago Pastorino-3/+39
2023-03-12Run existing impl trait in traits tests using ↵Santiago Pastorino-8/+91
-Zlower-impl-trait-in-trait-to-assoc-ty
2023-03-12Remove tests/ui/impl-trait/in-trait/new-lowering-strategy in favor of using ↵Santiago Pastorino-28/+0
revisions on existing tests
2023-03-12Auto merge of #108700 - spastorino:new-rpitit-impl-side-2, r=compiler-errorsbors-0/+17
Make RPITITs simple cases work when using lower_impl_trait_in_trait_to_assoc_ty r? `@compiler-errors` It's probably best reviewed commit by commit.
2023-03-08Remove `identity_future` indirectionArpad Borsos-13/+27
This was previously needed because the indirection used to hide some unexplained lifetime errors, which it turned out were related to the `min_choice` algorithm. Removing the indirection also solves a couple of cycle errors, large moves and makes async blocks support the `#[track_caller]` annotation.
2023-03-07Rollup merge of #108583 - ↵Matthias Krüger-0/+25
compiler-errors:rpitit-default-method-with-nested-rpitits, r=spastorino Account for binders correctly when adding default RPITIT method assumption As of #108203, we install extra projection predicates into the param-env of a default trait method when it has return-position `impl Trait` (or is async). The implementation didn't account for the fact that it's walking into and out of binders, so we just need to shift all the debruijn indices accordingly when constructing the projection predicates. Fixes #108579 r? types
2023-03-06Add simple impl trait test for RPITITSantiago Pastorino-0/+17
2023-03-05Rollup merge of #108764 - cjgillot:dpm-adapt, r=compiler-errorsMatthias Krüger-0/+3
Tweaks to -Zdrop-tracking-mir Split from https://github.com/rust-lang/rust/pull/107421 3 commits: 1 diagnostic improvement and 2 ICEs.
2023-03-05drop_tracking_mir: diagnose recursive generator.Camille GILLOT-0/+3
2023-03-04Don't project to RPITIT that has no default valueMichael Goulet-0/+37
2023-03-03Rollup merge of #108292 - compiler-errors:opaque-captures-where, r=oli-obkMatthias Krüger-13/+38
Label opaque type for 'captures lifetime' error message Providing more information may help make this somewhat opaque (lol) error message a bit clearer.
2023-03-03Label opaque type for 'captures lifetime' error messageMichael Goulet-13/+38
2023-03-02Add simple trait testSantiago Pastorino-0/+11
2023-02-28Shift vars for default RPITIT methods correctlyMichael Goulet-0/+25
2023-02-28Descriptive error when users try to combine RPITIT/AFIT with specializationMichael Goulet-1/+10
2023-02-24Rollup merge of #108401 - notriddle:notriddle/diagnostics-article, ↵Dylan DPC-2/+2
r=compiler-errors diagnostics: remove inconsistent English article "this" from E0107 Consider [`tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`][issue-102768.stderr], the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in [`tests/ui/lint/dead-code/issue-85255.stderr`][issue-85255.stderr]. They don't have articles, so it seems unnecessary to have one here. [issue-102768.stderr]: https://github.com/rust-lang/rust/blob/07c993eba8b76eae497e98433ae075b00f01be10/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr [issue-85255.stderr]: https://github.com/rust-lang/rust/blob/07c993eba8b76eae497e98433ae075b00f01be10/tests/ui/lint/dead-code/issue-85255.stderr
2023-02-23diagnostics: remove inconsistent English article "this" from E0107Michael Howell-2/+2
Consider `tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`, the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in `tests/ui/lint/dead-code/issue-85255.stderr`. They don't have articles, so it seems unnecessary to have one here.
2023-02-23Rollup merge of #108063 - ↵Matthias Krüger-52/+52
compiler-errors:associated-type-bounds-in-bad-position, r=cjgillot Ban associated type bounds in bad positions We should not try to lower associated type bounds into TAITs in positions where `impl Trait` is not allowed (except for in `where` clauses, like `where T: Trait<Assoc: Bound>`). This is achieved by using the same `rustc_ast_lowering` machinery as impl-trait does to characterize positions as universal/existential/disallowed. Fixes #106077 Split out the first commit into #108066, since it's not really related.
2023-02-22pluralize stuffMichael Goulet-52/+52
2023-02-22Normalize line+col in normalize-tait-in-const testAlan Egerton-1/+2
2023-02-22Remove type-traversal trait aliasesAlan Egerton-1/+1
2023-02-22Convert a hard-warning about named static lifetimes into lint "unused_lifetimes"Zhi Qi-11/+0
Define the `named_static_lifetimes` lint This lint will replace the existing hard-warning. Replace the named static lifetime hard-warning with the new lint Update the UI tests for the `named_static_lifetimes` lint Remove the direct dependency on `rustc_lint_defs` fix build Signed-off-by: Zhi Qi <qizhi@pingcap.com> use "UNUSED_LIFETIMES" instead Signed-off-by: Zhi Qi <qizhi@pingcap.com> update 1 test and fix typo Signed-off-by: Zhi Qi <qizhi@pingcap.com> update tests Signed-off-by: Zhi Qi <qizhi@pingcap.com> fix tests: add extra blank line Signed-off-by: Zhi Qi <qizhi@pingcap.com>
2023-02-21Add a test for default trait method with RPITITsMichael Goulet-0/+28
2023-02-16Remove save-analysis.Nicholas Nethercote-2/+0
Most tests involving save-analysis were removed, but I kept a few where the `-Zsave-analysis` was an add-on to the main thing being tested, rather than the main thing being tested. For `x.py install`, the `rust-analysis` target has been removed. For `x.py dist`, the `rust-analysis` target has been kept in a degenerate form: it just produces a single file `reduced.json` indicating that save-analysis has been removed. This is necessary for rustup to keep working. Closes #43606.
2023-02-14Better label for illegal impl trait typesMichael Goulet-20/+20
2023-02-13Rollup merge of #107942 - compiler-errors:tighter-inherent-impl-bad-spans, ↵Matthias Krüger-2/+2
r=Nilstrieb Tighter spans for bad inherent `impl` self types Self-explanatory
2023-02-13Rollup merge of #107902 - vincenzopalazzo:macros/async_fn_suggestion, ↵Matthias Krüger-6/+7
r=compiler-errors fix: improve the suggestion on future not awaited Considering the following code ```rust fn foo() -> u8 { async fn async_fn() -> u8 { 22 } async_fn() } fn main() {} ``` the error generated before this commit from the compiler is ``` ➜ rust git:(macros/async_fn_suggestion) ✗ rustc test.rs --edition 2021 error[E0308]: mismatched types --> test.rs:4:5 | 1 | fn foo() -> u8 { | -- expected `u8` because of return type ... 4 | async_fn() | ^^^^^^^^^^ expected `u8`, found opaque type | = note: expected type `u8` found opaque type `impl Future<Output = u8>` help: consider `await`ing on the `Future` | 4 | async_fn().await | ++++++ error: aborting due to previous error ``` In this case the error is nor perfect, and can confuse the user that do not know that the opaque type is the future. So this commit will propose (and conclude the work start in https://github.com/rust-lang/rust/issues/80658) to change the string `opaque type` to `future` when applicable and also remove the Expected vs Received note by adding a more specific one regarding the async function that return a future type. So the new error emitted by the compiler is ``` error[E0308]: mismatched types --> test.rs:4:5 | 1 | fn foo() -> u8 { | -- expected `u8` because of return type ... 4 | async_fn() | ^^^^^^^^^^ expected `u8`, found future | note: calling an async function returns a future --> test.rs:4:5 | 4 | async_fn() | ^^^^^^^^^^ help: consider `await`ing on the `Future` | 4 | async_fn().await | ++++++ error: aborting due to previous error ``` Fixes https://github.com/rust-lang/rust/issues/80658 It remains to rework the case described in the following issue https://github.com/rust-lang/rust/issues/107899 but I think this deserves its own PR after we discuss a little bit how to handle these kinds of cases. r? `@eholk` `@rustbot` label +I-async-nominated Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-13Tighter spans for bad inherent impl typesMichael Goulet-2/+2
2023-02-13fix: improve the suggestion on future not awaitedVincenzo Palazzo-6/+7
Considering the following code ```rust fn foo() -> u8 { async fn async_fn() -> u8 { 22 } async_fn() } fn main() {} ``` the error generated before this commit from the compiler is ``` ➜ rust git:(macros/async_fn_suggestion) ✗ rustc test.rs --edition 2021 error[E0308]: mismatched types --> test.rs:4:5 | 1 | fn foo() -> u8 { | -- expected `u8` because of return type ... 4 | async_fn() | ^^^^^^^^^^ expected `u8`, found opaque type | = note: expected type `u8` found opaque type `impl Future<Output = u8>` help: consider `await`ing on the `Future` | 4 | async_fn().await | ++++++ error: aborting due to previous error ``` In this case the error is nor perfect, and can confuse the user that do not know that the opaque type is the future. So this commit will propose (and conclude the work start in https://github.com/rust-lang/rust/issues/80658) to change the string `opaque type` to `future` when applicable and also remove the Expected vs Received note by adding a more specific one regarding the async function that return a future type. So the new error emitted by the compiler is ``` error[E0308]: mismatched types --> test.rs:4:5 | 1 | fn foo() -> u8 { | -- expected `u8` because of return type ... 4 | async_fn() | ^^^^^^^^^^ expected `u8`, found future | note: calling an async function returns a future --> test.rs:4:5 | 4 | async_fn() | ^^^^^^^^^^ help: consider `await`ing on the `Future` | 4 | async_fn().await | ++++++ error: aborting due to previous error ``` Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-1/+1
2023-02-10revert #107074lcnr-1/+4
2023-02-09Introduce `ReError`Esteban Küber-2/+2
CC #69314
2023-02-07Tweak ICE messageEsteban Küber-3/+1
Modify main message to be more conversational and emit one fewer note.