-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Stabilize unit tests with non-() return type #48854
Copy link
Copy link
Closed
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.Relevant to the dev-tools subteam, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamfinished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.Relevant to the dev-tools subteam, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamfinished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
CURRENT STATUS:
Awaiting someone to write the stabilization PR! Mentoring instructions here.
This is a sub-issue of the larger tracking issue devoted to the
?in main RFC. This issue corresponds to stabilizing the use of unit tests whose return type is something other than()-- it basically an extension of #48453, which was discussing the same thing but for themainfunction.What would be stabilized
As before, unit tests that return
():#[should_panic]However, unit tests can now have other return types:
TerminationtraitOkfromResult)(), then#[should_panic]is disallowedUnknowns
#[should_panic]and#[bench]anyway? (Example)Older proposal
Possible changes needed before stabilizing
#[should_panic]from#[should_error], as suggested by @scottmcm?What would be stabilized
Unit tests (and
#[bench]functions) would join themainfunction in being allowed to return any value that implements theTerminationtrait.This commits us to the following (each link is to a test):
Resultand otherTerminationtypes. In the case ofResult:Okmeans test passesErrcauses test failurereport(), although that detail is not being stabilized#[bench]is still effectively unstable though in generalWhat remains unstable