Remove query normalize from dropck outlives type op
This commit is contained in:
parent
11067c4742
commit
00a0ef4206
1 changed files with 14 additions and 10 deletions
|
@ -6,8 +6,7 @@ use rustc_span::{DUMMY_SP, Span};
|
|||
use tracing::{debug, instrument};
|
||||
|
||||
use crate::traits::query::NoSolution;
|
||||
use crate::traits::query::normalize::QueryNormalizeExt;
|
||||
use crate::traits::{Normalized, ObligationCause, ObligationCtxt};
|
||||
use crate::traits::{ObligationCause, ObligationCtxt};
|
||||
|
||||
/// This returns true if the type `ty` is "trivial" for
|
||||
/// dropck-outlives -- that is, if it doesn't require any types to
|
||||
|
@ -172,13 +171,18 @@ pub fn compute_dropck_outlives_inner<'tcx>(
|
|||
// do not themselves define a destructor", more or less. We have
|
||||
// to push them onto the stack to be expanded.
|
||||
for ty in constraints.dtorck_types.drain(..) {
|
||||
let Normalized { value: ty, obligations } =
|
||||
ocx.infcx.at(&cause, param_env).query_normalize(ty)?;
|
||||
ocx.register_obligations(obligations);
|
||||
let normalized_ty = ocx.normalize(&cause, param_env, ty);
|
||||
|
||||
debug!("dropck_outlives: ty from dtorck_types = {:?}", ty);
|
||||
let errors = ocx.select_where_possible();
|
||||
if !errors.is_empty() {
|
||||
debug!("failed to normalize dtorck type: {ty} ~> {errors:#?}");
|
||||
return Err(NoSolution);
|
||||
}
|
||||
|
||||
match ty.kind() {
|
||||
let normalized_ty = ocx.infcx.resolve_vars_if_possible(normalized_ty);
|
||||
debug!("dropck_outlives: ty from dtorck_types = {:?}", normalized_ty);
|
||||
|
||||
match normalized_ty.kind() {
|
||||
// All parameters live for the duration of the
|
||||
// function.
|
||||
ty::Param(..) => {}
|
||||
|
@ -186,12 +190,12 @@ pub fn compute_dropck_outlives_inner<'tcx>(
|
|||
// A projection that we couldn't resolve - it
|
||||
// might have a destructor.
|
||||
ty::Alias(..) => {
|
||||
result.kinds.push(ty.into());
|
||||
result.kinds.push(normalized_ty.into());
|
||||
}
|
||||
|
||||
_ => {
|
||||
if ty_set.insert(ty) {
|
||||
ty_stack.push((ty, depth + 1));
|
||||
if ty_set.insert(normalized_ty) {
|
||||
ty_stack.push((normalized_ty, depth + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue