Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/109298.rs: fixed with errors #1559

Merged
merged 1 commit into from
Apr 2, 2023
Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Apr 1, 2023

Issue: rust-lang/rust#109298

fn arr_by_ref(mut x: [(); 3]) {
    let f = || {
        let [ref y, ref mut z @ ..] = x;
    };
    f();
}

fn main() {}
=== stdout ===
=== stderr ===
warning: unused variable: `y`
 --> /home/runner/work/glacier/glacier/ices/109298.rs:3:18
  |
3 |         let [ref y, ref mut z @ ..] = x;
  |                  ^ help: if this is intentional, prefix it with an underscore: `_y`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `z`
 --> /home/runner/work/glacier/glacier/ices/109298.rs:3:29
  |
3 |         let [ref y, ref mut z @ ..] = x;
  |                             ^ help: if this is intentional, prefix it with an underscore: `_z`

error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
 --> /home/runner/work/glacier/glacier/ices/109298.rs:5:5
  |
3 |         let [ref y, ref mut z @ ..] = x;
  |                                       - calling `f` requires mutable binding due to mutable borrow of `x`
4 |     };
5 |     f();
  |     ^ cannot borrow as mutable
  |
help: consider changing this to be mutable
  |
2 |     let mut f = || {
  |         +++

error: aborting due to previous error; 2 warnings emitted

For more information about this error, try `rustc --explain E0596`.
==============

=== stdout ===
=== stderr ===
warning: unused variable: `y`
 --> /home/runner/work/glacier/glacier/ices/109298.rs:3:18
  |
3 |         let [ref y, ref mut z @ ..] = x;
  |                  ^ help: if this is intentional, prefix it with an underscore: `_y`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `z`
 --> /home/runner/work/glacier/glacier/ices/109298.rs:3:29
  |
3 |         let [ref y, ref mut z @ ..] = x;
  |                             ^ help: if this is intentional, prefix it with an underscore: `_z`

error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
 --> /home/runner/work/glacier/glacier/ices/109298.rs:5:5
  |
3 |         let [ref y, ref mut z @ ..] = x;
  |                                       - calling `f` requires mutable binding due to mutable borrow of `x`
4 |     };
5 |     f();
  |     ^ cannot borrow as mutable
  |
help: consider changing this to be mutable
  |
2 |     let mut f = || {
  |         +++

error: aborting due to previous error; 2 warnings emitted

For more information about this error, try `rustc --explain E0596`.
==============
@JohnTitor JohnTitor merged commit da3285b into master Apr 2, 2023
@JohnTitor JohnTitor deleted the autofix/ices/109298.rs branch April 2, 2023 06:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants