rust/compiler
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
..
rustc
rustc_abi Auto merge of #105446 - erikdesjardins:vt-size, r=nikic 2022-12-18 22:01:39 +00:00
rustc_apfloat compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_arena compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_ast Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_ast_lowering Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
rustc_ast_passes Allow impl ~const Trait opaque types 2022-12-15 11:26:15 +00:00
rustc_ast_pretty Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_attr Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_baked_icu_data
rustc_borrowck Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
rustc_builtin_macros Update format.rs 2023-01-02 15:51:54 +05:30
rustc_codegen_cranelift Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
rustc_codegen_gcc Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
rustc_codegen_llvm Rollup merge of #104543 - JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs-pt3, r=davidtwco 2023-01-07 20:43:19 +01:00
rustc_codegen_ssa Fix some typos in code comments. 2023-01-11 16:46:14 +01:00
rustc_const_eval Rollup merge of #106648 - Nilstrieb:poly-cleanup, r=compiler-errors 2023-01-11 17:30:55 +01:00
rustc_data_structures Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_driver Collect backtraces for delayed span-bugs too 2023-01-09 22:04:00 +00:00
rustc_error_codes remove E0280 and ICE instead 2023-01-10 03:04:28 +01:00
rustc_error_messages Auto merge of #106537 - fmease:recover-where-clause-before-tuple-struct-body, r=estebank 2023-01-12 02:16:16 +00:00
rustc_errors Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco 2023-01-11 17:30:54 +01:00
rustc_expand Shrink ParseResult in the hot path. 2023-01-05 20:42:26 +01:00
rustc_feature [RFC 2397] Initial implementation 2023-01-09 20:51:01 -03:00
rustc_fs_util Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
rustc_graphviz Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_hir fix typo LocalItemId -> ItemLocalId 2023-01-11 15:45:52 +03:00
rustc_hir_analysis Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
rustc_hir_pretty Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_hir_typeck Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
rustc_incremental rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00
rustc_index Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_infer Fix invalid syntax in impl Trait parameter type suggestions for E0311 2023-01-11 14:49:55 -08:00
rustc_interface Change type of box_noalias to bool 2023-01-10 10:14:59 +01:00
rustc_lexer Recover fn keyword as Fn trait in bounds 2022-12-27 06:14:46 +00:00
rustc_lint Auto merge of #105919 - uweigand:s390x-stack-overflow, r=Nilstrieb 2023-01-11 08:50:38 +00:00
rustc_lint_defs create helper function for rustc_lint_defs::Level and remove it's duplicated code r=ozkanonur 2023-01-10 10:56:17 +03:00
rustc_llvm Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_log Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_macros Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_metadata Use newtype for unused generic parameters 2023-01-09 19:10:00 +01:00
rustc_middle Rollup merge of #106648 - Nilstrieb:poly-cleanup, r=compiler-errors 2023-01-11 17:30:55 +01:00
rustc_mir_build Detect out of bounds range pattern value 2023-01-11 16:50:55 +00:00
rustc_mir_dataflow Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_mir_transform Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
rustc_monomorphize Delete unused polymorphization code 2023-01-09 19:10:00 +01:00
rustc_parse Auto merge of #106537 - fmease:recover-where-clause-before-tuple-struct-body, r=estebank 2023-01-12 02:16:16 +00:00
rustc_parse_format Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_passes Rename Rptr to Ref in AST and HIR 2022-12-28 18:52:36 +01:00
rustc_plugin_impl
rustc_privacy Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
rustc_query_impl Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_query_system Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_resolve Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
rustc_save_analysis rename get_parent_node to parent_id 2023-01-04 00:43:13 +00:00
rustc_serialize compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_session Rollup merge of #106709 - khuey:disable_split_dwarf_inlining_by_default, r=davidtwco 2023-01-11 17:30:56 +01:00
rustc_smir
rustc_span [RFC 2397] Initial implementation 2023-01-09 20:51:01 -03:00
rustc_symbol_mangling Add type flags support for Ty and Const late-bound regions 2023-01-08 03:37:20 +00:00
rustc_target Rollup merge of #106636 - djkoloski:accept_old_fuchsia_triple, r=tmandry 2023-01-10 08:05:35 +09:00
rustc_trait_selection Rollup merge of #106705 - compiler-errors:new-solver-err-properly, r=lcnr 2023-01-11 21:08:09 +01:00
rustc_traits Rollup merge of #106204 - compiler-errors:no-take-opaques-in-compare, r=oli-obk 2023-01-10 08:05:34 +09:00
rustc_transmute Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_ty_utils Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
rustc_type_ir Add type flags support for Ty and Const late-bound regions 2023-01-08 03:37:20 +00:00