1 // This is a reduction of a concrete test illustrating a case that was
2 // annoying to Rust developer stephaneyfx (see issue #46413).
4 // With resolving issue #54556, pnkfelix hopes that the new diagnostic
5 // output produced by NLL helps to *explain* the semantic significance
6 // of temp drop order, and thus why storing the result in `x` and then
7 // returning `x` works.
11 pub struct Rows<'stmt>(&'stmt Statement);
13 impl<'stmt> Drop for Rows<'stmt> {
17 impl<'stmt> Iterator for Rows<'stmt> {
20 fn next(&mut self) -> Option<Self::Item> {
25 fn get_names() -> Option<String> {
27 let rows = Rows(&stmt); //~ ERROR does not live long enough
28 rows.map(|row| row).next()
29 // let x = rows.map(|row| row).next();
32 // Removing the map works too as does removing the Drop impl.