rust/compiler
bors d9985fc108 Auto merge of #75470 - estebank:bare-type-expr, r=davidtwco
Detect blocks that could be struct expr bodies

This approach lives exclusively in the parser, so struct expr bodies
that are syntactically correct on their own but are otherwise incorrect
will still emit confusing errors, like in the following case:

```rust
fn foo() -> Foo {
    bar: Vec::new()
}
```

```
error[E0425]: cannot find value `bar` in this scope
 --> src/file.rs:5:5
  |
5 |     bar: Vec::new()
  |     ^^^ expecting a type here because of type ascription

error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
 --> src/file.rs:5:15
  |
5 |     bar: Vec::new()
  |               ^^^^^ only `Fn` traits may use parentheses

error[E0107]: wrong number of type arguments: expected 1, found 0
 --> src/file.rs:5:10
  |
5 |     bar: Vec::new()
  |          ^^^^^^^^^^ expected 1 type argument
  ```

If that field had a trailing comma, that would be a parse error and it
would trigger the new, more targetted, error:

```
error: struct literal body without path
 --> file.rs:4:17
  |
4 |   fn foo() -> Foo {
  |  _________________^
5 | |     bar: Vec::new(),
6 | | }
  | |_^
  |
help: you might have forgotten to add the struct literal inside the block
  |
4 | fn foo() -> Foo { Path {
5 |     bar: Vec::new(),
6 | } }
  |
```

Partially address last remaining part of #34255.
2020-10-08 01:37:27 +00:00
..
rustc
rustc_apfloat
rustc_arena
rustc_ast Auto merge of #76985 - hbina:clone_check, r=estebank 2020-10-07 21:51:12 +00:00
rustc_ast_lowering Separate bounds and predicates for associated/opaque types 2020-10-06 11:19:29 +01:00
rustc_ast_passes
rustc_ast_pretty
rustc_attr
rustc_builtin_macros Auto merge of #77595 - petrochenkov:asmident, r=oli-obk 2020-10-07 11:51:51 +00:00
rustc_codegen_llvm Let backends access span information 2020-10-06 15:39:12 +02:00
rustc_codegen_ssa Let backends access span information 2020-10-06 15:39:12 +02:00
rustc_data_structures Auto merge of #77080 - richkadel:llvm-coverage-counters-2, r=tmandry 2020-10-05 19:34:44 +00:00
rustc_driver
rustc_error_codes Auto merge of #77464 - ecstatic-morse:const-fn-impl-trait, r=oli-obk 2020-10-07 19:59:52 +00:00
rustc_errors
rustc_expand Detect blocks that could be struct expr bodies 2020-10-07 13:40:52 -07:00
rustc_feature Remove fn from feature name 2020-10-05 21:44:00 -07:00
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #77514 - scottmcm:less-once-chain-once, r=estebank 2020-10-05 02:29:42 +02:00
rustc_hir_pretty
rustc_incremental
rustc_index
rustc_infer Remove unused part of return value from replace_bound_vars_with_placeholders 2020-10-06 11:19:30 +01:00
rustc_interface
rustc_lexer
rustc_lint Auto merge of #77119 - GuillaumeGomez:unclosed-html-tag-lint, r=jyn514 2020-10-07 09:56:51 +00:00
rustc_llvm
rustc_macros
rustc_metadata Separate bounds and predicates for associated/opaque types 2020-10-06 11:19:29 +01:00
rustc_middle Update to chalk 0.31. Implement some unimplemented. Ignore some tests in compare mode chalk don't finish. 2020-10-06 14:14:25 -04:00
rustc_mir Auto merge of #77597 - simonvandel:uninhabited-hashset, r=jonas-schievink 2020-10-07 23:44:57 +00:00
rustc_mir_build Rollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr 2020-10-06 16:26:11 +09:00
rustc_parse Detect blocks that could be struct expr bodies 2020-10-07 13:40:52 -07:00
rustc_parse_format
rustc_passes Rollup merge of #76329 - GuillaumeGomez:doc-alias-crate-level, r=matthewjasper 2020-10-05 02:29:27 +02:00
rustc_plugin_impl
rustc_privacy Separate bounds and predicates for associated/opaque types 2020-10-06 11:19:29 +01:00
rustc_query_system
rustc_resolve Auto merge of #77341 - davidtwco:issue-73427-you-might-have-meant-variant, r=estebank 2020-10-07 15:37:47 +00:00
rustc_save_analysis
rustc_serialize
rustc_session Auto merge of #77119 - GuillaumeGomez:unclosed-html-tag-lint, r=jyn514 2020-10-07 09:56:51 +00:00
rustc_span Auto merge of #77464 - ecstatic-morse:const-fn-impl-trait, r=oli-obk 2020-10-07 19:59:52 +00:00
rustc_symbol_mangling Rollup merge of #77605 - da-x:fix-rustc-def-path, r=petrochenkov 2020-10-07 00:16:12 +02:00
rustc_target Support static linking with glibc and target-feature=+crt-static 2020-10-04 22:12:08 -07:00
rustc_trait_selection Fix tests from rebase 2020-10-06 11:19:33 +01:00
rustc_traits Update to chalk 0.31. Implement some unimplemented. Ignore some tests in compare mode chalk don't finish. 2020-10-06 14:14:25 -04:00
rustc_ty Move item_bounds to typeck::collect 2020-10-06 11:18:45 +01:00
rustc_typeck Fix tests from rebase 2020-10-06 11:19:33 +01:00