- Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-bugCategory: This is a bug.Category: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Description
I'm not sure if this is a bug or not.
fn weird(x: &i32, y: &i32) -> impl Sized { [x, y] }This code doesn't compile, giving the following error.
error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds --> src/lib.rs:2:5 | 1 | fn weird(x: &i32, y: &i32) -> impl Sized { | ---------- opaque type defined here 2 | [x, y] | ^^^^^^ | = note: hidden type `[&i32; 2]` captures lifetime `'_` For more information about this error, try `rustc --explain E0700`. The return type captures the lifetime that outlives both the input lifetimes. There is not an easy way to name this lifetime. At the very least, the error is rather confusing.
Seems related to #128752
Meta
Reproducible on the playground in version 1.93.0-nightly (2025-11-01 bd3ac0330018c23b111b)
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-bugCategory: This is a bug.Category: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.