summary refs log tree commit diff
path: root/tests/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
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-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.
2023-02-03Rollup merge of #107585 - compiler-errors:fndef-sig-cycle, r=oli-obkDylan DPC-2/+2
Don't cause a cycle when formatting query description that references a FnDef When a function returns `-> _`, we use typeck to compute what the resulting type of the body _should_ be. If we call another query inside of typeck and hit a cycle error, we attempt to report the cycle error which requires us to compute all of the query descriptions for the stack. However, if one of the queries in that cycle has a query description that references this function as a FnDef type, we'll cause a *second* cycle error from within the cycle error reporting code, since rendering a FnDef requires us to compute its signature. This causes an unwrap to ICE, since during the *second* cycle reporting code, we try to look for a job that isn't in the active jobs list. We can avoid this by using `with_no_queries!` when computing these query descriptions. Fixes #107089 The only drawback is that the rendering of opaque types in cycles regresses a bit :| I'm open to alternate suggestions about how we may handle this...
2023-02-02Rollup merge of #107201 - compiler-errors:confusing-async-fn-note, r=estebankMatthias Krüger-20/+0
Remove confusing 'while checking' note from opaque future type mismatches Maybe I'm just misinterpreting the wording of the note. The only value I can see in this note is that it points out where the async's opaque future is coming from, but the way it's doing it is misleading IMO. For example: ```rust note: while checking the return type of the `async fn` --> $DIR/dont-suggest-missing-await.rs:7:24 | LL | async fn make_u32() -> u32 { | ^^^ checked the `Output` of this `async fn`, found opaque type ``` We point at the type `u32` in the HIR, but then say "found opaque type". We also say "while checking"... but we're typechecking a totally different function when we get this type mismatch! r? ``@estebank`` but feel free to reassign and/or take your time reviewing this. I'd be inclined to also discuss reworking the presentation of this type mismatch to restore some of these labels in a way that makes it more clear what it's trying to point out.
2023-02-02Don't cause a cycle when formatting query description that references a FnDefMichael Goulet-2/+2
2023-01-30Mention fn coercion rules (needs to be expanded)Esteban Küber-0/+2
2023-01-30Tweak use of trimmed pathsEsteban Küber-8/+8
2023-01-30Do not mention lifetime names in force trimmed pathsEsteban Küber-2/+2
2023-01-30Modify primary span label for E0308Esteban Küber-23/+23
The previous output was unintuitive to users.
2023-01-27Bless tests.Camille GILLOT-13/+12
2023-01-27Test the 3 generator handling versions for generator/async tests.Camille GILLOT-21/+356
2023-01-25Rollup merge of #106897 - estebank:issue-99430, r=davidtwcoMatthias Krüger-0/+3
Tweak E0597 CC #99430
2023-01-22Remove confusing 'while checking' note from opaque future type mismatchesMichael Goulet-20/+0
2023-01-21Label closure captures/generator locals that make opaque types recursiveMichael Goulet-0/+46
2023-01-18Auto merge of #106503 - cjgillot:remap-nofilter, r=oli-obkbors-0/+39
Do not filter substs in `remap_generic_params_to_declaration_params`. The relevant filtering should have been performed by borrowck. Fixes https://github.com/rust-lang/rust/issues/105826 r? types
2023-01-15Tweak E0597Esteban Küber-0/+3
CC #99430
2023-01-13Rollup merge of #106585 - estebank:issue-46585, r=compiler-errorsMatthias Krüger-6/+5
When suggesting writing a fully qualified path probe for appropriate types Address the more common part of #46585.
2023-01-12Auto merge of #106760 - compiler-errors:rollup-0bogyco, r=compiler-errorsbors-4/+8
Rollup of 8 pull requests Successful merges: - #103236 (doc: rewrite doc for signed int::{carrying_add,borrowing_sub}) - #103800 (Stabilize `::{core,std}::pin::pin!`) - #106097 (Migrate mir_build diagnostics 2 of 3) - #106170 (Move autoderef to `rustc_hir_analysis`) - #106323 (Stabilize f16c_target_feature) - #106360 (Tweak E0277 `&`-removal suggestions) - #106524 (Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch) - #106739 (Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-11Rollup merge of #106360 - estebank:remove-borrow-suggestion, r=compiler-errorsMichael Goulet-4/+8
Tweak E0277 `&`-removal suggestions Fix #64068, fix #84837.
2023-01-12Rollup merge of #106702 - estebank:trait-bounds, r=compiler-errorsMatthias Krüger-2/+7
Conserve cause of `ImplDerivedObligation` in E0599 CC #86377.
2023-01-12Rollup merge of #106596 - estebank:verbose-e0271, r=compiler-errorsMatthias Krüger-4/+4
Hide more of long types in E0271 Fix #40186.
2023-01-11Hide more of long types in E0271Esteban Küber-4/+4
Fix #40186.
2023-01-11Make `&`-removal suggestion verboseEsteban Küber-4/+8
2023-01-11When suggesting writing a fully qualified path probe for appropriate typesEsteban Küber-6/+5
Fix #46585.
2023-01-11Note predicate span on ImplDerivedObligationMichael Goulet-3/+7
2023-01-11Conserve cause of `ImplDerivedObligation` in E0599Esteban Küber-2/+7
CC #86377.
2023-01-11Do not filter substs in `remap_generic_params_to_declaration_params`.Camille GILLOT-0/+39
The relevant filtering should have been performed by borrowck.
2023-01-11Move /src/test to /testsAlbert Larsan-0/+11331