Skip to content

RefCell value does not live long enough in if let #22449

Closed
@ptal

Description

@ptal
#![feature(std_misc)]

use std::cell::RefCell;

fn main() {
  let b = RefCell::new(Some(5));
  if let Some(x) = b.borrow().clone() {
  }
}

And the error is:

error: `b` does not live long enough

Metadata

Metadata

Assignees

Labels

A-borrow-checkerArea: The borrow checkerC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions