-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
compiler and language documentation disagree on lifetime extension for array expressions #146092
Copy link
Copy link
Open
Labels
A-arrayArea: `[T; N]`Area: `[T; N]`A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-temporary-lifetime-extensionArea: temporary lifetime extensionArea: temporary lifetime extensionC-bugCategory: This is a bug.Category: This is a bug.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.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-langRelevant to the language teamRelevant to the language teamT-lang-docsRelevant to the lang-docs team.Relevant to the lang-docs team.
Metadata
Metadata
Assignees
Labels
A-arrayArea: `[T; N]`Area: `[T; N]`A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-temporary-lifetime-extensionArea: temporary lifetime extensionArea: temporary lifetime extensionC-bugCategory: This is a bug.Category: This is a bug.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.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-langRelevant to the language teamRelevant to the language teamT-lang-docsRelevant to the lang-docs team.Relevant to the lang-docs team.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I'm not sure whether this is a compiler or language docs issue, so I'll report it here and cc @rust-lang/lang-docs
The Reference and FLS specify that the operands of extending array expressions are extending. Clicking through to see the definition of array expressions, both specifications include
[expr; N]repetition expressions. Thus from these specifications I would expectto extend
temp()to live in the same scope asx. This is not the case (playground):On the compiler side, the implementation of extending expressions only includes normal array expressions, not repetition expressions, which are represented as
hir::ExprKind::Repeatrather thanhir:ExprKind::Array.@rustbot label +T-compiler +T-lang +T-lang-docs +A-docs +A-temporary-lifetime-extension +A-array