-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extend liveness to treat bindings more like other variables
This results in a lot of warnings in rustc. I left them in because many are bugs and we should fix our code, but Graydon asked that I not touch every file in the codebase.
- Loading branch information
1 parent
aa024ac
commit e47d2f6
Showing
7 changed files
with
158 additions
and
25 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
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
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
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
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
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
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 @@ | ||
struct dtor { | ||
x: @mut int; | ||
|
||
drop { | ||
// abuse access to shared mutable state to write this code | ||
*self.x -= 1; | ||
} | ||
} | ||
|
||
fn unwrap<T>(+o: option<T>) -> T { | ||
match move o { | ||
some(move v) => v, | ||
none => fail | ||
} | ||
} | ||
|
||
fn main() { | ||
let x = @mut 1; | ||
|
||
{ | ||
let b = some(dtor { x:x }); | ||
let c = unwrap(b); | ||
} | ||
|
||
assert *x == 0; | ||
} |
e47d2f6
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.
Awesome.