Region checking: this one currently passes, but only "by accident".
This commit is contained in:
parent
af418d97c0
commit
248e439638
21
src/test/compile-fail/regions-fns.rs
Normal file
21
src/test/compile-fail/regions-fns.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// Should fail region checking, because g can only accept a pointer
|
||||
// with lifetime r, and a is a pointer with unspecified lifetime.
|
||||
fn not_ok_1(a: &uint) {
|
||||
let mut g: fn@(x: &uint) = fn@(x: &r.uint) {};
|
||||
//!^ ERROR mismatched types
|
||||
g(a);
|
||||
}
|
||||
|
||||
// Should fail region checking, because g can only accept a pointer
|
||||
// with lifetime r, and a is a pointer with lifetime s.
|
||||
fn not_ok_2(s: &s.uint)
|
||||
{
|
||||
let mut g: fn@(x: &uint) = fn@(x: &r.uint) {};
|
||||
//!^ ERROR mismatched types
|
||||
g(s);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user