Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Normalize outside the binder" #976

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions frontend/exporter/src/types/mir_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,16 @@ pub fn solve_item_traits<'tcx, S: UnderOwnerState<'tcx>>(
for (pred, _) in predicates.predicates {
// Explore only the trait predicates
if let Some(trait_clause) = pred.as_trait_clause() {
let poly_trait_ref = trait_clause.map_bound(|clause| clause.trait_ref);
// Apply the substitution
let poly_trait_ref =
rustc_middle::ty::EarlyBinder::bind(poly_trait_ref).instantiate(tcx, generics);
// Warning: this erases regions. We don't really have a way to normalize without
// erasing regions, but this may cause problems in trait solving if there are trait
// impls that include `'static` lifetimes.
let poly_trait_ref = tcx
.try_normalize_erasing_regions(param_env, poly_trait_ref)
.unwrap_or(poly_trait_ref);
let impl_expr = solve_trait(s, poly_trait_ref);
let trait_ref = trait_clause.map_bound(|clause| {
let value = rustc_middle::ty::EarlyBinder::bind(clause.trait_ref);
// Warning: this erases regions. We don't really have a way to substitute without
// erasing regions, but this may cause problems in trait solving if there are trait
// impls that include `'static` lifetimes.
// TODO: try `EarlyBinder::subst(...)`?
tcx.instantiate_and_normalize_erasing_regions(generics, param_env, value)
});
let impl_expr = solve_trait(s, trait_ref);
impl_exprs.push(impl_expr);
}
}
Expand Down
Loading