Skip to content

Commit 38d626a

Browse files
committed
Run normalize_project_ty in Canonical mode
This allows recovering from overflow errors when normalizing a type.
1 parent 65ecc48 commit 38d626a

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

compiler/rustc_trait_selection/src/traits/select/mod.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
223223
}
224224

225225
pub fn intercrate(infcx: &'cx InferCtxt<'cx, 'tcx>) -> SelectionContext<'cx, 'tcx> {
226-
SelectionContext {
227-
infcx,
228-
freshener: infcx.freshener(),
229-
intercrate: true,
230-
intercrate_ambiguity_causes: None,
231-
allow_negative_impls: false,
232-
query_mode: TraitQueryMode::Standard,
233-
}
226+
SelectionContext { intercrate: true, ..SelectionContext::new(infcx) }
234227
}
235228

236229
pub fn with_negative(

compiler/rustc_traits/src/normalize_projection_ty.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ fn normalize_projection_ty<'tcx>(
2424
tcx.infer_ctxt().enter_canonical_trait_query(
2525
&goal,
2626
|infcx, fulfill_cx, ParamEnvAnd { param_env, value: goal }| {
27-
let selcx = &mut SelectionContext::new(infcx);
27+
let selcx =
28+
&mut SelectionContext::with_query_mode(infcx, traits::TraitQueryMode::Canonical);
2829
let cause = ObligationCause::dummy();
2930
let mut obligations = vec![];
3031
let answer = traits::normalize_projection_type(

0 commit comments

Comments
 (0)