Skip to content

Mention type placeholders in the manual and tutorial #12891

Closed
@Kimundi

Description

@Kimundi
Member

#12764 landed, but didn't include docs for the feature.

The manual and tutorial should mention it in the context of type inference, and give a proper explanation:

  • _ in a type is a "type placeholder" and has the meaning "infer this type".
  • Type placeholders are not allowed in item signatures, because global inference is not allowed by design.
  • Patterns like Vec<_> are called "partial type hints" and are useful in combination with things like collect() on iterators.

Activity

steveklabnik

steveklabnik commented on Aug 21, 2014

@steveklabnik
Member

The manual should have this, but I don't want to add it to the Guide.

steveklabnik

steveklabnik commented on Nov 25, 2014

@steveklabnik
Member

I want to do this, but I'm not sure where it fits in the Reference...

added a commit that references this issue on Feb 13, 2015
6647d83
added a commit that references this issue on Aug 2, 2022

Auto merge of rust-lang#12891 - brennanvincent:expander_stack, r=lnicola

added a commit that references this issue on Jun 13, 2024

Auto merge of rust-lang#12891 - paultag:paultag/fix-lint-description,…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @flaper87@steveklabnik@sanxiyn@Kimundi

      Issue actions

        Mention type placeholders in the manual and tutorial · Issue #12891 · rust-lang/rust