-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
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 RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(hint_must_use)]
This is a tracking issue for the function core::hint::must_use
Public API
// core::hint
#[must_use]
pub const fn must_use<T>(value: T) -> T {
value
}
Steps / History
- Implementation: Add core::hint::must_use #94723
- Final comment period (FCP)
- Stabilization PR
Unresolved Questions
-
Alternative:
#[must_use]
on an arbitrary block or expression?#[must_use] { some_expr }
This feels more native, and might behave slightly better in some subtle edge cases—type inference may not always 'see through' the identity function in terms of whether unsize coercions occur before or after the call, whereas through a block that isn't an issue.
Blocked on Tracking issue for stmt_expr_attributes: Add attributes to expressions, etc. #15701.
-
Alternative:
#[must_use]
integrated into macro_rules, perhaps on each arm, or on the whole macro, perhaps with a lint or error if the macro does not produce an expression.
joseluis
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 RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.