Skip to content

uncaptured lifetimes required to live as long as the opaque type #116794

Closed
@aliemjay

Description

@aliemjay

The following valid code stopped compiling since v1.67, most likely due to #103491:

fn opaque<'a: 'a>(_: &'a str) -> *mut impl Sized {
    &mut ()
}

fn main() {
    let x = opaque(&String::new()); //~ ERROR temporary value dropped while borrowed
    drop(x);
}

Metadata

Metadata

Labels

A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.P-mediumMedium priorityT-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions