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

ices/109523.rs: fixed with errors #1585

Merged
merged 1 commit into from
May 12, 2023
Merged

ices/109523.rs: fixed with errors #1585

merged 1 commit into from
May 12, 2023

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#109523

enum Either {
    One(X),
    Two(X),
}

struct X;

fn move_into_fnmut() {
    let x = Either::One(X);
    let y = || {
        let Either::Two(a) = x;
    };
}

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

error[E0005]: refutable pattern in local binding
  --> /home/runner/work/glacier/glacier/ices/109523.rs:11:13
   |
11 |         let Either::Two(a) = x;
   |             ^^^^^^^^^^^^^^ pattern `Either::One(_)` not covered
   |
   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Either` defined here
  --> /home/runner/work/glacier/glacier/ices/109523.rs:1:6
   |
1  | enum Either {
   |      ^^^^^^
2  |     One(X),
   |     --- not covered
   = note: the matched value is of type `Either`
help: you might want to use `let else` to handle the variant that isn't matched
   |
11 |         let Either::Two(a) = x else { todo!() };
   |                                ++++++++++++++++

error: aborting due to previous error; 1 warning emitted

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

=== stdout ===
=== stderr ===
warning: unused variable: `y`
  --> /home/runner/work/glacier/glacier/ices/109523.rs:10:9
   |
10 |     let y = || {
   |         ^ help: if this is intentional, prefix it with an underscore: `_y`
   |
   = note: `#[warn(unused_variables)]` on by default

error[E0005]: refutable pattern in local binding
  --> /home/runner/work/glacier/glacier/ices/109523.rs:11:13
   |
11 |         let Either::Two(a) = x;
   |             ^^^^^^^^^^^^^^ pattern `Either::One(_)` not covered
   |
   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Either` defined here
  --> /home/runner/work/glacier/glacier/ices/109523.rs:1:6
   |
1  | enum Either {
   |      ^^^^^^
2  |     One(X),
   |     --- not covered
   = note: the matched value is of type `Either`
help: you might want to use `let else` to handle the variant that isn't matched
   |
11 |         let Either::Two(a) = x else { todo!() };
   |                                ++++++++++++++++

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0005`.
==============
@JohnTitor JohnTitor merged commit ba4784b into master May 12, 2023
@JohnTitor JohnTitor deleted the autofix/ices/109523.rs branch May 12, 2023 11:21
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.

2 participants