nll rejects this code · Issue #48238 · rust-lang/rust (original) (raw)
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(".")}
});
}