about summary refs log tree commit diff
path: root/tests/ui/patchable-function-entry
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-05-31 15:43:18 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-06-05 10:38:03 +1000
commite8d02fe1cb20a21e0bee2f80f1e16945eb3b9437 (patch)
tree28132ba2c984db14c00a3fb536532b146697b036 /tests/ui/patchable-function-entry
parent9f4a2dd1475638fda91f5cf54650b55b320575fe (diff)
downloadrust-e8d02fe1cb20a21e0bee2f80f1e16945eb3b9437.tar.gz
rust-e8d02fe1cb20a21e0bee2f80f1e16945eb3b9437.zip
Make top-level `rustc_parse` functions fallible.
Currently we have an awkward mix of fallible and infallible functions:
```
       new_parser_from_source_str
 maybe_new_parser_from_source_str
       new_parser_from_file
(maybe_new_parser_from_file)        // missing
      (new_parser_from_source_file) // missing
 maybe_new_parser_from_source_file
       source_str_to_stream
 maybe_source_file_to_stream
```
We could add the two missing functions, but instead this commit removes
of all the infallible ones and renames the fallible ones leaving us with
these which are all fallible:
```
new_parser_from_source_str
new_parser_from_file
new_parser_from_source_file
source_str_to_stream
source_file_to_stream
```
This requires making `unwrap_or_emit_fatal` public so callers of
formerly infallible functions can still work.

This does make some of the call sites slightly more verbose, but I think
it's worth it for the simpler API. Also, there are two `catch_unwind`
calls and one `catch_fatal_errors` call in this diff that become
removable thanks this change. (I will do that in a follow-up PR.)
Diffstat (limited to 'tests/ui/patchable-function-entry')
0 files changed, 0 insertions, 0 deletions