Skip to content

Commit 6384917

Browse files
committed
change region inference to not consider & that appears in a fn
type as indicating region parameterization
1 parent 2407373 commit 6384917

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/rustc/middle/region.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,16 @@ fn determine_rp_in_ty(ty: @ast::ty,
485485
_ {}
486486
}
487487

488-
visit::visit_ty(ty, cx, visitor);
488+
alt ty.node {
489+
ast::ty_fn(*) => {
490+
do cx.with(cx.item_id, false) {
491+
visit::visit_ty(ty, cx, visitor);
492+
}
493+
}
494+
_ => {
495+
visit::visit_ty(ty, cx, visitor);
496+
}
497+
}
489498
}
490499

491500
fn determine_rp_in_crate(sess: session,
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
// check that the &int here does not cause us to think that `foo`
3+
// contains region pointers
4+
enum foo = fn~(x: &int);
5+
6+
fn take_foo(x: foo/&) {} //~ ERROR no region bound is allowed on `foo`
7+
8+
fn main() {
9+
}

0 commit comments

Comments
 (0)