Skip to content

Commit 677eeb2

Browse files
committed
Fix rust-lang#5121: Early/Late Bound related ICEs.
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.
1 parent 674d5f8 commit 677eeb2

File tree

1 file changed

+6
-1
lines changed
  • src/librustc/middle/typeck/check

1 file changed

+6
-1
lines changed

src/librustc/middle/typeck/check/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,11 @@ pub fn check_item(ccx: &CrateCtxt, it: &ast::Item) {
568568
fn_tpt.generics.region_param_defs.as_slice(),
569569
body.id);
570570

571-
check_bare_fn(ccx, decl, body, it.id, fn_tpt.ty, param_env);
571+
// Compute the fty from point of view of inside fn
572+
// (replace any type-scheme with a type)
573+
let fty = fn_tpt.ty.subst(ccx.tcx, &param_env.free_substs);
574+
575+
check_bare_fn(ccx, decl, body, it.id, fty, param_env);
572576
}
573577
ast::ItemImpl(_, ref opt_trait_ref, _, ref ms) => {
574578
debug!("ItemImpl {} with id {}", token::get_ident(it.ident), it.id);
@@ -679,6 +683,7 @@ fn check_method_body(ccx: &CrateCtxt,
679683
method.body.id);
680684

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

0 commit comments

Comments
 (0)