Граф коммитов

570 Коммитов

Автор SHA1 Сообщение Дата
Chris Seaton 31b2cd38c5 Include JIT information in crash reports
Since enabling YJIT or MJIT drastically changes what could go wrong at
runtime, it's good to be front and center about whether they are enabled
when dumping a crash report. Previously, `RUBY_DESCRIPTION` and the
description printed when crashing can be different when a JIT is on.

Introduce a new internal data global, `rb_dynamic_description`, and set
it to be the same as `RUBY_DESCRIPTION` during initialization; use it
when crashing.

 * version.c: Init_ruby_description(): Initialize and use
       `rb_dynamic_description`.
 * error.c: Change crash reports to use `rb_dynamic_description`.
 * ruby.c: Call `Init_ruby_description()` earlier. Slightly more work
       for when we exit right after printing the description but that
       was deemed acceptable.
 * include/ruby/version.h: Talk about how JIT info is not in
      `ruby_description`.
 * test/-ext-/bug_reporter/test_bug_reporter.rb: Remove handling for
       crash description being different from `RUBY_DESCRIPTION`.
 * test/ruby/test_rubyoptions.rb: ditto

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: Alan Wu <alanwu@ruby-lang.org>
2022-06-20 17:18:29 -04:00
Nobuyoshi Nakada a58611dfb1 Allow to just warn as bool expected, without an exception 2022-06-20 19:35:12 +09:00
Nobuyoshi Nakada ccfbcc7302
[DOC] RDoc now accepts other than magic numbers at `rb_attr` 2022-06-08 11:55:21 +09:00
Yusuke Endoh b9f030954a Revert "error.c: Let Exception#inspect inspect its message"
This reverts commit 9d927204e7.
2022-06-07 11:52:44 +09:00
Yusuke Endoh 9d927204e7 error.c: Let Exception#inspect inspect its message
... only when the message string has a newline.

`p StandardError.new("foo\nbar")` now prints `#<StandardError: "foo\nbar">'
instead of:

    #<StandardError:
    bar>

[Bug #18170]
2022-06-07 11:07:09 +09:00
Nobuyoshi Nakada ed2dd17294
Use RBOOL 2022-06-05 14:21:01 +09:00
Nobuyoshi Nakada 7e52533104
No fallback to default values 2022-05-21 22:58:45 +09:00
Yusuke Endoh 25b0577c92 Factor a "highlight" symbol out 2022-02-22 11:55:40 +09:00
Yusuke Endoh 4db986431a Let Exception#full_message pass highlight keywords to #detailed_message
.. even when the argument is not explicitly passed.
2022-02-22 11:55:40 +09:00
Yusuke Endoh 98ca99cdd0 The default highlight arguments of Exception#detailed_message is false 2022-02-22 11:55:40 +09:00
Yusuke Endoh 35ff545bb6 Exception#detailed_message is added
Also, the default error printer and Exception#full_message use the
method instead of `Exception#message` to get the message string.

`Exception#detailed_message` calls `Exception#message`, decorates and
returns the result. It adds some escape sequences to highlight, and the
class name of the exception to the end of the first line of the message.

