Skip to content

Tracking issue for '_ #48469

Closed
Closed
@nikomatsakis

Description

@nikomatsakis

This is a sub-issue of #44524, tracking the desire to stabilize '_ (and the lints around its usage).

Covered areas

The '_ can be used anywhere that a region can be elided. It (typically) carries the same meaning as having no region at all. This section summarizes its usage, giving pointers to tests, and also listing known blocking issues.

  • fn foo(x: Ref<'_>) -- fresh name
  • fn foo(&self) -> Ref<'_> -- links to self
  • fn foo(&self) -> Box<dyn Debug + '_> -- links to self, not quite the same as Box<dyn Debug>
  • fn foo(&self) -> Box<impl Debug + '_> -- links to self, not quite the same as Box<impl Debug>

Some areas where elision ought to be supported are not yet:

There are also several linted scenarios to nudge the user in the right direction:

Changes or clarifications to the RFC

The behavior around dyn Trait is probably worth highlighting, since it is one case where '_ differs from writing nothing at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language team, which will review and decide on the PR/issue.final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions