rust/src/test
Esteban Küber e5f83bcd04 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 part of #34255.
2020-10-07 13:40:52 -07:00
..
assembly Auto merge of #77008 - fortanix:raoul/lvi-tests, r=Mark-Simulacrum 2020-09-28 03:28:04 +00:00
auxiliary
codegen Auto merge of #77466 - Aaron1011:reland-drop-tree, r=matthewjasper 2020-10-05 00:35:58 +00:00
codegen-units Move from {{closure}}#0 syntax to {closure#0} for (def) path components 2020-09-25 22:46:14 +01:00
compile-fail Update compile-fail test 2020-09-29 19:45:06 -07:00
debuginfo debuginfo: Ignore HashMap tests before cdb 10.0.18362.1 2020-09-05 14:47:16 -07:00
incremental Remove predicates on associated types from traits 2020-10-06 11:19:31 +01:00
mir-opt Fix tests from rebase 2020-10-06 11:19:33 +01:00
pretty pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
run-make cleaning up code 2020-09-25 15:13:55 +02:00
run-make-fulldeps Renamed tests to avoid exceeding Windows max path limit 2020-10-05 09:40:25 -07:00
run-pass-valgrind
rustdoc Auto merge of #77253 - jyn514:crate-link, r=Manishearth 2020-09-29 12:11:17 +00:00
rustdoc-js Allow #[doc(alias)] on impl const items 2020-08-12 11:09:24 +02:00
rustdoc-js-std
rustdoc-ui Auto merge of #77119 - GuillaumeGomez:unclosed-html-tag-lint, r=jyn514 2020-10-07 09:56:51 +00:00
rustfix
ui Detect blocks that could be struct expr bodies 2020-10-07 13:40:52 -07:00
ui-fulldeps Rollup merge of #76474 - bjorn3:driver_selected_codegen, r=oli-obk 2020-09-28 18:39:40 +02:00
COMPILER_TESTS.md