Skip to content

Test functions with a lifetime parameter that return Results produce incorrect error message #55228

Closed
@sanmai-NL

Description

@sanmai-NL

This works:

#[test]
fn unit_1() -> Result<(), &'static str>
{
}

But this doesn’t:

#[test]
fn unit_1<'a>() -> Result<(), &'a str>
{
}
error: functions used as tests must have signature fn() -> ()
   --> crate/test.rs:162:5
    |
162 | /     fn unit_1<'a>() -> Result<(), &'a str>

Meta

rustc 1.31.0-nightly (46880f41b 2018-10-15)
binary: rustc
commit-hash: 46880f41b7aeb897b8245474196bba9dc11f0e88
commit-date: 2018-10-15
host: x86_64-unknown-linux-gnu
release: 1.31.0-nightly
LLVM version: 8.0

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-libtestArea: `#[test]` / the `test` libraryC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions