Rollup merge of #120270 - compiler-errors:randos, r=lcnr
A bunch of random modifications r? oli-obk Kitchen sink of changes that I didn't know where to put elsewhere. Documentation tweaks mostly, but also removing some unreachable code and simplifying the pretty printing for closures/coroutines.
This commit is contained in:
commit
3b1c2eb44c
13 changed files with 59 additions and 93 deletions
|
@ -1,7 +1,7 @@
|
|||
//! Computes a normalizes-to (projection) goal for inherent associated types,
|
||||
//! `#![feature(lazy_type_alias)]` and `#![feature(type_alias_impl_trait)]`.
|
||||
//!
|
||||
//! Since a weak alias is not ambiguous, this just computes the `type_of` of
|
||||
//! Since a weak alias is never ambiguous, this just computes the `type_of` of
|
||||
//! the alias and registers the where-clauses of the type alias.
|
||||
use rustc_middle::traits::solve::{Certainty, Goal, GoalSource, QueryResult};
|
||||
use rustc_middle::ty;
|
||||
|
|
|
@ -232,32 +232,12 @@ pub fn dtorck_constraint_for_ty_inner<'tcx>(
|
|||
Ok::<_, NoSolution>(())
|
||||
})?,
|
||||
|
||||
ty::Closure(_, args) => {
|
||||
if !args.as_closure().is_valid() {
|
||||
// By the time this code runs, all type variables ought to
|
||||
// be fully resolved.
|
||||
|
||||
tcx.dcx().span_delayed_bug(
|
||||
span,
|
||||
format!("upvar_tys for closure not found. Expected capture information for closure {ty}",),
|
||||
);
|
||||
return Err(NoSolution);
|
||||
ty::Closure(_, args) => rustc_data_structures::stack::ensure_sufficient_stack(|| {
|
||||
for ty in args.as_closure().upvar_tys() {
|
||||
dtorck_constraint_for_ty_inner(tcx, param_env, span, depth + 1, ty, constraints)?;
|
||||
}
|
||||
|
||||
rustc_data_structures::stack::ensure_sufficient_stack(|| {
|
||||
for ty in args.as_closure().upvar_tys() {
|
||||
dtorck_constraint_for_ty_inner(
|
||||
tcx,
|
||||
param_env,
|
||||
span,
|
||||
depth + 1,
|
||||
ty,
|
||||
constraints,
|
||||
)?;
|
||||
}
|
||||
Ok::<_, NoSolution>(())
|
||||
})?
|
||||
}
|
||||
Ok::<_, NoSolution>(())
|
||||
})?,
|
||||
|
||||
ty::Coroutine(_, args) => {
|
||||
// rust-lang/rust#49918: types can be constructed, stored
|
||||
|
@ -283,15 +263,6 @@ pub fn dtorck_constraint_for_ty_inner<'tcx>(
|
|||
// derived from lifetimes attached to the upvars and resume
|
||||
// argument, and we *do* incorporate those here.
|
||||
let args = args.as_coroutine();
|
||||
if !args.is_valid() {
|
||||
// By the time this code runs, all type variables ought to
|
||||
// be fully resolved.
|
||||
tcx.dcx().span_delayed_bug(
|
||||
span,
|
||||
format!("upvar_tys for coroutine not found. Expected capture information for coroutine {ty}",),
|
||||
);
|
||||
return Err(NoSolution);
|
||||
}
|
||||
|
||||
// While we conservatively assume that all coroutines require drop
|
||||
// to avoid query cycles during MIR building, we can check the actual
|
||||
|
|
|
@ -141,6 +141,13 @@ where
|
|||
infcx: &InferCtxt<'tcx>,
|
||||
span: Span,
|
||||
) -> Result<TypeOpOutput<'tcx, Self>, ErrorGuaranteed> {
|
||||
// In the new trait solver, query type ops are performed locally. This
|
||||
// is because query type ops currently use the old canonicalizer, and
|
||||
// that doesn't preserve things like opaques which have been registered
|
||||
// during MIR typeck. Even after the old canonicalizer is gone, it's
|
||||
// probably worthwhile just keeping this run-locally logic, since we
|
||||
// probably don't gain much from caching here given the new solver does
|
||||
// caching internally.
|
||||
if infcx.next_trait_solver() {
|
||||
return Ok(scrape_region_constraints(
|
||||
infcx,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue