Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- fn main() {
- println!("{:?}", {
- let a = 5; let b = &mut a.clone(); b += 1; a
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (/playground)
- error[E0368]: binary assignment operation `+=` cannot be applied to type `&mut {integer}`
- --> src/main.rs:6:44
- |
- 6 | let a = 5; let b = &mut a.clone(); b += 1; a
- | -^^^^^
- | |
- | cannot use `+=` on type `&mut {integer}`
- help: `+=` can be used on '{integer}', you can dereference `b`
- |
- 6 | let a = 5; let b = &mut a.clone(); *b += 1; a
- | ^^
- error: aborting due to previous error
- For more information about this error, try `rustc --explain E0368`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement