Skip to content

Commit

Permalink
Run normalize_project_ty in Canonical mode
Browse files Browse the repository at this point in the history
This allows recovering from overflow errors when normalizing a type.
  • Loading branch information
jyn514 committed Nov 28, 2020
1 parent 65ecc48 commit 38d626a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
9 changes: 1 addition & 8 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}

pub fn intercrate(infcx: &'cx InferCtxt<'cx, 'tcx>) -> SelectionContext<'cx, 'tcx> {
SelectionContext {
infcx,
freshener: infcx.freshener(),
intercrate: true,
intercrate_ambiguity_causes: None,
allow_negative_impls: false,
query_mode: TraitQueryMode::Standard,
}
SelectionContext { intercrate: true, ..SelectionContext::new(infcx) }
}

pub fn with_negative(
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_traits/src/normalize_projection_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ fn normalize_projection_ty<'tcx>(
tcx.infer_ctxt().enter_canonical_trait_query(
&goal,
|infcx, fulfill_cx, ParamEnvAnd { param_env, value: goal }| {
let selcx = &mut SelectionContext::new(infcx);
let selcx =
&mut SelectionContext::with_query_mode(infcx, traits::TraitQueryMode::Canonical);
let cause = ObligationCause::dummy();
let mut obligations = vec![];
let answer = traits::normalize_projection_type(
Expand Down

0 comments on commit 38d626a

Please sign in to comment.