-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61443dc
commit 7067561
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// exec-env:RUST_POISON_ON_FREE=1 | ||
|
||
// Test that we root `x` even though it is found in immutable memory, | ||
// because it is moved. | ||
|
||
#[feature(managed_boxes)]; | ||
|
||
fn free<T>(x: @T) {} | ||
|
||
struct Foo { | ||
f: @Bar | ||
} | ||
|
||
struct Bar { | ||
g: int | ||
} | ||
|
||
fn lend(x: @Foo) -> int { | ||
let y = &x.f.g; | ||
free(x); // specifically here, if x is not rooted, it will be freed | ||
*y | ||
} | ||
|
||
pub fn main() { | ||
assert_eq!(lend(@Foo {f: @Bar {g: 22}}), 22); | ||
} |
7067561
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from alexcrichton
at alexcrichton@7067561
7067561
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging alexcrichton/rust/issue-3053 = 7067561 into auto
7067561
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alexcrichton/rust/issue-3053 = 7067561 merged ok, testing candidate = 18084be
7067561
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/2763
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-c/builds/608
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-t/builds/608
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/2767
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/1873
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/1872
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/2779
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/1871
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/1872
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/2781
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/1871
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/1871
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/1947
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2768
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/1872
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/1874
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/2543
7067561
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = 18084be