diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-07 09:01:49 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-07 18:57:46 +1100 |
| commit | 83adf883a20fc7531e886996ce07b8555c943fba (patch) | |
| tree | 1860c5a825f8b21347593fb146a207f177cdddf8 /compiler/rustc_pattern_analysis/src | |
| parent | e6794ddfb00e14b29b3befc5bc054a15094321b7 (diff) | |
| download | rust-83adf883a20fc7531e886996ce07b8555c943fba.tar.gz rust-83adf883a20fc7531e886996ce07b8555c943fba.zip | |
rustdoc: remove `unchecked_claim_error_was_emitted` call in `main_args`.
`main_args` calls `from_matches`, which does lots of initialization. If anything goes wrong, `from_matches` emits an error message and returns `Err(1)` (or `Err(3)`). `main_args` then turns the `Err(1)` into `Err(ErrorGuaranteed)`, because that's what `catch_with_exit_code` requires on error. But `catch_with_exit_code` doesn't do anything with the `ErrorGuaranteed`, it just exits with `EXIT_FAILURE`. We can avoid the creation of the `ErrorGuaranteed` (which requires an undesirable `unchecked_claim_error_was_emitted` call), by changing `from_matches` to instead eagerly abort if anything goes wrong. The behaviour from the user's point of view is the same: an early abort with an `EXIT_FAILURE` exit code. And we can also simplify `from_matches` to return an `Option` instead of a `Result`: - Old `Err(0)` case --> `None` - Old `Err(_)` case --> fatal error. This requires similar changes to `ScrapeExamplesOptions::new` and `load_call_locations`.
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions
