Change:
I wanted to quickly prototype a bit of code involving tokio and some shared state but ran into a rustc panic: I installed by running rustup update a few hours back. In my code (see below) there seems to be a mistake, having a lock living too long i suppose. The following code leads to the error (based on ) : Unfortunately I could not remove unnecessary parts of the code without making the panic go away. Might this has something to do with detecting the lock lifetimes?
ICE occurs in:
Error before: Regression in cc (I'm on a MCVE)
triage: P-high, removing nomination tag.
Here we go: So takes a type that is , but isn't . That's causing the ICE.
modify labels: -E-needs-mcve
Not sure how to express the for the MCVE here. You can of course use a new struct (like I did before with ), or use a . Interesting this works with as well, but not with other (custom) traits. Maybe because is an ?
Fixed output:

Discussion:
} } <del> pub fn name(&self, id: HirId) -> Name { match self.get(id) { </del> <ins> pub fn opt_name(&self, id: HirId) -> Option<Name> { Some(match self.get(id) { </ins> Node::Item(i) => i.ident.name, Node::ForeignItem(fi) => fi.ident.name, Node::ImplItem(ii) => ii.ident.name,

Node::GenericParam(param) => param.name.ident().name, Node::Binding(&Pat { kind: PatKind::Binding(_, _, l, _), .. }) => l.name, Node::Ctor(..) => self.name(self.get_parent_item(id)), <del> _ => bug!("no name for {}", self.node_to_string(id)) </del> <ins> _ => return None, }) } pub fn name(&self, id: HirId) -> Name { match self.opt_name(id) { Some(name) => name, None => bug!("no name for {}", self.node_to_string(id)), </ins> } }

let message = if let Some(name) = last_generator .and_then(|generator_did| self.tcx.parent(generator_did)) .and_then(|parent_did| self.tcx.hir().as_local_hir_id(parent_did)) <del> .map(|parent_hir_id| self.tcx.hir().name(parent_hir_id)) </del> <ins> .and_then(|parent_hir_id| self.tcx.hir().opt_name(parent_hir_id)) </ins> { format!("future returned by `{}` is not {}", name, trait_name) } else {

<ins> // edition:2018 use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; fn spawn<T: Send>(_: T) {} pub struct AFuture; impl Future for AFuture{ type Output = (); fn poll(mut self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<()> { unimplemented!() } } async fn foo() { spawn(async { //~ ERROR future cannot be sent between threads safely let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` AFuture.await; }); } fn main() {} </ins>

<ins> error: future cannot be sent between threads safely --> $DIR/issue-67252-unnamed-future.rs:18:5 | LL | fn spawn<T: Send>(_: T) {} |    -----    ---- required by this bound in `spawn` ... LL |     spawn(async { |     ^^^^^ future is not `Send` | = help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `*mut ()` note: future is not `Send` as this value is used across an await --> $DIR/issue-67252-unnamed-future.rs:20:9 | LL |         let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` |             -- has type `*mut ()` LL |         AFuture.await; |         ^^^^^^^^^^^^^ await occurs here, with `_a` maybe used later LL |     }); |     - `_a` is later dropped here error: aborting due to previous error </ins>