Commit Graph

33 Commits (master)

Author SHA1 Message Date
Gerd Zellweger 9ca9c72e0e Fix to work with new allocator APIs. 2019-02-08 15:04:26 +00:00
Mark Swanson 1d97ab9d02 Support nightly-may-16-2018 2018-05-26 14:22:15 +00:00
edef b79dcf3d79 Handle liballoc changes 2017-09-10 11:50:21 +02:00
edef df7f261ca6 Expose unsafe_unwrap
This at least ensures we don't have to needlessly leak generators in the
tests, and covers similar use cases for consumers of libfringe.
2017-03-16 22:40:20 +01:00
edef 277e786d3f Panic when an unfinished Generator is dropped 2017-03-16 22:40:20 +01:00
edef 785c7b516a Add tests for Generator::unwrap 2017-03-09 07:59:55 +01:00
edef dcde4fe920 Don't use unsafe for the forget_yielded test
Now that the Send bound is gone, we can simply use a Cell instead of a
raw pointer.
2017-03-06 09:21:08 +01:00
edef 661872f725 Don't implement Send at all
On hosted platforms, libstd allows safely borrowing values from TLS with
'thread lifetime and without a Sync bound. As a result, we can't
guarantee that sending a generator across threads won't create dangling
references or data races. In freestanding environments, the notion of
thread-safety is likely to be defined by the consumer of libfringe,
so our Send bounds and implementation are unlikely to be meaningful
anyway.
2017-03-06 09:21:08 +01:00
edef 34ab0dc2cd Fix should_panic attributes 2017-02-25 14:24:36 +01:00
Amanieu d'Antras fc4cdbf4f5 Clean up the stack implementations
close #54
2016-09-30 21:39:15 -04:00
edef 19ec5ef45b Make the passed Yielder borrow immutable [breaking-change]
Yielder::suspend only requires an immutable reference, and allowing
mem::replace on the yielder isn't very useful.
2016-09-22 14:03:46 -04:00
edef 59f28e92cb Ensure that the closure outlives the generator [breaking-change]
Previously, it was possible to cause unsafety by having the closure
refer to values with lifetimes that weren't enclosed by the generator's
lifetime.
2016-09-22 14:03:46 -04:00
Amanieu d'Antras fff625767c Clean up and simplify the implementation of generators 2016-09-09 10:59:35 -04:00
edef bbfa5a43bc add regression test for #31 2016-08-30 18:26:42 -04:00
whitequark 5a77a01863 Implement OwnedStack. 2016-08-30 12:20:34 -04:00
whitequark 4b32c18f70 Rename Yielder::generate to Yielder::suspend.
This makes more sense, because "generate" implies *running*
a generator, not *returning* from a generator. That name was
a vestige of the time when libfringe only really provided a .next()
implementation, which made marginally more sense together with
.generate(), but it doesn't anymore when we have .resume().
2016-08-30 12:20:34 -04:00
edef f21b8dc936 Update the license headers for MIT/Apache 2016-08-20 23:45:01 +02:00
whitequark f8cf95f686 Implement SliceStack. 2016-08-19 15:12:42 +02:00
whitequark d4b7c427c9 impl Iterator for Generator<Input=()>. 2016-08-13 13:38:04 +02:00
whitequark b79e7c0a9b Rename Stack::top() to Stack::base(), which is correct.
Fixes #25.
2016-08-13 13:38:04 +02:00
whitequark ddbf9a5afe Reimplement Generator to pass both input and output values around. 2016-08-13 13:38:04 +02:00
whitequark a5d3430e63 Make Generator safe in presence of destructors. 2016-08-13 13:38:04 +02:00
edef b1a6b17d0a Move the Context tests and benches into src/
This concludes preparations for making Context private again.
2016-08-13 13:38:04 +02:00
whitequark 892a7696ec Allow unwinding to propagate across a context swap.
The main purpose of this is having nice backtraces in gdb, although
it also slightly simplifies poisoning state of the API consumers
after a panic.
2016-08-13 13:38:04 +02:00
edef 375846bda5 Rewrite the FPE test to not use Context directly 2016-08-09 16:00:17 +02:00
edef 4f7ab38530 Remove copyright year
They're legally meaningless.
2016-07-17 14:12:56 -04:00
whitequark 7ffad26cfd Implement the safe Generator abstraction.
close #24
2016-07-17 13:55:56 -04:00
whitequark 758088c673 Fix Stack::new(0). 2016-07-17 13:55:43 -04:00
whitequark ebd9ca8dec Allocate guard page under existing stack, not in it.
This fixes a segfault when the allocated stack is just one page long.

This also refactors the fringe::os module to use Result consistently.

close #22
2016-07-16 20:54:33 -04:00
edef bc184237cc rename simd -> context_simd
This fixes a spurious rustc warning.
2016-07-16 16:18:58 -04:00
whitequark cbe136b762 Completely rework fringe::Context and fringe::arch.
The new design concerns itself with one thing and exactly one thing:
passing values back and forth with an extern "C" function.
This allows to simplify fringe::arch into a single primitive, swap.

Close #21
2016-07-16 15:04:15 -04:00
John Ericson 65f4b0fd17 Turn the example into a test
Fix #14
2016-04-12 15:14:29 +02:00
edef be21d75814 add (ignored) test for floating point exception state
Thanks, @talchas!
Fix #13
2016-04-12 15:13:47 +02:00