Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: The internal compiler error does not occur in stable (): The fix for compilation is to use instead of and this also prevents the panic in the nightly version of rustc. <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
It would be nice to reproduce this without the async-std dependency.
Slightly smaller:
I bisected far enough to find it regressed between the 9th and 10th, then ran out of disk space :facepalm:
Smaller example without
Here you go. The async part doesn't seem important and the issue still occurs with the versions of and and removed from dependencies: It could probably be reduced in size further but I'm not much of a Rust expert. I suspect anything which triggers that particular compiler error would do the trick.
searched nightlies: from nightly-2021-02-10 to nightly-2021-02-11 regressed nightly: nightly-2021-02-11 searched commits: from to regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.0</summaryHost triple: x86_64-unknown-linux-gnu Reproduce with: </details
Probably cc In particular looks suspect.
Are functions registered as items in the hir? edit: nvm just saw that someone posted a non-async example

Discussion:
use rustc_hir as hir; use rustc_hir::Node; use rustc_index::vec::Idx; <ins> use rustc_middle::hir::map::Map; </ins> use rustc_middle::mir::{Mutability, Place, PlaceRef, ProjectionElem}; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::{

// Attempt to search similar mutable associated items for suggestion. // In the future, attempt in all path but initially for RHS of for_loop fn suggest_similar_mut_method_for_for_loop(&self, err: &mut DiagnosticBuilder<'_>) { <del> let hir = self.infcx.tcx.hir(); let node = hir.item(self.mir_hir_id()); </del> use hir::{ <del> Expr, </del> <ins> BodyId, Expr, </ins> ExprKind::{Block, Call, DropTemps, Match, MethodCall}, <ins> HirId, ImplItem, ImplItemKind, Item, ItemKind, </ins> }; <del> if let hir::ItemKind::Fn(_, _, body_id) = node.kind { </del> <ins> fn maybe_body_id_of_fn(hir_map: &Map<'tcx>, id: HirId) -> Option<BodyId> { match hir_map.find(id) { Some(Node::Item(Item { kind: ItemKind::Fn(_, _, body_id), .. })) | Some(Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(_, body_id), .. })) => { Some(*body_id) } _ => None, } } let hir_map = self.infcx.tcx.hir(); let mir_body_hir_id = self.mir_hir_id(); if let Some(fn_body_id) = maybe_body_id_of_fn(&hir_map, mir_body_hir_id) { </ins> if let Block( hir::Block { expr:

.. }, _, <del> ) = hir.body(body_id).value.kind </del> <ins> ) = hir_map.body(fn_body_id).value.kind </ins> { let opt_suggestions = path_segment .hir_id

<ins> use std::{fs, io::*}; use std::collections::HashMap; type Handle = BufWriter<fs::File>; struct Thing(HashMap<String, Handle>); impl Thing { pub fn die_horribly(&mut self) { for v in self.0.values() { v.flush(); //~^ ERROR cannot borrow } } } fn main() {} </ins>

<ins> error[E0596]: cannot borrow `*v` as mutable, as it is behind a `&` reference --> $DIR/issue-82032.rs:10:13 | LL |         for v in self.0.values() { |                  --------------- |                  |      | |                  |      help: use mutable method: `values_mut()` |                  this iterator yields `&` references LL |             v.flush(); |             ^ `v` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error For more information about this error, try `rustc --explain E0596`. </ins>