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. --code from <!-- 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. --: This crashes nightly, beta and stable <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
Looks like this is happens during codegen which is why this didn't show up in the test (note the ´check-pass`) ...?
Hmm... this should be normalized somewhere above codegen I think? Curious to investigate though. claim
I suspect that this is caused by a bug in how we handle higher-ranked region variables (possibly during trait selection caching).

Discussion:
use rustc_query_system::cache::Cache; pub type SelectionCache<'tcx> = Cache< <del> ty::ParamEnvAnd<'tcx, ty::TraitPredicate<'tcx>>, </del> <ins> // This cache does not use `ParamEnvAnd` in its keys because `ParamEnv::and` can replace // caller bounds with an empty list if the `TraitPredicate` looks global, which may happen // after erasing lifetimes from the predicate. (ty::ParamEnv<'tcx>, ty::TraitPredicate<'tcx>), </ins> SelectionResult<'tcx, SelectionCandidate<'tcx>>, >; <del> pub type EvaluationCache<'tcx> = Cache<ty::ParamEnvAnd<'tcx, ty::PolyTraitPredicate<'tcx>>, EvaluationResult>; </del> <ins> pub type EvaluationCache<'tcx> = Cache< // See above: this cache does not use `ParamEnvAnd` in its keys due to sometimes incorrectly // caching with the wrong `ParamEnv`. (ty::ParamEnv<'tcx>, ty::PolyTraitPredicate<'tcx>), EvaluationResult, >; </ins> /// The selection process begins by considering all impls, where /// clauses, and so forth that might resolve an obligation. Sometimes

let tcx = self.tcx(); if self.can_use_global_caches(param_env) { <del> if let Some(res) = tcx.evaluation_cache.get(&param_env.and(trait_pred), tcx) { </del> <ins> if let Some(res) = tcx.evaluation_cache.get(&(param_env, trait_pred), tcx) { </ins> return Some(res); } } <del> self.infcx.evaluation_cache.get(&param_env.and(trait_pred), tcx) </del> <ins> self.infcx.evaluation_cache.get(&(param_env, trait_pred), tcx) </ins> } fn insert_evaluation_cache(

// FIXME: Due to #50507 this overwrites the different values // This should be changed to use HashMapExt::insert_same // when that is fixed <del> self.tcx().evaluation_cache.insert(param_env.and(trait_pred), dep_node, result); </del> <ins> self.tcx().evaluation_cache.insert((param_env, trait_pred), dep_node, result); </ins> return; } } debug!(?trait_pred, ?result, "insert_evaluation_cache"); <del> self.infcx.evaluation_cache.insert(param_env.and(trait_pred), dep_node, result); </del> <ins> self.infcx.evaluation_cache.insert((param_env, trait_pred), dep_node, result); </ins> } /// For various reasons, it's possible for a subobligation

pred.remap_constness(tcx, &mut param_env); if self.can_use_global_caches(param_env) { <del> if let Some(res) = tcx.selection_cache.get(&param_env.and(pred), tcx) { </del> <ins> if let Some(res) = tcx.selection_cache.get(&(param_env, pred), tcx) { </ins> return Some(res); } } <del> self.infcx.selection_cache.get(&param_env.and(pred), tcx) </del> <ins> self.infcx.selection_cache.get(&(param_env, pred), tcx) </ins> } /// Determines whether can we safely cache the result

if !candidate.needs_infer() { debug!(?pred, ?candidate, "insert_candidate_cache global"); // This may overwrite the cache with the same value. <del> tcx.selection_cache.insert(param_env.and(pred), dep_node, candidate); </del> <ins> tcx.selection_cache.insert((param_env, pred), dep_node, candidate); </ins> return; } } } debug!(?pred, ?candidate, "insert_candidate_cache local"); <del> self.infcx.selection_cache.insert(param_env.and(pred), dep_node, candidate); </del> <ins> self.infcx.selection_cache.insert((param_env, pred), dep_node, candidate); </ins> } /// Matches a predicate against the bounds of its self type.

<del> // check-pass </del> <ins> // build-pass </ins> // edition:2018 type BoxFuture<T> = std::pin::Pin<Box<dyn std::future::Future<Output=T>>>;

where S: Storage, for<'a> SaveUser<'a>: StorageRequest<S>, <ins> for<'a> SaveUser<'a>: StorageRequestReturnType, </ins> { User { dep }.save().await; }