From 7ea7606874ea38acfa0bc332f1c3e135bb57859c Mon Sep 17 00:00:00 2001 From: Brian Koropoff Date: Sat, 1 Nov 2014 14:59:22 -0700 Subject: [PATCH] Monomorphize method types in Typer impl for BlockS In some obscure circumstances, failure to do this can cause unsubstituted type parameters to show up where they aren't expected and cause an ICE. Closes #18514 --- src/librustc/middle/trans/common.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 60b107c049f4..8b5e82ecf901 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -502,7 +502,11 @@ impl<'blk, 'tcx> mc::Typer<'tcx> for BlockS<'blk, 'tcx> { } fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option { - self.tcx().method_map.borrow().find(&method_call).map(|method| method.ty) + self.tcx() + .method_map + .borrow() + .find(&method_call) + .map(|method| monomorphize_type(self, method.ty)) } fn adjustments<'a>(&'a self) -> &'a RefCell> {