Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point to span of upvar making closure FnMut #81158

Merged
merged 1 commit into from
Jan 29, 2021

Conversation

sledgehammervampire
Copy link
Contributor

For #80313.

@rust-highfive
Copy link
Collaborator

r? @varkor

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 18, 2021
@sledgehammervampire
Copy link
Contributor Author

r? @Aaron1011

@rust-highfive rust-highfive assigned Aaron1011 and unassigned varkor Jan 18, 2021
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_traits v0.0.0 (/checkout/compiler/rustc_traits)
    Checking rustc_passes v0.0.0 (/checkout/compiler/rustc_passes)
    Checking rustc_ty_utils v0.0.0 (/checkout/compiler/rustc_ty_utils)
    Checking rustc_plugin_impl v0.0.0 (/checkout/compiler/rustc_plugin_impl)
error[E0277]: `rustc_middle::hir::place::Place<'_>` doesn't implement `std::fmt::Display`
   --> compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:254:29
251 | /                         format!(
251 | /                         format!(
252 | |                             "calling `{}` requires mutable borrow due to mutation of `{}`",
253 | |                             self.local_names[local].unwrap(),
254 | |                             symbol
    | |                             ^^^^^^ `rustc_middle::hir::place::Place<'_>` cannot be formatted with the default formatter
    | |_________________________- in this macro invocation (#1)
    | 
   ::: /checkout/library/alloc/src/macros.rs:108:1
    |
    |
108 | / macro_rules! format {
109 | |     ($($arg:tt)*) => {{
110 | |         let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
    | |                                       ---------------------------------------- in this macro invocation (#2)
112 | |     }}
113 | | }
113 | | }
    | |_- in this expansion of `format!` (#1)
   ::: /checkout/library/core/src/macros/mod.rs:749:5
    |
749 | /     macro_rules! format_args {
749 | /     macro_rules! format_args {
750 | |         ($fmt:expr) => {{ /* compiler built-in */ }};
751 | |         ($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
752 | |     }
    | |_____- in this expansion of `$crate::__export::format_args!` (#2)
    |
    = help: the trait `std::fmt::Display` is not implemented for `rustc_middle::hir::place::Place<'_>`
    = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
    = note: required by `std::fmt::Display::fmt`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rustc_mir`
error: could not compile `rustc_mir`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--color" "always" "--features" " llvm max_level_info" "--manifest-path" "/checkout/compiler/rustc/Cargo.toml" "-p" "rustc-main" "-p" "rustc_driver" "-p" "rustc_plugin_impl" "-p" "rustc_target" "-p" "rustc_index" "-p" "rustc_macros" "-p" "rustc_mir" "-p" "rustc_graphviz" "-p" "rustc_attr" "-p" "rustc_infer" "-p" "coverage_test_macros" "-p" "rustc_lexer" "-p" "rustc_apfloat" "-p" "rustc_trait_selection" "-p" "rustc_parse_format" "-p" "rustc_feature" "-p" "rustc_lint" "-p" "rustc_errors" "-p" "rustc_lint_defs" "-p" "rustc_save_analysis" "-p" "rustc_hir" "-p" "rustc_parse" "-p" "rustc_ast" "-p" "rustc_middle" "-p" "rustc_type_ir" "-p" "rustc_arena" "-p" "rustc_query_system" "-p" "rustc_serialize" "-p" "rustc_interface" "-p" "rustc_expand" "-p" "rustc_incremental" "-p" "rustc_fs_util" "-p" "rustc_traits" "-p" "rustc_ast_passes" "-p" "rustc_typeck" "-p" "rustc_mir_build" "-p" "rustc_passes" "-p" "rustc_ty_utils" "-p" "rustc_symbol_mangling" "-p" "rustc_resolve" "-p" "rustc_privacy" "-p" "rustc_ast_lowering" "-p" "rustc_codegen_llvm" "-p" "rustc_llvm" "-p" "rustc_builtin_macros" "-p" "rustc_error_codes" "-p" "rustc_span" "-p" "rustc_data_structures" "-p" "rustc_hir_pretty" "-p" "rustc_ast_pretty" "-p" "rustc_metadata" "-p" "rustc_session" "-p" "rustc_codegen_ssa" "--message-format" "json-render-diagnostics"
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
Build completed unsuccessfully in 0:02:47

@sledgehammervampire sledgehammervampire marked this pull request as draft January 18, 2021 09:13
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_mir_build v0.0.0 (/checkout/compiler/rustc_mir_build)
    Checking rustc_passes v0.0.0 (/checkout/compiler/rustc_passes)
    Checking rustc_ty_utils v0.0.0 (/checkout/compiler/rustc_ty_utils)
    Checking rustc_plugin_impl v0.0.0 (/checkout/compiler/rustc_plugin_impl)
error[E0277]: `rustc_middle::hir::place::Place<'_>` doesn't implement `std::fmt::Display`
   --> compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:254:29
251 | /                         format!(
251 | /                         format!(
252 | |                             "calling `{}` requires mutable borrow due to mutation of `{}`",
253 | |                             self.local_names[local].unwrap(),
254 | |                             symbol
    | |                             ^^^^^^ `rustc_middle::hir::place::Place<'_>` cannot be formatted with the default formatter
    | |_________________________- in this macro invocation (#1)
    | 
   ::: /checkout/library/alloc/src/macros.rs:108:1
    |
    |
108 | / macro_rules! format {
109 | |     ($($arg:tt)*) => {{
110 | |         let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
    | |                                       ---------------------------------------- in this macro invocation (#2)
112 | |     }}
113 | | }
113 | | }
    | |_- in this expansion of `format!` (#1)
   ::: /checkout/library/core/src/macros/mod.rs:749:5
    |
749 | /     macro_rules! format_args {
749 | /     macro_rules! format_args {
750 | |         ($fmt:expr) => {{ /* compiler built-in */ }};
751 | |         ($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
752 | |     }
    | |_____- in this expansion of `$crate::__export::format_args!` (#2)
    |
    = help: the trait `std::fmt::Display` is not implemented for `rustc_middle::hir::place::Place<'_>`
    = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
    = note: required by `std::fmt::Display::fmt`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rustc_mir`
error: could not compile `rustc_mir`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--color" "always" "--features" " llvm max_level_info" "--manifest-path" "/checkout/compiler/rustc/Cargo.toml" "-p" "rustc-main" "-p" "rustc_codegen_ssa" "-p" "rustc_span" "-p" "rustc_arena" "-p" "rustc_target" "-p" "rustc_symbol_mangling" "-p" "rustc_serialize" "-p" "rustc_attr" "-p" "rustc_lexer" "-p" "rustc_feature" "-p" "rustc_ast_pretty" "-p" "rustc_apfloat" "-p" "rustc_ast" "-p" "rustc_macros" "-p" "rustc_incremental" "-p" "rustc_graphviz" "-p" "rustc_index" "-p" "rustc_errors" "-p" "rustc_lint_defs" "-p" "rustc_middle" "-p" "rustc_query_system" "-p" "rustc_type_ir" "-p" "rustc_hir" "-p" "rustc_data_structures" "-p" "rustc_session" "-p" "rustc_fs_util" "-p" "rustc_driver" "-p" "rustc_lint" "-p" "rustc_trait_selection" "-p" "rustc_infer" "-p" "rustc_parse_format" "-p" "rustc_hir_pretty" "-p" "rustc_interface" "-p" "rustc_privacy" "-p" "rustc_passes" "-p" "rustc_ty_utils" "-p" "rustc_ast_passes" "-p" "rustc_ast_lowering" "-p" "rustc_builtin_macros" "-p" "rustc_codegen_llvm" "-p" "rustc_llvm" "-p" "rustc_resolve" "-p" "rustc_traits" "-p" "rustc_typeck" "-p" "rustc_expand" "-p" "rustc_mir_build" "-p" "rustc_save_analysis" "-p" "rustc_error_codes" "-p" "rustc_parse" "-p" "rustc_mir" "-p" "coverage_test_macros" "-p" "rustc_metadata" "-p" "rustc_plugin_impl" "--message-format" "json-render-diagnostics"
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
Build completed unsuccessfully in 0:03:00

@sledgehammervampire
Copy link
Contributor Author

Hmm, that's weird. I wonder why it says that it's trying to print a Place, when it should be a Symbol. It compiles without errors on my machine.

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_traits v0.0.0 (/checkout/compiler/rustc_traits)
    Checking rustc_passes v0.0.0 (/checkout/compiler/rustc_passes)
    Checking rustc_mir_build v0.0.0 (/checkout/compiler/rustc_mir_build)
    Checking rustc_plugin_impl v0.0.0 (/checkout/compiler/rustc_plugin_impl)
error[E0277]: `rustc_middle::hir::place::Place<'_>` doesn't implement `std::fmt::Display`
   --> compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:255:29
252 | /                         format!(
252 | /                         format!(
253 | |                             "calling `{}` requires mutable borrow due to mutation of `{}`",
254 | |                             self.local_names[local].unwrap(),
255 | |                             symbol
    | |                             ^^^^^^ `rustc_middle::hir::place::Place<'_>` cannot be formatted with the default formatter
    | |_________________________- in this macro invocation (#1)
    | 
   ::: /checkout/library/alloc/src/macros.rs:108:1
    |
    |
108 | / macro_rules! format {
109 | |     ($($arg:tt)*) => {{
110 | |         let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
    | |                                       ---------------------------------------- in this macro invocation (#2)
112 | |     }}
113 | | }
113 | | }
    | |_- in this expansion of `format!` (#1)
   ::: /checkout/library/core/src/macros/mod.rs:749:5
    |
749 | /     macro_rules! format_args {
749 | /     macro_rules! format_args {
750 | |         ($fmt:expr) => {{ /* compiler built-in */ }};
751 | |         ($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
752 | |     }
    | |_____- in this expansion of `$crate::__export::format_args!` (#2)
    |
    = help: the trait `std::fmt::Display` is not implemented for `rustc_middle::hir::place::Place<'_>`
    = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
    = note: required by `std::fmt::Display::fmt`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rustc_mir`
error: could not compile `rustc_mir`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--color" "always" "--features" " llvm max_level_info" "--manifest-path" "/checkout/compiler/rustc/Cargo.toml" "-p" "rustc-main" "-p" "rustc_codegen_ssa" "-p" "rustc_fs_util" "-p" "rustc_data_structures" "-p" "rustc_graphviz" "-p" "rustc_session" "-p" "rustc_feature" "-p" "rustc_lint_defs" "-p" "rustc_macros" "-p" "rustc_attr" "-p" "rustc_ast_pretty" "-p" "rustc_lexer" "-p" "rustc_serialize" "-p" "rustc_index" "-p" "rustc_ast" "-p" "rustc_hir" "-p" "rustc_span" "-p" "rustc_arena" "-p" "rustc_target" "-p" "rustc_symbol_mangling" "-p" "rustc_errors" "-p" "rustc_incremental" "-p" "rustc_middle" "-p" "rustc_type_ir" "-p" "rustc_query_system" "-p" "rustc_apfloat" "-p" "rustc_driver" "-p" "rustc_mir" "-p" "coverage_test_macros" "-p" "rustc_trait_selection" "-p" "rustc_parse_format" "-p" "rustc_infer" "-p" "rustc_save_analysis" "-p" "rustc_parse" "-p" "rustc_hir_pretty" "-p" "rustc_interface" "-p" "rustc_expand" "-p" "rustc_builtin_macros" "-p" "rustc_typeck" "-p" "rustc_ty_utils" "-p" "rustc_resolve" "-p" "rustc_passes" "-p" "rustc_mir_build" "-p" "rustc_ast_lowering" "-p" "rustc_traits" "-p" "rustc_ast_passes" "-p" "rustc_privacy" "-p" "rustc_codegen_llvm" "-p" "rustc_llvm" "-p" "rustc_lint" "-p" "rustc_error_codes" "-p" "rustc_metadata" "-p" "rustc_plugin_impl" "--message-format" "json-render-diagnostics"
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
Build completed unsuccessfully in 0:02:31

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_passes v0.0.0 (/checkout/compiler/rustc_passes)
    Checking rustc_mir v0.0.0 (/checkout/compiler/rustc_mir)
    Checking rustc_traits v0.0.0 (/checkout/compiler/rustc_traits)
    Checking rustc_plugin_impl v0.0.0 (/checkout/compiler/rustc_plugin_impl)
error[E0277]: `rustc_middle::hir::place::Place<'_>` doesn't implement `std::fmt::Display`
   --> compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:255:29
252 | /                         format!(
252 | /                         format!(
253 | |                             "calling `{}` requires mutable borrow due to mutation of `{}`",
254 | |                             self.local_names[local].unwrap(),
255 | |                             symbol
    | |                             ^^^^^^ `rustc_middle::hir::place::Place<'_>` cannot be formatted with the default formatter
    | |_________________________- in this macro invocation (#1)
    | 
   ::: /checkout/library/alloc/src/macros.rs:108:1
    |
    |
108 | / macro_rules! format {
109 | |     ($($arg:tt)*) => {{
110 | |         let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
    | |                                       ---------------------------------------- in this macro invocation (#2)
112 | |     }}
113 | | }
113 | | }
    | |_- in this expansion of `format!` (#1)
   ::: /checkout/library/core/src/macros/mod.rs:749:5
    |
749 | /     macro_rules! format_args {
749 | /     macro_rules! format_args {
750 | |         ($fmt:expr) => {{ /* compiler built-in */ }};
751 | |         ($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
752 | |     }
    | |_____- in this expansion of `$crate::__export::format_args!` (#2)
    |
    = help: the trait `std::fmt::Display` is not implemented for `rustc_middle::hir::place::Place<'_>`
    = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
    = note: required by `std::fmt::Display::fmt`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rustc_mir`
error: could not compile `rustc_mir`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--color" "always" "--features" " llvm max_level_info" "--manifest-path" "/checkout/compiler/rustc/Cargo.toml" "-p" "rustc-main" "-p" "rustc_codegen_ssa" "-p" "rustc_data_structures" "-p" "rustc_graphviz" "-p" "rustc_incremental" "-p" "rustc_session" "-p" "rustc_feature" "-p" "rustc_lint_defs" "-p" "rustc_macros" "-p" "rustc_ast" "-p" "rustc_lexer" "-p" "rustc_hir" "-p" "rustc_errors" "-p" "rustc_attr" "-p" "rustc_ast_pretty" "-p" "rustc_span" "-p" "rustc_arena" "-p" "rustc_serialize" "-p" "rustc_middle" "-p" "rustc_query_system" "-p" "rustc_type_ir" "-p" "rustc_fs_util" "-p" "rustc_symbol_mangling" "-p" "rustc_index" "-p" "rustc_apfloat" "-p" "rustc_target" "-p" "rustc_driver" "-p" "rustc_lint" "-p" "rustc_trait_selection" "-p" "rustc_infer" "-p" "rustc_parse_format" "-p" "rustc_interface" "-p" "rustc_builtin_macros" "-p" "rustc_passes" "-p" "rustc_typeck" "-p" "rustc_mir_build" "-p" "rustc_expand" "-p" "rustc_resolve" "-p" "rustc_ty_utils" "-p" "rustc_ast_lowering" "-p" "rustc_privacy" "-p" "rustc_ast_passes" "-p" "rustc_traits" "-p" "rustc_codegen_llvm" "-p" "rustc_llvm" "-p" "rustc_save_analysis" "-p" "rustc_metadata" "-p" "rustc_mir" "-p" "coverage_test_macros" "-p" "rustc_hir_pretty" "-p" "rustc_error_codes" "-p" "rustc_plugin_impl" "-p" "rustc_parse" "--message-format" "json-render-diagnostics"
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
Build completed unsuccessfully in 0:02:55

@Aaron1011
Copy link
Member

@1000teslas It looks like closure_kind_origins was just changed yesterday in #80635. You'll want to rebase against master, and use ty::place_to_string_for_capture to pretty-print the place.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.................................................................................................... 9100/11269
.................................................................................................... 9200/11269
..................................................................i......i.......................... 9300/11269
.................................................................................................... 9400/11269
....iiiiii..iiiiii..i............................................................................... 9500/11269
.................................................................................................... 9700/11269
.................................................................................................... 9800/11269
.................................................................................................... 9900/11269
.................................................................................................... 10000/11269
---
.................................................................................................... 10500/11269
.................................................................................................... 10600/11269
...........................i........................................................................ 10700/11269
.................................................................................................... 10800/11269
.........F..F.F..................................................................................... 10900/11269
.................................................................................................... 11100/11269
...........................................................i.i...................................... 11200/11269
.....................................................................
failures:
failures:

---- [ui] ui/borrowck/borrow-raw-address-of-mutability.rs stdout ----
diff of stderr:

20    |
21 LL |     let f = || {
22    |         - help: consider changing this to be mutable: `mut f`
- ...
+ LL |         let y = &raw mut x;
+    |                          - calling `f` requires mutable borrow due to mutation of `x`
+ LL |     };
24 LL |     f();
25    |     ^ cannot borrow as mutable


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrow-raw-address-of-mutability/borrow-raw-address-of-mutability.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrow-raw-address-of-mutability/borrow-raw-address-of-mutability.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args borrowck/borrow-raw-address-of-mutability.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrow-raw-address-of-mutability.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrow-raw-address-of-mutability" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrow-raw-address-of-mutability/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
   |
LL |     let x = 0;
LL |     let x = 0;
   |         - help: consider changing this to be mutable: `mut x`
LL |     let y = &raw mut x;                 //~ ERROR cannot borrow
   |             ^^^^^^^^^^ cannot borrow as mutable

error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
   |
LL |     let x = 0;
LL |     let x = 0;
   |         - help: consider changing this to be mutable: `mut x`
LL |     let mut f = || {
LL |         let y = &raw mut x;             //~ ERROR cannot borrow
   |                 ^^^^^^^^^^ cannot borrow as mutable

error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
   |
   |
LL |     let f = || {
   |         - help: consider changing this to be mutable: `mut f`
LL |         let y = &raw mut x;
   |                          - calling `f` requires mutable borrow due to mutation of `x`
LL |     };
LL |     f();                                //~ ERROR cannot borrow
   |     ^ cannot borrow as mutable

error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
   |
   |
LL |   fn make_fn<F: Fn()>(f: F) -> F { f }
   |                          - change this to accept `FnMut` instead of `Fn`
...
LL |       let f = make_fn(|| {
   |  _____________-------_-
   | |             |
   | |             expects `Fn` instead of `FnMut`
LL | |         let y = &raw mut x;             //~ ERROR cannot borrow
   | |                 ^^^^^^^^^^ cannot borrow as mutable
LL | |     });
   | |_____- in this closure

error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
   |
   |
LL |   fn make_fn<F: Fn()>(f: F) -> F { f }
   |                          - change this to accept `FnMut` instead of `Fn`
...
LL |       let f = make_fn(move || {
   |  _____________-------_-
   | |             |
   | |             expects `Fn` instead of `FnMut`
LL | |         let y = &raw mut x;             //~ ERROR cannot borrow
   | |                 ^^^^^^^^^^ cannot borrow as mutable
LL | |     });
   | |_____- in this closure
error: aborting due to 5 previous errors

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


------------------------------------------


---- [ui] ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs stdout ----
diff of stderr:

12    |
13 LL |     let tick2 = || {
14    |         ----- help: consider changing this to be mutable: `mut tick2`
+ LL |         tick1();
+    |         ----- calling `tick2` requires mutable borrow due to mutation of `tick1`
15 ...
16 LL |     tick2();
17    |     ^^^^^ cannot borrow as mutable

The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0596]: cannot borrow `tick1` as mutable, as it is not declared as mutable
   |
   |
LL |     let tick1 = || {
   |         ----- help: consider changing this to be mutable: `mut tick1`
...
LL |         tick1(); //~ ERROR cannot borrow `tick1` as mutable
   |         ^^^^^ cannot borrow as mutable

error[E0596]: cannot borrow `tick2` as mutable, as it is not declared as mutable
   |
   |
LL |     let tick2 = || {
   |         ----- help: consider changing this to be mutable: `mut tick2`
LL |         tick1(); //~ ERROR cannot borrow `tick1` as mutable
   |         ----- calling `tick2` requires mutable borrow due to mutation of `tick1`
...
LL |     tick2(); //~ ERROR cannot borrow
   |     ^^^^^ cannot borrow as mutable
error: aborting due to 2 previous errors

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

---
diff of stderr:

2   --> $DIR/unboxed-closures-infer-fnmut-missing-mut.rs:7:5
3    |
4 LL |     let tick = || counter += 1;
-    |         ---- help: consider changing this to be mutable: `mut tick`
+    |         ----      ------- calling `tick` requires mutable borrow due to mutation of `counter`
+    |         |
+    |         help: consider changing this to be mutable: `mut tick`
6 LL |     tick();
7    |     ^^^^ cannot borrow as mutable


The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut/unboxed-closures-infer-fnmut-missing-mut.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable
   |
   |
LL |     let tick = || counter += 1;
   |         ----      ------- calling `tick` requires mutable borrow due to mutation of `counter`
   |         |
   |         help: consider changing this to be mutable: `mut tick`
LL |     tick(); //~ ERROR cannot borrow `tick` as mutable, as it is not declared as mutable
   |     ^^^^ cannot borrow as mutable
error: aborting due to previous error

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

---
diff of stderr:

2   --> $DIR/unboxed-closures-infer-fnmut-move-missing-mut.rs:7:5
3    |
4 LL |     let tick = move || counter += 1;
-    |         ---- help: consider changing this to be mutable: `mut tick`
+    |         ----           ------- calling `tick` requires mutable borrow due to mutation of `counter`
+    |         |
+    |         help: consider changing this to be mutable: `mut tick`
6 LL |     tick();
7    |     ^^^^ cannot borrow as mutable


The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut/unboxed-closures-infer-fnmut-move-missing-mut.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable
   |
   |
LL |     let tick = move || counter += 1;
   |         ----           ------- calling `tick` requires mutable borrow due to mutation of `counter`
   |         |
   |         help: consider changing this to be mutable: `mut tick`
LL |     tick(); //~ ERROR cannot borrow `tick` as mutable, as it is not declared as mutable
   |     ^^^^ cannot borrow as mutable
error: aborting due to previous error

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

---

Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-9/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "9.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:16:07

@Aaron1011 Aaron1011 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 18, 2021
@sledgehammervampire sledgehammervampire marked this pull request as ready for review January 20, 2021 15:12
@@ -241,6 +244,39 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
format!("mut {}", self.local_names[local].unwrap()),
Applicability::MachineApplicable,
);
let tcx = self.infcx.tcx;
// point to span of upvar making closure call require mutable borrow
if let ty::Closure(id, _) = the_place_err.ty(self.body, tcx).ty.kind() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks almost identical to the code you added later on this in this file. Could you factor out the common parts into a new closure/method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aaron1011 I've factored the code out.

format!("mutable borrow of `{}`", upvar)
}
ty::UpvarCapture::ByValue(_) => {
format!("possible mutation of `{}`", upvar)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 'possible'? Can there be false positives here, or are you thinking of something like:

let cb = || {
	if false {
        capture = new_val;
    }
}

If it's the latter, I would get rid of the word 'possible', since this can also happen for a mutable borrow (where we don't say 'possible').

Copy link
Contributor Author

@sledgehammervampire sledgehammervampire Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of something like issue-80313-mutable-borrow-in-move-closure.rs, where a mutable borrow is taken of the owned upvar, but no mutation occurs. If I omitted the mutable borrow, and used only the owned value, it would compile fine. In the case of a normal closure, even in your example, where the mutation is not reachable, I think the mutable borrow is always done.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.................................................................................................... 500/11280
................................................................................i................... 600/11280
....................................................i............................................... 700/11280
.................................................................................................... 800/11280
.........................F..F....F......F..........F........FF.FF..F............F................... 900/11280
.......F..........................................................................F..F.............. 1000/11280
..............................................................FF..i.......................FFF....... 1100/11280
F................................................................................................... 1200/11280
...............................ii.i..............i.................................................. 1400/11280
.................................................................................................... 1500/11280
.................................................................................................... 1600/11280
.................................................................................................... 1700/11280
---
.................................................................................................... 2300/11280
.................................................................................................... 2400/11280
..................F................................................................................. 2500/11280
.....................i..i........................................................................... 2600/11280
...................................................................................................F 2700/11280
......F...FF............iiiii....................................................................... 2800/11280
.................................................................................................... 3000/11280
.......................................................F............................................ 3100/11280
.................................................................................................... 3200/11280
.................................................................................................... 3300/11280
---
.................................................................................................... 6800/11280
.................................................................................................... 6900/11280
....................i............................................................................... 7000/11280
...................ii................i.i..ii........................................................ 7100/11280
............F..F.....................................................................F.............. 7200/11280
.............................................F...................................................... 7300/11280
..................................................................i..ii............................. 7500/11280
..................................ii................................................................ 7600/11280
......................................................i............................................. 7700/11280
.......................................i............................................................ 7800/11280
---
............................................................................i......i................ 9300/11280
.................................................................................................... 9400/11280
..............iiiiii..iiiiii.i...................................................................... 9500/11280
.................................................................................................... 9600/11280
............................F.F..................................................................... 9700/11280
.................................................................................................... 9900/11280
.................................................................................................... 10000/11280
................................................................................................F... 10100/11280
.........................................................................................i.......... 10200/11280
.........................................................................................i.......... 10200/11280
.................................................................................................... 10300/11280
.................................................................................................... 10400/11280
.................................................................................................... 10500/11280
........................F........................................................................... 10600/11280
......................................i............................................................. 10700/11280
............................................................................F....................... 10800/11280
................F..............FF................................................................... 10900/11280
.................................................................................................... 11100/11280
......................................................................i.i........................... 11200/11280
................................................................................
failures:
failures:

---- [ui] ui/borrowck/borrow-immutable-upvar-mutation-impl-trait.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit code: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrow-immutable-upvar-mutation-impl-trait.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrow-immutable-upvar-mutation-impl-trait" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrow-immutable-upvar-mutation-impl-trait/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `PlaceRef { local: _1, projection: [Deref] }`,
 right: `PlaceRef { local: _1, projection: [Deref, Field(field[0], usize)] }`', compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:40:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0-nightly (01d122ab8 2021-01-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z emit-future-incompat-report -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0
query stack during panic:
query stack during panic:
#0 [mir_borrowck] borrow-checking `bar::{closure#0}`
#1 [mir_borrowck] borrow-checking `bar`
end of query stack
------------------------------------------


---- [ui] ui/borrowck/borrow-immutable-upvar-mutation.rs stdout ----
---- [ui] ui/borrowck/borrow-immutable-upvar-mutation.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit code: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrow-immutable-upvar-mutation" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrow-immutable-upvar-mutation/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `PlaceRef { local: _1, projection: [Deref] }`,
 right: `PlaceRef { local: _1, projection: [Deref, Field(field[0], &mut i32), Deref] }`', compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:40:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0-nightly (01d122ab8 2021-01-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z emit-future-incompat-report -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0
query stack during panic:
query stack during panic:
#0 [mir_borrowck] borrow-checking `main::{closure#0}`
#1 [mir_borrowck] borrow-checking `main`
end of query stack
------------------------------------------


---- [ui] ui/borrowck/borrow-raw-address-of-mutability.rs stdout ----
---- [ui] ui/borrowck/borrow-raw-address-of-mutability.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit code: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrow-raw-address-of-mutability.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrow-raw-address-of-mutability" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrow-raw-address-of-mutability/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
   |
LL |     let x = 0;
LL |     let x = 0;
   |         - help: consider changing this to be mutable: `mut x`
LL |     let y = &raw mut x;                 //~ ERROR cannot borrow
   |             ^^^^^^^^^^ cannot borrow as mutable
thread 'rustc' panicked at 'assertion failed: `(left == right)`
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `PlaceRef { local: _1, projection: [Deref, Field(field[0], &mut i32)] }`,
 right: `PlaceRef { local: _1, projection: [Deref, Field(field[0], &mut i32), Deref] }`', compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:40:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0-nightly (01d122ab8 2021-01-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z emit-future-incompat-report -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0
query stack during panic:
query stack during panic:
#0 [mir_borrowck] borrow-checking `mutable_address_of_closure::{closure#0}`
#1 [mir_borrowck] borrow-checking `mutable_address_of_closure`
end of query stack

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

------------------------------------------
------------------------------------------


---- [ui] ui/borrowck/borrowck-access-permissions.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit code: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrowck-access-permissions.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-access-permissions" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-access-permissions/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `PlaceRef { local: _12, projection: [] }`,
 right: `PlaceRef { local: _12, projection: [Deref] }`', compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:40:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0-nightly (01d122ab8 2021-01-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z emit-future-incompat-report -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0
query stack during panic:
query stack during panic:
#0 [mir_borrowck] borrow-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
------------------------------------------


---- [ui] ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.rs stdout ----
---- [ui] ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit code: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `PlaceRef { local: _1, projection: [Deref] }`,
 right: `PlaceRef { local: _1, projection: [Deref, Field(field[0], &mut isize), Deref] }`', compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:40:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0-nightly (01d122ab8 2021-01-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z emit-future-incompat-report -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0
query stack during panic:
query stack during panic:
#0 [mir_borrowck] borrow-checking `a`
#1 [analysis] running analysis passes on this crate
end of query stack
------------------------------------------


---- [ui] ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs stdout ----
---- [ui] ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit code: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `PlaceRef { local: _2, projection: [Deref] }`,
 right: `PlaceRef { local: _2, projection: [Deref, Deref] }`', compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:40:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0-nightly (01d122ab8 2021-01-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z emit-future-incompat-report -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0
query stack during panic:
query stack during panic:
#0 [mir_borrowck] borrow-checking `foo`
#1 [analysis] running analysis passes on this crate
end of query stack
------------------------------------------


---- [ui] ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs stdout ----
---- [ui] ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit code: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `PlaceRef { local: _1, projection: [] }`,
 right: `PlaceRef { local: _1, projection: [Deref] }`', compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:40:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0-nightly (01d122ab8 2021-01-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z emit-future-incompat-report -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0
query stack during panic:
query stack during panic:
#0 [mir_borrowck] borrow-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
------------------------------------------


---- [ui] ui/borrowck/borrowck-borrow-from-stack-variable.rs stdout ----
---- [ui] ui/borrowck/borrowck-borrow-from-stack-variable.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit code: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-borrow-from-stack-variable" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-borrow-from-stack-variable/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
   |
   |
LL |     let bar1 = &mut foo.bar1;
   |                ------------- first mutable borrow occurs here
LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
   |                 ^^^^^^^^^^^^^ second mutable borrow occurs here
LL |     *bar1;
   |     ----- first borrow later used here

error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
   |
   |
LL |     let bar1 = &mut foo.bar1;
   |                ------------- mutable borrow occurs here
LL |     let _bar2 = &foo.bar1;  //~ ERROR cannot borrow
   |                 ^^^^^^^^^ immutable borrow occurs here
LL |     *bar1;
   |     ----- mutable borrow later used here

error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
   |
   |
LL |     let bar1 = &foo.bar1;
   |                --------- immutable borrow occurs here
LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
   |                 ^^^^^^^^^^^^^ mutable borrow occurs here
LL |     *bar1;
   |     ----- immutable borrow later used here

error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
   |
   |
LL |     let bar1 = &mut foo.bar1;
   |                ------------- first mutable borrow occurs here
LL |     match foo {
LL |         Foo { bar1: ref mut _bar1, bar2: _ } => {} //
   |                     ^^^^^^^^^^^^^ second mutable borrow occurs here
LL |     *bar1;
LL |     *bar1;
   |     ----- first borrow later used here

error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
   |
   |
LL |     let bar1 = &mut foo.bar1.int1;
   |                ------------------ mutable borrow occurs here
LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
   |                 ^^^^^^^^^ immutable borrow occurs here
LL |     let _foo2 = &foo; //~ ERROR cannot borrow
LL |     *bar1;
   |     ----- mutable borrow later used here

error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
   |
   |
LL |     let bar1 = &mut foo.bar1.int1;
   |                ------------------ mutable borrow occurs here
LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
LL |     let _foo2 = &foo; //~ ERROR cannot borrow
   |                 ^^^^ immutable borrow occurs here
LL |     *bar1;
   |     ----- mutable borrow later used here

error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
   |
   |
LL |     let bar1 = &mut foo.bar1.int1;
   |                ------------------ first mutable borrow occurs here
LL |     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
   |                 ^^^^^^^^^^^^^ second mutable borrow occurs here
LL |     *bar1;
   |     ----- first borrow later used here

error[E0499]: cannot borrow `foo` as mutable more than once at a time
   |
   |
LL |     let bar1 = &mut foo.bar1.int1;
   |                ------------------ first mutable borrow occurs here
LL |     let _foo2 = &mut foo; //~ ERROR cannot borrow
   |                 ^^^^^^^^ second mutable borrow occurs here
LL |     *bar1;
   |     ----- first borrow later used here

error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
   |
   |
LL |     let bar1 = &foo.bar1.int1;
   |                -------------- immutable borrow occurs here
LL |     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
   |                 ^^^^^^^^^^^^^ mutable borrow occurs here
LL |     *bar1;
   |     ----- immutable borrow later used here

error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
   |
   |
LL |     let bar1 = &foo.bar1.int1;
   |                -------------- immutable borrow occurs here
LL |     let _foo2 = &mut foo; //~ ERROR cannot borrow
   |                 ^^^^^^^^ mutable borrow occurs here
LL |     *bar1;
   |     ----- immutable borrow later used here
thread 'rustc' panicked at 'assertion failed: `(left == right)`
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `PlaceRef { local: _1, projection: [] }`,
 right: `PlaceRef { local: _1, projection: [Field(field[0], Bar)] }`', compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:40:9

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0-nightly (01d122ab8 2021-01-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z emit-future-incompat-report -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0
query stack during panic:
query stack during panic:
#0 [mir_borrowck] borrow-checking `borrow_mut_from_imm`
#1 [analysis] running analysis passes on this crate
end of query stack

Some errors have detailed explanations: E0499, E0502.
For more information about an error, try `rustc --explain E0499`.


------------------------------------------


---- [ui] ui/borrowck/borrowck-borrow-from-owned-ptr.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit code: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-borrow-from-owned-ptr" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/borrowck/borrowck-borrow-from-owned-ptr/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
   |
   |
LL |     let bar1 = &mut foo.bar1;
   |                ------------- first mutable borrow occurs here
LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
   |                 ^^^^^^^^^^^^^ second mutable borrow occurs here
LL |     *bar1;
   |     ----- first borrow later used here

error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
   |
   |
LL |     let bar1 = &mut foo.bar1;
   |                ------------- mutable borrow occurs here
LL |     let _bar2 = &foo.bar1;  //~ ERROR cannot borrow
   |                 ^^^^^^^^^ immutable borrow occurs here
LL |     *bar1;
   |     ----- mutable borrow later used here

error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
   |
   |
LL |     let bar1 = &foo.bar1;
   |                --------- immutable borrow occurs here
LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
   |                 ^^^^^^^^^^^^^ mutable borrow occurs here
LL |     *bar1;
   |     ----- immutable borrow later used here

error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
   |
   |
LL |     let bar1 = &mut foo.bar1;
   |                ------------- first mutable borrow occurs here
LL |     match *foo {
LL |         Foo { bar1: ref mut _bar1, bar2: _ } => {}
   |                     ^^^^^^^^^^^^^ second mutable borrow occurs here
LL |     *bar1;
LL |     *bar1;
   |     ----- first borrow later used here

error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
   |
   |
LL |     let bar1 = &mut foo.bar1.int1;
   |                ------------------ mutable borrow occurs here
LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
   |                 ^^^^^^^^^ immutable borrow occurs here
LL |     let _foo2 = &*foo; //~ ERROR cannot borrow
LL |     *bar1;
   |     ----- mutable borrow later used here

error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
   |
   |
LL |     let bar1 = &mut foo.bar1.int1;
   |                ------------------ mutable borrow occurs here
LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
LL |     let _foo2 = &*foo; //~ ERROR cannot borrow
   |                 ^^^^^ immutable borrow occurs here
LL |     *bar1;
   |     ----- mutable borrow later used here

error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
   |
   |
LL |     let bar1 = &mut foo.bar1.int1;
   |                ------------------ first mutable borrow occurs here
LL |     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
   |                 ^^^^^^^^^^^^^ second mutable borrow occurs here
LL |     *bar1;
   |     ----- first borrow later used here

error[E0499]: cannot borrow `*foo` as mutable more than once at a time
---
test result: FAILED. 11146 passed; 47 failed; 87 ignored; 0 measured; 0 filtered out; finished in 132.03s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-9/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "9.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:15:49

@Aaron1011
Copy link
Member

@1000teslas: Thanks! Can you squash the commits into one?

Add expected error

Add comment

Tweak comment wording

Fix after rebase to updated master

Fix after rebase to updated master

Distinguish mutation in normal and move closures

Tweak error message

Fix error message for nested closures

Refactor code showing mutated upvar in closure

Remove debug assert

B
@sledgehammervampire
Copy link
Contributor Author

@Aaron1011 I've squashed the commits into one.

@Aaron1011
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 25, 2021

📌 Commit 26b4baf has been approved by Aaron1011

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 25, 2021
@bors
Copy link
Contributor

bors commented Jan 25, 2021

⌛ Testing commit 26b4baf with merge b749d67e10bd982df208b49a352fd2b510277f08...

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jan 27, 2021
…1011

Point to span of upvar making closure FnMut

For rust-lang#80313.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jan 27, 2021
…1011

Point to span of upvar making closure FnMut

For rust-lang#80313.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jan 28, 2021
…1011

Point to span of upvar making closure FnMut

For rust-lang#80313.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 29, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#79570 (rustc: Stabilize `-Zrun-dsymutil` as `-Csplit-debuginfo`)
 - rust-lang#79819 (Add `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lint)
 - rust-lang#79991 (rustdoc: Render HRTB correctly for bare functions)
 - rust-lang#80215 (Use -target when linking binaries for Mac Catalyst)
 - rust-lang#81158 (Point to span of upvar making closure FnMut)
 - rust-lang#81176 (Improve safety of `LateContext::qpath_res`)
 - rust-lang#81287 (Split rustdoc JSON types into separately versioned crate)
 - rust-lang#81306 (Fuse inner iterator in FlattenCompat and improve related tests)
 - rust-lang#81333 (clean up some const error reporting around promoteds)
 - rust-lang#81459 (Fix rustdoc text selection for page titles)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4283623 into rust-lang:master Jan 29, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 29, 2021
@camelid camelid added A-closures Area: Closures (`|…| { … }`) A-diagnostics Area: Messages for errors, warnings, and lints labels Jan 29, 2021
@sledgehammervampire sledgehammervampire deleted the issue-80313-fix branch January 30, 2021 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`) A-diagnostics Area: Messages for errors, warnings, and lints S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants