mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
12 lines
346 B
Rust
12 lines
346 B
Rust
// 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
|
|
}
|
|
}
|