diff options
author | Nobuyoshi Nakada <[email protected]> | 2022-10-26 19:43:14 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2022-10-26 19:43:14 +0900 |
commit | 131c31a9209c61f84d318aa18b61f468f48b8219 (patch) | |
tree | 72dd4a22a3c25f7a912a64adcf2061a3999fd035 /ractor.rb | |
parent | a14611cd54d2ac02daad5ccfe99fc3ec9b0818bd (diff) |
[Bug #19081] Show the caller location in warning for Ractor
The internal location in ractor.rb is not usefull at all.
```
$ ruby -e 'Ractor.new {}'
<internal:ractor>:267: warning: Ractor is experimental, ...
```
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6629
Merged-By: nobu <[email protected]>
Diffstat (limited to 'ractor.rb')
-rw-r--r-- | ractor.rb | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -262,6 +262,10 @@ class Ractor def self.new(*args, name: nil, &block) b = block # TODO: builtin bug raise ArgumentError, "must be called with a block" unless block + if __builtin_cexpr!("RBOOL(ruby_single_main_ractor)") + warn("Ractor is experimental, and the behavior may change in future versions of Ruby! " \ + "Also there are many implementation issues.", uplevel: 0, category: :experimental) + end loc = caller_locations(1, 1).first loc = "#{loc.path}:#{loc.lineno}" __builtin_ractor_create(loc, name, args, b) |