rust/compiler/rustc_parse/src/parser
Nicholas Nethercote b9037339cb 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.)
2024-06-05 10:38:03 +10:00
..
mut_visit Move some tests from rustc_expand to rustc_parse. 2024-05-06 09:06:02 +10:00
tokenstream Move some tests from rustc_expand to rustc_parse. 2024-05-06 09:06:02 +10:00
attr.rs Inline and remove parse_crate{,_attrs}_from_{file,source_str}. 2024-06-05 10:38:02 +10:00
attr_wrapper.rs Simplify static_assert_sizes. 2024-04-18 15:36:25 +10:00
diagnostics.rs Remove #[macro_use] extern crate tracing from rustc_parse. 2024-05-23 18:02:40 +10:00
expr.rs Remove #[macro_use] extern crate tracing from rustc_parse. 2024-05-23 18:02:40 +10:00
generics.rs Parsing , pre-lowering support for precise captures 2024-04-15 16:45:01 -04:00
item.rs Remove #[macro_use] extern crate tracing from rustc_parse. 2024-05-23 18:02:40 +10:00
mod.rs Create const block DefIds in typeck instead of ast lowering 2024-05-28 13:38:43 +00:00
nonterminal.rs Avoid checking the edition as much as possible 2024-06-02 09:42:21 +02:00
pat.rs Remove a Span from TokenKind::Interpolated. 2024-05-13 10:30:30 +10:00
path.rs Rename HIR TypeBinding to AssocItemConstraint and related cleanup 2024-05-30 22:52:33 +02:00
stmt.rs Rollup merge of #125049 - dtolnay:castbrace, r=compiler-errors 2024-05-22 19:04:44 +02:00
tests.rs Make top-level rustc_parse functions fallible. 2024-06-05 10:38:03 +10:00
ty.rs Reject CVarArgs in parse_ty_for_where_clause 2024-06-01 20:57:15 +02:00