Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Tracking issue for std::hint::black_box #64102

Copy link
Copy link
@Centril

Description

@Centril
Issue body actions

This is a tracking issue for the RFC std::hint:_black_box.

Original RFC: RFC 2360

Public API:

// std::hint

pub fn black_box<T>(dummy: T) -> T;

Steps:

  • Implementation
  • FCP
  • Stabilization PR

Unresolved questions:

  • const fn: it is unclear whether bench_black_box should be a const fn. If it
    were, that would hint that it cannot have any side-effects, or that it cannot
    do anything that const fns cannot do.

  • Naming: during the RFC discussion it was unclear whether black_box is the
    right name for this primitive but we settled on bench_black_box for the time
    being. We should resolve the naming before stabilization.

    Also, we might want to add other benchmarking hints in the future, like
    bench_input and bench_output, so we might want to put all of this
    into a bench sub-module within the core::hint module. That might
    be a good place to explain how the benchmarking hints should be used
    holistically.

    Some arguments in favor or against using "black box" are that:

    • pro: [black box] is a common term in computer programming, that conveys
      that nothing can be assumed about it except for its inputs and outputs.
      con: [black box] often hints that the function has no side-effects, but
      this is not something that can be assumed about this API.
    • con: _box has nothing to do with Box or box-syntax, which might be confusing

    Alternative names suggested: pessimize, unoptimize, unprocessed, unknown,
    do_not_optimize (Google Benchmark).

LukasKalbertodt, mark-i-m, Timmmm, johannesvollmer, CodesInChaos and 12 moresffc and Kixunil

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.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 RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-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.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.