Change:
The following diff: if done in between s, makes the second check fail with: Aside: that error is printed twice, which is also curious. To reproduce, the following snippet fails on the Playground: I've reported it over to avoid defining a duplicate issue, but now that I've noticed it's a regression, I prefer to risk it being a dup than it going unnoticed. I've also mentioned this over: https://rust- This is causing major breakage with users of who have switched to Rust or up, as showcased by: modify labels: +regression-from-stable-to-stable -regression-untriaged
The bug also reproduces when the is above the impl, but only when that does not change the spans of the impl. It also reproduces when the is add in a different file, or when a or an is instead. This suggests to me that this is somehow related to the overall set of DefIds changing. It does not reproduce when the function is non-async. any ideas? Where there any big refactorings during that time frame that could be the cause of this?
Maybe something related to generators / async functions generates numeric IDs based raw DefIndex values which are then not hashed in a stable way?
Bisection seems to point to
That does sound related. might have an idea.
WG-prioritization assigning priority (). label -I-prioritize +P-critical
Let's keep this open until the backporting situation of the fix is clarified.
was backported to 1.63.0-beta in -- ready to close?
Is this worth a stable backport? The experience of developing async code with this issue isn’t great.
I tried a stable backport locally just to see, but it's non-trivial -- builds on changes from and at least, but that's as far as I investigated before giving up. Maybe a more targeted fix for 1.62.0 could be developed though.
Backported to stable.

Discussion:
// (during lowering) and the `librustc_middle` arena (for decoding MIR) [decode] asm_template: rustc_ast::InlineAsmTemplatePiece, [decode] used_trait_imports: rustc_data_structures::fx::FxHashSet<rustc_hir::def_id::LocalDefId>, <ins> [decode] is_late_bound_map: rustc_data_structures::fx::FxIndexSet<rustc_hir::def_id::LocalDefId>, </ins> [decode] impl_source: rustc_middle::traits::ImplSource<'tcx, ()>, [] dep_kind: rustc_middle::dep_graph::DepKindStruct,

Option<&'tcx FxHashMap<ItemLocalId, Region>> { desc { "looking up a named region" } } <del> query is_late_bound_map(_: LocalDefId) -> Option<&'tcx FxHashSet<LocalDefId>> { </del> <ins> query is_late_bound_map(_: LocalDefId) -> Option<&'tcx FxIndexSet<LocalDefId>> { </ins> desc { "testing if a region is late bound" } } /// For a given item (like a struct), gets the default lifetimes to be used

/// "Constrained" basically means that it appears in any type but /// not amongst the inputs to a projection. In other words, `<&'a /// T as Trait<''b>>::Foo` does not constrain `'a` or `'b`. <del> fn is_late_bound_map(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<&FxHashSet<LocalDefId>> { </del> <ins> fn is_late_bound_map(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<&FxIndexSet<LocalDefId>> { </ins> let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); let decl = tcx.hir().fn_decl_by_hir_id(hir_id)?; let generics = tcx.hir().get_generics(def_id)?; <del> let mut late_bound = FxHashSet::default(); </del> <ins> let mut late_bound = FxIndexSet::default(); </ins> let mut constrained_by_input = ConstrainedCollector::default(); for arg_ty in decl.inputs {

<ins> // revisions: rpass1 rpass2 // edition:2021 // See https://github.com/rust-lang/rust/issues/98890 #![allow(unused)] struct Foo; impl Foo { async fn f(&self, _: &&()) -> &() { &() } } #[cfg(rpass2)] enum Bar {} fn main() {} </ins>