This website requires JavaScript.
Explore
Help
Register
Sign In
mikros
/
rust
Watch
1
Star
0
Fork
0
You've already forked rust
Code
Issues
Pull Requests
Packages
Projects
Releases
Wiki
Activity
12c32e944d
rust
/
src
/
test
/
compile-fail
/
regions-ret.rs
8 lines
88 B
Rust
Raw
Normal View
History
Unescape
Escape
Fix #2979: inference for lifetimes of & expressions What we now do is to create a region variable for each & expression (and also each borrow). The lifetime of this variable will be checked by borrowck to ensure it is not greater than the lifetime of the underlying data. This both leads to shorter lifetimes in some cases but also longer in others, such as taking the address to the interior of unique boxes tht are rooted in region pointers (e.g., returning a pointer to the interior of a sendable map). This may lead to issue #2977 if the rvalue is not POD, because we may drop the data in trans sooner than borrowck expects us to. Need to work out precisely where that fix ought to occur.
2012-07-26 10:51:57 -05:00
fn
f
(
_x
:
&
a
/
int
)
->
&
a
/
int
{
Convert ret to return
2012-08-01 19:30:05 -05:00
return
&
3
;
//~ ERROR illegal borrow
test: Add a simple test for dangling pointers
2012-03-24 20:59:11 -05:00
}
fn
main
(
)
{
}
Reference in New Issue
Copy Permalink