Bug #16912
closedFiber#raise has a mismatch between implementation and documentation
Description
Fiber#raise has a mismatch between implementation and documentation for "created" fiber.
RDoc:
Raises an exception in the fiber at the point at which the last Fiber.yield was called, or at the start if neither resume nor raise were called before.
https://docs.ruby-lang.org/en/2.7.0/Fiber.html#method-i-raise
If my understanding is correct, it says "Fiber#raise raises an exception at the beginning of the fiber if neither resume nor raise were called before.".
But actually it raises a FiberError. I've confirmed the behavior with both of master and v2.7.0.
$ ruby -ve 'Fiber.new{}.raise'
ruby 2.8.0dev (2020-05-24T14:47:24Z master c6c023317c) [x86_64-linux]
-e:1:in `raise': cannot raise exception on unborn fiber (FiberError)
from -e:1:in `<main>'
This error has been enabled since https://github.com/ruby/ruby/commit/9ee79b658123a2a4af65c80484d1f91ce73354e2.
And the implemented behavior is tested by
https://github.com/ruby/ruby/blob/d1251159e98d0cdb99bab953c8d520409e3255ed/test/ruby/test_fiber.rb#L113-L116.
So I guess the documentation is wrong.