mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
689511047a
`#[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. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl |