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

ices/82438.rs: fixed with errors #673

Merged
merged 1 commit into from
Feb 28, 2021
Merged

ices/82438.rs: fixed with errors #673

merged 1 commit into from
Feb 28, 2021

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#82438

fn main() {
    let inner;
    let outer = || {
        inner = || {};
        inner();
    };
    outer();
}
=== stdout ===
=== stderr ===
error[E0594]: cannot assign to `inner`, as it is not declared as mutable
 --> /home/runner/work/glacier/glacier/ices/82438.rs:4:9
  |
2 |     let inner;
  |         ----- help: consider changing this to be mutable: `mut inner`
3 |     let outer = || {
4 |         inner = || {};
  |         ^^^^^^^^^^^^^ cannot assign

error[E0381]: borrow of possibly-uninitialized variable: `inner`
 --> /home/runner/work/glacier/glacier/ices/82438.rs:3:17
  |
3 |     let outer = || {
  |                 ^^ use of possibly-uninitialized `inner`
4 |         inner = || {};
  |         ----- borrow occurs due to use in closure

error[E0596]: cannot borrow `outer` as mutable, as it is not declared as mutable
 --> /home/runner/work/glacier/glacier/ices/82438.rs:7:5
  |
3 |     let outer = || {
  |         ----- help: consider changing this to be mutable: `mut outer`
4 |         inner = || {};
  |         ----- calling `outer` requires mutable binding due to mutable borrow of `inner`
...
7 |     outer();
  |     ^^^^^ cannot borrow as mutable

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0381, E0594, E0596.
For more information about an error, try `rustc --explain E0381`.
==============

=== stdout ===
=== stderr ===
error[E0594]: cannot assign to `inner`, as it is not declared as mutable
 --> /home/runner/work/glacier/glacier/ices/82438.rs:4:9
  |
2 |     let inner;
  |         ----- help: consider changing this to be mutable: `mut inner`
3 |     let outer = || {
4 |         inner = || {};
  |         ^^^^^^^^^^^^^ cannot assign

error[E0381]: borrow of possibly-uninitialized variable: `inner`
 --> /home/runner/work/glacier/glacier/ices/82438.rs:3:17
  |
3 |     let outer = || {
  |                 ^^ use of possibly-uninitialized `inner`
4 |         inner = || {};
  |         ----- borrow occurs due to use in closure

error[E0596]: cannot borrow `outer` as mutable, as it is not declared as mutable
 --> /home/runner/work/glacier/glacier/ices/82438.rs:7:5
  |
3 |     let outer = || {
  |         ----- help: consider changing this to be mutable: `mut outer`
4 |         inner = || {};
  |         ----- calling `outer` requires mutable binding due to mutable borrow of `inner`
...
7 |     outer();
  |     ^^^^^ cannot borrow as mutable

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0381, E0594, E0596.
For more information about an error, try `rustc --explain E0381`.
==============
@JohnTitor JohnTitor merged commit 4c94653 into master Feb 28, 2021
@JohnTitor JohnTitor deleted the autofix/ices/82438.rs branch February 28, 2021 12:28
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