这是indexloc提供的服务,不要输入任何密码
Skip to content

Appendix B: "Generic parameter" vs "Generic type" inconsistency? #4550

@NeatNit

Description

@NeatNit
  • I have searched open and closed issues and pull requests for duplicates, using these search terms:
    • appendix generic
  • I have checked the latest main branch to see if this has already been fixed, in this file:
    • src/appendix-02-operators.md

URL to the section(s) of the book with this problem: https://doc.rust-lang.org/book/appendix-02-operators.html

Description of the problem:
In Table B-5, the terms "Generic parameter" and "Generic type" seem to be used interchangeably. Is there a difference between them?

<span class="caption">Table B-5: Trait Bound Constraints</span>
| Symbol | Explanation |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `T: U` | Generic parameter `T` constrained to types that implement `U` |
| `T: 'a` | Generic type `T` must outlive lifetime `'a` (meaning the type cannot transitively contain any references with lifetimes shorter than `'a`) |
| `T: 'static` | Generic type `T` contains no borrowed references other than `'static` ones |
| `'b: 'a` | Generic lifetime `'b` must outlive lifetime `'a` |
| `T: ?Sized` | Allow generic type parameter to be a dynamically sized type |
| `'a + trait`, `trait + trait` | Compound type constraint |

Suggested fix:
Pick one or the other.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions