Skip to content

Commit 00a0ef4

Browse files
Remove query normalize from dropck outlives type op
1 parent 11067c4 commit 00a0ef4

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

Diff for: compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs

+14-10
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ use rustc_span::{DUMMY_SP, Span};
66
use tracing::{debug, instrument};
77

88
use crate::traits::query::NoSolution;
9-
use crate::traits::query::normalize::QueryNormalizeExt;
10-
use crate::traits::{Normalized, ObligationCause, ObligationCtxt};
9+
use crate::traits::{ObligationCause, ObligationCtxt};
1110

1211
/// This returns true if the type `ty` is "trivial" for
1312
/// dropck-outlives -- that is, if it doesn't require any types to
@@ -172,26 +171,31 @@ pub fn compute_dropck_outlives_inner<'tcx>(
172171
// do not themselves define a destructor", more or less. We have
173172
// to push them onto the stack to be expanded.
174173
for ty in constraints.dtorck_types.drain(..) {
175-
let Normalized { value: ty, obligations } =
176-
ocx.infcx.at(&cause, param_env).query_normalize(ty)?;
177-
ocx.register_obligations(obligations);
174+
let normalized_ty = ocx.normalize(&cause, param_env, ty);
178175

179-
debug!("dropck_outlives: ty from dtorck_types = {:?}", ty);
176+
let errors = ocx.select_where_possible();
177+
if !errors.is_empty() {
178+
debug!("failed to normalize dtorck type: {ty} ~> {errors:#?}");
179+
return Err(NoSolution);
180+
}
181+
182+
let normalized_ty = ocx.infcx.resolve_vars_if_possible(normalized_ty);
183+
debug!("dropck_outlives: ty from dtorck_types = {:?}", normalized_ty);
180184

181-
match ty.kind() {
185+
match normalized_ty.kind() {
182186
// All parameters live for the duration of the
183187
// function.
184188
ty::Param(..) => {}
185189

186190
// A projection that we couldn't resolve - it
187191
// might have a destructor.
188192
ty::Alias(..) => {
189-
result.kinds.push(ty.into());
193+
result.kinds.push(normalized_ty.into());
190194
}
191195

192196
_ => {
193-
if ty_set.insert(ty) {
194-
ty_stack.push((ty, depth + 1));
197+
if ty_set.insert(normalized_ty) {
198+
ty_stack.push((normalized_ty, depth + 1));
195199
}
196200
}
197201
}

0 commit comments

Comments
 (0)