@@ -6,8 +6,7 @@ use rustc_span::{DUMMY_SP, Span};
6
6
use tracing:: { debug, instrument} ;
7
7
8
8
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 } ;
11
10
12
11
/// This returns true if the type `ty` is "trivial" for
13
12
/// dropck-outlives -- that is, if it doesn't require any types to
@@ -172,26 +171,31 @@ pub fn compute_dropck_outlives_inner<'tcx>(
172
171
// do not themselves define a destructor", more or less. We have
173
172
// to push them onto the stack to be expanded.
174
173
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) ;
178
175
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) ;
180
184
181
- match ty . kind ( ) {
185
+ match normalized_ty . kind ( ) {
182
186
// All parameters live for the duration of the
183
187
// function.
184
188
ty:: Param ( ..) => { }
185
189
186
190
// A projection that we couldn't resolve - it
187
191
// might have a destructor.
188
192
ty:: Alias ( ..) => {
189
- result. kinds . push ( ty . into ( ) ) ;
193
+ result. kinds . push ( normalized_ty . into ( ) ) ;
190
194
}
191
195
192
196
_ => {
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 ) ) ;
195
199
}
196
200
}
197
201
}
0 commit comments