[Feature #18370]
2022-02-22 11:55:40 +09:00
Yusuke Endoh 36e31b09cd error.c: Refactoring
Factor out from rb_error_write the responsibility to check if stderr is
a tty.
2022-02-22 11:55:40 +09:00
Jeremy Evans 9e0a91d064 Don't segfault if Warning.warn is undefined
Check that there is a method entry for the method before passing
it to rb_method_entry_arity.

Fixes [Bug #18458]
2022-01-04 10:03:18 -08:00
Nobuyoshi Nakada 39bc5de833
Remove tainted and trusted features
Already these had been announced to be removed in 3.2.
2021-12-26 23:28:54 +09:00
S.H 75aae66c4f
Some codes replace to `RBOOL` macro (#5023)
* Some code replace and using RBOOL macro

* Fix indent

* Using RBOOL in syserr_eqq function
2021-11-09 17:09:29 +09:00
S.H a46c220320
Add `rb_mod_exc_raise` function and replace duplicate code 2021-10-30 19:24:41 +09:00
S.H dc9112cf10
Using NIL_P macro instead of `== Qnil` 2021-10-03 22:34:45 +09:00
S.H b8c3a84bdd
Refactor and Using RBOOL macro 2021-09-15 08:11:05 +09:00
卜部昌平 dddc618d30 suppress GCC's -Wsuggest-attribute=format
I was not aware of this because I use clang these days.
2021-09-10 20:00:06 +09:00
卜部昌平 1b6245ccdc include/ruby/internal/error.h: add doxygen
Must not be a bad idea to improve documents.
2021-09-10 20:00:06 +09:00
Kazuki Tsujimoto 4568ba0711
Show verbose error messages when single pattern match fails
[0] => [0, *, a]
    #=> [0] length mismatch (given 1, expected 2+) (NoMatchingPatternError)

Ignore test failures of typeprof caused by this change for now.
2021-08-15 09:38:24 +09:00
Nobuyoshi Nakada 97efd48fb1
Get rid of unintented recursion when RUBY_DEBUG 2021-08-14 23:12:31 +09:00
Nobuyoshi Nakada 1bd021a789 Mark internal class names 2021-08-14 23:11:58 +09:00
Nobuyoshi Nakada 58d82eacef Add some "cold" marks 2021-08-14 23:11:58 +09:00
Nobuyoshi Nakada edd27e120e A comment for typed data in `rb_check_type` [ci skip] 2021-08-14 23:11:58 +09:00
S.H 378e8cdad6
Using RBOOL macro 2021-08-02 12:06:44 +09:00
Kazuhiro NISHIYAMA 2e67043041
Use UNREACHABLE instead of fall through 2021-07-20 14:46:46 +09:00
Kazuhiro NISHIYAMA 036f26a4e2
Add `fall through`
Pointed out by Coverity Scan

```
** CID 1487522: Control flow issues (MISSING_BREAK)
/error.c: 1273 in exc_full_message()
```
2021-07-19 17:21:45 +09:00
Nobuyoshi Nakada 8a6ef5ef8f
Make boolean expected messages more consitent 2021-07-18 20:51:30 +09:00
Nobuyoshi Nakada 94bd3bde81 Specify version to remove as bare numbers 2021-06-30 10:47:01 +09:00
Nobuyoshi Nakada 0b726924a4 Show the removal version 2021-06-30 10:47:01 +09:00
Nobuyoshi Nakada 8118d435d0 rb_warn_deprecated_to_remove_at [Feature #17432]
At compilation time with RUBY_DEBUG enabled, check if the removal
version has been reached.
2021-06-30 10:47:01 +09:00
Adam Daniels f64d7674f6 Fix example for custom warn method
Regexp has a match? method.

[ci skip]
2021-04-30 17:13:04 -07:00
S-H-GAMELINKS e398a0e53a Remove unneeded rb_ident_hash_new function declaration 2021-03-28 08:50:25 +09:00
Kenichi Kamiya 0a544c0c35
Fix segmentation fault when `Module#name` returns non string value [Bug #17754]
* Add test for NoMethodError#to_s does not segfault

* Ensure no segfault even if Module#name is overridden
2021-03-28 08:47:42 +09:00
Garen Torikian 34c422b678 Fix grammatical error 2021-02-06 13:02:17 -05:00
Nobuyoshi Nakada 1cdae49d39 Implement NameError::message#clone for Ractor 2021-02-01 19:54:21 +09:00
xtkoba (Tee KOBAYASHI) 0e5fbec816
Fixed varargs in `rb_bug_without_die` [Bug #17603] 2021-02-01 13:47:35 +09:00
Nobuyoshi Nakada 2556cd3f51 Bypass check for warning_category on internal calls 2020-12-28 12:44:03 +09:00
Kazuki Tsujimoto 31b17a14ab
Make NoMatchingPatternError a subclass of StandardError 2020-12-23 02:31:02 +09:00
卜部昌平 c30f03d328 Data: delete
Has been deprecated since 684bdf6171.

Matz says in [ruby-core:83954] that Data should be an alias of Object.
Because rb_cData has not been deprecated, let us deprecate the constant
to make it a C-level synonym of rb_cObject.
2020-12-22 02:51:49 +09:00
Jeremy Evans 7e2dbbda35 Use category: :experimental in warnings that are related to experimental features
This adds rb_category_compile_warn in order to emit compiler warnings
with categories.  Note that Ripper currently ignores the category
for these warnings, but by default it ignores the warnings completely,
so this shouldn't matter.
2020-12-18 09:54:11 -08:00
Jeremy Evans 6ced55b07c Make warning_categories a map of category symbols to category numbers
Use this to simplify rb_warning_category_from_name.

This also adds support for using the :experimental category in
Kernel#warn and Warning.warn.
2020-12-18 09:54:11 -08:00
Jeremy Evans 52fb696ee7 Switch rb_category_warn{,ing} to accept an rb_warning_category_t
Since we decided to only allowing specific warning categories,
there is no reason to have an API that accepts a general string,
as it is more error-prone.  Switch to only allowing the specific
warning categories.

As rb_category_warn{,ing} are public API, this requires making
rb_warning_category_t public API as well.
2020-12-18 09:54:11 -08:00
Nobuyoshi Nakada ce6fafb8cc
Cache warning category IDs 2020-12-15 15:19:23 +09:00
Alan Wu befa24488c Help RDoc find Exception [ci skip]
This was on top of `Init_Exception()`.
2020-12-14 20:01:01 -05:00
Nobuyoshi Nakada 2749123e21
Supported category option in Warning#warn 2020-12-08 22:50:45 +09:00
Nobuyoshi Nakada d7a16670c3
[DOC] Fixed RDoc directives [ci skip] 2020-12-08 18:02:31 +09:00
Takashi Kokubun 4dbf6f1e51
Call rb_bug_without_die on CI
when GC.compact's SEGV handler is installed
2020-11-26 20:09:57 -08:00
Benoit Daloze cffdacb15a Ignore <internal: entries from core library methods for Kernel#warn(message, uplevel: n)
* Fixes [Bug #17259]
2020-10-26 08:47:33 +01:00