rust/compiler/rustc_builtin_macros
bors 689511047a Auto merge of #112366 - lukas-code:test, r=Nilstrieb
`#[test]` function signature verification improvements

This PR contains two improvements to the expansion of the `#[test]` macro.

The first one fixes https://github.com/rust-lang/rust/issues/112360 by correctly recovering item statements if the signature verification fails.

The second one forbids non-lifetime generics on `#[test]` functions. These were previously allowed if the function returned `()`, but always caused an inference error:

before:
```text
error[E0282]: type annotations needed
 --> src/lib.rs:2:1
  |
1 | #[test]
  | ------- in this procedural macro expansion
2 | fn foo<T>() {}
  | ^^^^^^^^^^^^^^ cannot infer type
```

after:
```text
error: functions used as tests can not have any non-lifetime generic parameters
 --> src/lib.rs:2:1
  |
2 | fn foo<T>() {}
  | ^^^^^^^^^^^^^^
```

Also includes some basic tests for test function signature verification, because I couldn't find any (???) in the test suite.
2023-06-19 13:39:46 +00:00
..
src Auto merge of #112366 - lukas-code:test, r=Nilstrieb 2023-06-19 13:39:46 +00:00
Cargo.toml Use GrowableBitSet to store positional indexes in asm! 2023-05-02 16:42:36 +01:00
messages.ftl Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00