Skip to content

nll rejects this code #48238

Closed
Closed
@d653

Description

@d653

UPDATE: Turns out this code should not work, so we just need to add a negative test. See this comment but also the mentoring instructions in this tracking bug.


This code compiles, but it does not compile with nll enabled.

#![feature(nll)]
use std::io::{BufRead, BufReader};

fn main() {
    let v = BufReader::new("aaa.bbb\nccc.ddd\neee.fff.ggg\n".as_bytes());
    let _ = v.lines().map(|x:Result<String,_>|{
        let x = x.unwrap();
        move||{x.rsplit(".")}
    });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)C-bugCategory: This is a bug.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.NLL-completeWorking towards the "valid code works" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions