don't consider use of @fn
to be region-param'd
This commit is contained in:
parent
feca839b9b
commit
5ccf8175a8
@ -655,6 +655,25 @@ fn determine_rp_in_ty(ty: @ast::ty,
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// temporary hack: right now, fn() is short for &fn(), but @(fn())
|
||||
// is `@fn()`, so catch this and set anon_implies_rp to none in
|
||||
// that case
|
||||
match ty.node {
|
||||
ast::ty_box(mt) | ast::ty_uniq(mt) => {
|
||||
match mt.ty.node {
|
||||
ast::ty_fn(ast::proto_bare, _, _) |
|
||||
ast::ty_fn(ast::proto_block, _, _) => {
|
||||
do cx.with(cx.item_id, false) {
|
||||
visit_mt(mt, cx, visitor);
|
||||
}
|
||||
return;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
match ty.node {
|
||||
ast::ty_box(mt) | ast::ty_uniq(mt) | ast::ty_vec(mt) |
|
||||
ast::ty_rptr(_, mt) | ast::ty_ptr(mt) => {
|
||||
|
22
src/test/compile-fail/regions-infer-at-fn-not-param.rs
Normal file
22
src/test/compile-fail/regions-infer-at-fn-not-param.rs
Normal file
@ -0,0 +1,22 @@
|
||||
struct param1 {
|
||||
g: &fn();
|
||||
}
|
||||
|
||||
struct param2 {
|
||||
g: fn();
|
||||
}
|
||||
|
||||
struct not_param1 {
|
||||
g: @fn();
|
||||
}
|
||||
|
||||
struct not_param2 {
|
||||
g: @fn();
|
||||
}
|
||||
|
||||
fn take1(p: param1) -> param1 { p } //~ ERROR mismatched types
|
||||
fn take2(p: param2) -> param2 { p } //~ ERROR mismatched types
|
||||
fn take3(p: not_param1) -> not_param1 { p }
|
||||
fn take4(p: not_param2) -> not_param2 { p }
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user