Relocate issues/issue-51154.rs to closures/box-generic-closure.rs Relocate issues/issue-51515.rs to borrowck/assignment-to-immutable-ref.rs Relocate issues/issue-53348.rs to mismatched_types/deref-string-assign.rs Relocate issues/issue-52717.rs to pattern/match-enum-struct-variant-field-missing.rs Relocate issues/issue-53300.rs to type/cannot-find-wrapper-with-impl-trait.rs
14 lines
573 B
Rust
14 lines
573 B
Rust
//! Regression test for issue <https://github.com/rust-lang/rust/issues/51515>
|
|
//! Test that assigning through an immutable reference (`&`) correctly yields
|
|
//! an assignment error (E0594) and suggests using a mutable reference.
|
|
|
|
fn main() {
|
|
let foo = &16;
|
|
//~^ HELP consider changing this to be a mutable reference
|
|
*foo = 32;
|
|
//~^ ERROR cannot assign to `*foo`, which is behind a `&` reference
|
|
let bar = foo;
|
|
//~^ HELP consider specifying this binding's type
|
|
*bar = 64;
|
|
//~^ ERROR cannot assign to `*bar`, which is behind a `&` reference
|
|
}
|