-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-let_chains`#![feature(let_chains)]``#![feature(let_chains)]`
Description
I tried this code, playground:
#![feature(let_chains)]
use syn::{Attribute, Meta};
fn f(attr: &Attribute) -> bool {
if let Meta::NameValue(name_value) = attr.parse_meta().ok().unwrap()
&& let path_idents = name_value.path.segments.iter()
/* other stuff */
{
}
true
}
I expected to see this happen: code compiles
Instead, this happened: errors due to name_value.path.segments does not live long enough
It compiles when expressed as nested ifs, playground:
#![feature(let_chains)]
use syn::{Attribute, Meta};
fn f(attr: &Attribute) -> bool {
if let Meta::NameValue(name_value) = attr.parse_meta().ok().unwrap() {
if let path_idents = name_value.path.segments.iter() {}
}
true
}
The code compiled previously, but no longer does after #103034 (confirmed with a cargo bisect-rustc
)
cc @nathanwhit
kornelski
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-let_chains`#![feature(let_chains)]``#![feature(let_chains)]`