summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/issue-69789-iterator-mut-suggestion.rs
blob: f6d0e9e04d3212472f07cf9eeae7f9a49fae6144 (plain)
1
2
3
4
5
6
7
8
9
10
11
// Regression test for #69789: rustc generated an invalid suggestion
// when `&` reference from `&mut` iterator is mutated.

fn main() {
    for item in &mut std::iter::empty::<&'static ()>() {
        //~^ NOTE this iterator yields `&` references
        *item = ();
        //~^ ERROR cannot assign
        //~| NOTE  cannot be written
    }
}