granite-rust/compiler
bors a6ece56152 Auto merge of #86400 - FabianWolff:issue-85735, r=estebank
Remove invalid suggestion involving `Fn` trait bound

This pull request closes #85735. The actual issue is a duplicate of #21974, but #85735 contains a further problem, which is an invalid suggestion if `Fn`/`FnMut`/`FnOnce` trait bounds are involved: The suggestion code checks whether the trait bound ends with `>` to determine whether it has any generic arguments, but the `Fn*` traits have a special syntax for generic arguments that doesn't involve angle brackets. The example given in #85735:
```rust
trait Foo {}
impl<'a, 'b, T> Foo for T
where
    T: FnMut(&'a ()),
    T: FnMut(&'b ()), {

    }
```
currently produces:
```
error[E0283]: type annotations needed
   --> src/lib.rs:4:8
    |
4   |       T: FnMut(&'a ()),
    |          ^^^^^^^^^^^^^ cannot infer type for type parameter `T`
    |
    = note: cannot satisfy `T: FnMut<(&'a (),)>`
help: consider specifying the type arguments in the function call
    |
4   |     T: FnMut(&'a ())::<Self, Args>,
    |                     ^^^^^^^^^^^^^^

error: aborting due to previous error
```
which is incorrect, because there is no function call, and applying the suggestion would lead to a parse error. With my changes, I get:
```
error[E0283]: type annotations needed
   --> test.rs:4:8
    |
4   |     T: FnMut(&'a ()),
    |        ^^^^^^^^^^^^^ cannot infer type for type parameter `T`
    |
   ::: [...]/library/core/src/ops/function.rs:147:1
    |
147 | pub trait FnMut<Args>: FnOnce<Args> {
    | ----------------------------------- required by this bound in `FnMut`
    |
    = note: cannot satisfy `T: FnMut<(&'a (),)>`

error: aborting due to previous error
```
i.e. I have added a check to prevent the invalid suggestion from being issued for `Fn*` bounds, while the underlying issue #21974 remains for now.
2021-08-03 19:48:54 +00:00
..
rustc rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_apfloat rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_arena rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_ast Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_ast_lowering Rollup merge of #87687 - camsteffen:inline-macros, r=oli-obk 2021-08-02 09:36:54 -05:00
rustc_ast_passes rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_ast_pretty Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_attr rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_builtin_macros rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_codegen_cranelift Auto merge of #87515 - crlf0710:trait_upcasting_part2, r=bjorn3 2021-08-03 16:58:56 +00:00
rustc_codegen_llvm Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_codegen_ssa Auto merge of #87515 - crlf0710:trait_upcasting_part2, r=bjorn3 2021-08-03 16:58:56 +00:00
rustc_data_structures rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_driver Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_error_codes Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_errors Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_expand Auto merge of #87262 - dtolnay:negative, r=Aaron1011 2021-08-03 04:50:28 +00:00
rustc_feature Rollup merge of #86176 - nbdd0121:explicit-generic-args, r=jackh726 2021-08-02 09:36:49 -05:00
rustc_fs_util rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_graphviz rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_hir Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_hir_pretty Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_incremental rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_index rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_infer Do not suggest impl traits as type arguments 2021-08-03 20:05:50 +09:00
rustc_interface rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_lexer Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_lint Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_lint_defs Validate that naked functions are never inlined 2021-08-02 21:49:51 -04:00
rustc_llvm Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_macros Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_metadata rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_middle Auto merge of #87515 - crlf0710:trait_upcasting_part2, r=bjorn3 2021-08-03 16:58:56 +00:00
rustc_mir Auto merge of #87515 - crlf0710:trait_upcasting_part2, r=bjorn3 2021-08-03 16:58:56 +00:00
rustc_mir_build Rollup merge of #87645 - LeSeulArtichaut:issue-87414, r=oli-obk 2021-08-03 19:07:43 +09:00
rustc_parse Rollup merge of #87646 - JohnTitor:fix-parser-ice, r=oli-obk 2021-08-03 19:07:44 +09:00
rustc_parse_format rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_passes Validate that naked functions are never inlined 2021-08-02 21:49:51 -04:00
rustc_plugin_impl rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_privacy rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_query_impl Auto merge of #87515 - crlf0710:trait_upcasting_part2, r=bjorn3 2021-08-03 16:58:56 +00:00
rustc_query_system Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_resolve Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_save_analysis Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_serialize rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_session Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_span Auto merge of #87262 - dtolnay:negative, r=Aaron1011 2021-08-03 04:50:28 +00:00
rustc_symbol_mangling Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_target Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_trait_selection Auto merge of #86400 - FabianWolff:issue-85735, r=estebank 2021-08-03 19:48:54 +00:00
rustc_traits Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum 2021-08-02 05:49:17 +00:00
rustc_ty_utils rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_type_ir rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_typeck Auto merge of #86338 - JohnTitor:issue-86162, r=estebank 2021-08-03 13:23:31 +00:00