Skip to content

Commit

Permalink
Fix rust-lang#5121: Early/Late Bound related ICEs.
Browse files Browse the repository at this point in the history
The problem was that we need to apply the substitution, so that the
formal lifetime parameters get replaced with (unifiable)
free-lifetimes that can actually be fed into the constraint solver.
  • Loading branch information
pnkfelix committed Mar 25, 2014
1 parent 674d5f8 commit 677eeb2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/librustc/middle/typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,11 @@ pub fn check_item(ccx: &CrateCtxt, it: &ast::Item) {
fn_tpt.generics.region_param_defs.as_slice(),
body.id);

check_bare_fn(ccx, decl, body, it.id, fn_tpt.ty, param_env);
// Compute the fty from point of view of inside fn
// (replace any type-scheme with a type)
let fty = fn_tpt.ty.subst(ccx.tcx, &param_env.free_substs);

check_bare_fn(ccx, decl, body, it.id, fty, param_env);
}
ast::ItemImpl(_, ref opt_trait_ref, _, ref ms) => {
debug!("ItemImpl {} with id {}", token::get_ident(it.ident), it.id);
Expand Down Expand Up @@ -679,6 +683,7 @@ fn check_method_body(ccx: &CrateCtxt,
method.body.id);

// Compute the fty from point of view of inside fn
// (replace any type-scheme with a type)
let fty = ty::node_id_to_type(ccx.tcx, method.id);
let fty = fty.subst(ccx.tcx, &param_env.free_substs);

Expand Down

0 comments on commit 677eeb2

Please sign in to comment.