rust/tests
Matthias Krüger a8bd0c04b4
Rollup merge of #106167 - yanchen4791:issue-105544-fix, r=oli-obk
Fix invalid syntax and incomplete suggestion in impl Trait parameter type suggestions for E0311

Fixes #105544

The problems: The suggestion given for E0311 has invalid syntax when the synthetic type parameter is used for Trait type in function declaration:
```rust
fn foo(d: impl Sized) -> impl Sized
```
instead of explicitly specified like the following:
```rust
fn foo<T: Sized>(d: T) -> impl Sized
```
In addition to the syntax error, the suggestions given for E0311 are not complete when multiple elided lifetimes are involved in lifetime bounds, not all involved parameters are given the named lifetime in the suggestions. For the following test case:
```
fn foo(d: impl Sized, p: &mut ()) -> impl Sized + '_ {
    (d, p)
}
```
a good suggestion should add the lifetime 'a to both d and p, instead of d only:
```
fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ {
    (d, p)
}
```

The Solution: Fix the syntax problem in the suggestions when synthetic type parameter is used, and also add lifetimes for all involved parameters.
2023-01-12 06:52:34 +01:00
..
assembly Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
auxiliary
codegen Add a regression test for argument copies with DestinationPropagation 2023-01-11 10:27:06 -05:00
codegen-units
debuginfo
incremental
mir-opt Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
pretty Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
run-make Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
run-make-fulldeps Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
run-pass-valgrind
rustdoc
rustdoc-gui Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
rustdoc-js
rustdoc-js-std
rustdoc-json
rustdoc-ui Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
ui Rollup merge of #106167 - yanchen4791:issue-105544-fix, r=oli-obk 2023-01-12 06:52:34 +01:00
ui-fulldeps
COMPILER_TESTS.md