Files
ruby/bootstraptest
Edouard CHINandYaroslav Markin cc57f9c818 Include ivar name and class name in the Ractor isolation error message
- ### Problem

  When a Ractor isolation error happens due to setting an ivar on a
  class, the message doesn't include the name of the ivar and neither
  the name of the class. It makes it difficult to track down where the
  isolation problem comes from.

  I'd like the message to be similar as what we get when a Ractor
  access an unshareable ivar.

  This is the current behaviour

  ```ruby
  class Foo
    def self.foo
      @foo ||= "test"
    end
  end

  Ractor.new do
    Foo.foo # can not set instance variables of classes/modules by non-main Ractors
  end.join

  Foo.foo

  Ractor.new do
    Foo.foo # can not get unshareable values from instance variables of classes/modules from non-main Ractors (@foo from Foo)
  end.join
  ```

  ### Solution

  Modify the error message to include the ivar name and the class/module name.

Co-authored-by: Yaroslav Markin <yaroslav@markin.net>
2026-10-22 17:51:23 -04:00
..
2020-04-27 10:39:07 +09:00
2025-12-19 13:36:42 +09:00
2025-05-31 04:01:33 +09:00