]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-69789-iterator-mut-suggestion.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / issue-69789-iterator-mut-suggestion.rs
1 // Regression test for #69789: rustc generated an invalid suggestion
2 // when `&` reference from `&mut` iterator is mutated.
3
4 fn main() {
5     for item in &mut std::iter::empty::<&'static ()>() {
6         //~^ NOTE this iterator yields `&` references
7         *item = ();
8         //~^ ERROR cannot assign
9         //~| NOTE  cannot be written
10     }
11 }