diff options
| author | bors <bors@rust-lang.org> | 2023-06-19 13:39:46 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-06-19 13:39:46 +0000 |
| commit | 689511047a75a30825e367d4fd45c74604d0b15e (patch) | |
| tree | 8132b93ba37d4920ed8a5f463587630e7f04a735 /compiler/rustc_builtin_macros/src/derive.rs | |
| parent | 18a6d911caba59605eb03db1452848a85d2e5879 (diff) | |
| parent | 5049743be2e278e48fcdbb8385820de6cc705cf5 (diff) | |
| download | rust-689511047a75a30825e367d4fd45c74604d0b15e.tar.gz rust-689511047a75a30825e367d4fd45c74604d0b15e.zip | |
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.
Diffstat (limited to 'compiler/rustc_builtin_macros/src/derive.rs')
0 files changed, 0 insertions, 0 deletions
