change region inference to not consider & that appears in a fn

type as indicating region parameterization
This commit is contained in:
Niko Matsakis 2012-07-27 14:51:46 -07:00
parent 2407373fa4
commit 638491712e
2 changed files with 19 additions and 1 deletions

View File

@ -485,7 +485,16 @@ fn determine_rp_in_ty(ty: @ast::ty,
_ {}
}
visit::visit_ty(ty, cx, visitor);
alt ty.node {
ast::ty_fn(*) => {
do cx.with(cx.item_id, false) {
visit::visit_ty(ty, cx, visitor);
}
}
_ => {
visit::visit_ty(ty, cx, visitor);
}
}
}
fn determine_rp_in_crate(sess: session,

View File

@ -0,0 +1,9 @@
// check that the &int here does not cause us to think that `foo`
// contains region pointers
enum foo = fn~(x: &int);
fn take_foo(x: foo/&) {} //~ ERROR no region bound is allowed on `foo`
fn main() {
}