code_ownership 2.1.4 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.cargo/config +2 -2
- data/Cargo.lock +6 -59
- data/ext/cargo-vendor/codeowners-0.5.0/.cargo-checksum.json +1 -0
- data/ext/cargo-vendor/codeowners-0.5.0/.github/workflows/audit.yml +31 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/.github/workflows/ci.yml +11 -0
- data/ext/cargo-vendor/codeowners-0.5.0/.github/workflows/codeql.yml +21 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/Cargo.lock +27 -115
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/Cargo.toml +44 -3
- data/ext/cargo-vendor/codeowners-0.5.0/perf/README.md +204 -0
- data/ext/cargo-vendor/codeowners-0.5.0/perf/compare.sh +23 -0
- data/ext/cargo-vendor/codeowners-0.5.0/perf/run.sh +28 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/rust-toolchain.toml +1 -1
- data/ext/cargo-vendor/codeowners-0.5.0/src/bin/codeowners-perf.rs +719 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/cache/file.rs +9 -9
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/cache/mod.rs +4 -4
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/cache/noop.rs +4 -4
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/cli.rs +7 -7
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/main.rs +3 -3
- data/ext/cargo-vendor/codeowners-0.5.0/src/ownership/file_owner_resolver.rs +829 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/validator.rs +108 -15
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership.rs +22 -3
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/project.rs +4 -4
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/project_builder.rs +40 -14
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/project_file_builder.rs +2 -2
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/runner/api.rs +8 -5
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/runner/types.rs +1 -2
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/runner.rs +39 -29
- data/ext/cargo-vendor/codeowners-0.5.0/tests/annotation_in_unowned_team_glob_test.rs +64 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/common/mod.rs +1 -1
- data/ext/cargo-vendor/codeowners-0.5.0/tests/directory_codeowner_github_team_test.rs +22 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/empty_directory_codeowner_test.rs +26 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/annotation_in_unowned_team_glob/.github/CODEOWNERS +18 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/annotation_in_unowned_team_glob/config/code_ownership.yml +4 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/annotation_in_unowned_team_glob/config/teams/alpha.yml +7 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/annotation_in_unowned_team_glob/config/teams/beta.yml +3 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/annotation_in_unowned_team_glob/ruby/app/services/alpha_owned.rb +2 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/annotation_in_unowned_team_glob/ruby/app/services/beta_owned.rb +4 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/directory-codeowner-github-team/.github/CODEOWNERS +15 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/directory-codeowner-github-team/app/by_handle/.codeowner +1 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/directory-codeowner-github-team/app/by_handle/handled.rb +2 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/directory-codeowner-github-team/app/by_name/named.rb +2 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/empty-directory-codeowner/.github/CODEOWNERS +14 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/empty-directory-codeowner/app/services/.codeowner +1 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/empty-directory-codeowner/app/services/nested/.codeowner +1 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/empty-directory-codeowner/app/services/nested/nested_file.rb +2 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/empty-directory-codeowner/config/code_ownership.yml +10 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/empty-directory-codeowner/config/teams/foo.yml +5 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/invalid-directory-codeowner/.github/CODEOWNERS +14 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/invalid-directory-codeowner/app/services/.codeowner +1 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/invalid-directory-codeowner/app/services/nested/.codeowner +1 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/invalid-directory-codeowner/app/services/nested/nested_file.rb +2 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/invalid-directory-codeowner/config/code_ownership.yml +10 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/invalid-directory-codeowner/config/teams/foo.yml +5 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/multiple-directory-owners/app/services/.codeowner +1 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/multiple-directory-owners/config/code_ownership.yml +10 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/fixtures/multiple-directory-owners/config/teams/foo.yml +5 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/global_gitignore_test.rs +50 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/invalid_directory_codeowner_test.rs +26 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/invalid_project_test.rs +9 -9
- data/ext/cargo-vendor/codeowners-0.5.0/tests/perf_harness_test.rs +245 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/untracked_new_file_test.rs +63 -0
- data/ext/cargo-vendor/codeowners-0.5.0/tests/untracked_source_file_test.rs +40 -0
- data/ext/cargo-vendor/error-stack-0.8.0/.cargo-checksum.json +1 -0
- data/ext/cargo-vendor/error-stack-0.8.0/.cargo_vcs_info.json +6 -0
- data/ext/cargo-vendor/error-stack-0.8.0/.justfile +16 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/CHANGELOG.md +50 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/Cargo.lock +253 -310
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/Cargo.toml +107 -52
- data/ext/cargo-vendor/error-stack-0.8.0/Cargo.toml.orig +109 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/README.md +16 -18
- data/ext/cargo-vendor/error-stack-0.8.0/build.rs +28 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/examples/demo.rs +21 -19
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/examples/detect.rs +6 -6
- data/ext/cargo-vendor/error-stack-0.8.0/examples/exit_code.rs +25 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/examples/parse_config.rs +5 -5
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/compat/anyhow.rs +7 -7
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/compat/eyre.rs +7 -6
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/compat/mod.rs +7 -9
- data/ext/cargo-vendor/error-stack-0.8.0/src/context.rs +52 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/error.rs +2 -9
- data/ext/cargo-vendor/error-stack-0.8.0/src/ext/iter.rs +286 -0
- data/ext/cargo-vendor/error-stack-0.8.0/src/ext/mod.rs +19 -0
- data/ext/cargo-vendor/error-stack-0.8.0/src/ext/stream.rs +212 -0
- data/ext/cargo-vendor/error-stack-0.8.0/src/ext/tuple.rs +218 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/fmt/charset.rs +12 -12
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/fmt/color.rs +30 -30
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/fmt/config.rs +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/fmt/hook.rs +23 -24
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/fmt/location.rs +3 -3
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/fmt/mod.rs +62 -52
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/frame/frame_impl.rs +12 -15
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/frame/kind.rs +11 -10
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/frame/mod.rs +8 -10
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/future.rs +57 -63
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/hook/context.rs +18 -20
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/hook/mod.rs +16 -15
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/iter.rs +12 -57
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/lib.rs +99 -87
- data/ext/cargo-vendor/error-stack-0.8.0/src/macros.rs +212 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/report.rs +525 -207
- data/ext/cargo-vendor/error-stack-0.8.0/src/result.rs +137 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/serde.rs +53 -38
- data/ext/cargo-vendor/error-stack-0.8.0/src/sink.rs +672 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/common.rs +36 -24
- data/ext/cargo-vendor/error-stack-0.8.0/tests/compiletest.rs +22 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__charset_ascii.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__charset_utf8.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__diagnostics_add.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__doc.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__emit.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__emit_alt.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__hookcontext_cast.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__hookcontext_decrement.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__hookcontext_emit.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__hookcontext_increment.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__hookcontext_storage.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__preference_color.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__preference_emphasis.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt__preference_none.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/fmt_doc_alt.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/hook__debug_hook.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/hook__debug_hook_provide.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/lib__suggestion.snap +2 -2
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/report_debug__doc.snap +3 -3
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__complex.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__hook_location.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__linear.snap +2 -2
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__linear_ext.snap +2 -2
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__multiline_context.snap +3 -3
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__sources.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__sources_transparent.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__sources_nested.snap +10 -10
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap +10 -10
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__sources_nested_alternate.snap +10 -10
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap +10 -10
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_serialize__attachment.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_serialize__context.snap +1 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_serialize__multiple_sources.snap +2 -2
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_serialize__multiple_sources_at_root.snap +2 -2
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_attach.rs +41 -15
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_attach_printable.rs +14 -15
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_backtrace.rs +0 -1
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_change_context.rs +31 -9
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_compatibility.rs +8 -17
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_conversion.rs +25 -3
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_debug.rs +91 -91
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_display.rs +8 -9
- data/ext/cargo-vendor/error-stack-0.8.0/tests/test_downcast.rs +101 -0
- data/ext/cargo-vendor/error-stack-0.8.0/tests/test_extend.rs +99 -0
- data/ext/cargo-vendor/error-stack-0.8.0/tests/test_frame.rs +136 -0
- data/ext/cargo-vendor/error-stack-0.8.0/tests/test_iter.rs +132 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_macros.rs +5 -31
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_provision.rs +3 -2
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_serialize.rs +14 -14
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/test_span_trace.rs +10 -11
- data/ext/cargo-vendor/error-stack-0.8.0/tests/ui/attach_diagnostics.rs +21 -0
- data/ext/cargo-vendor/error-stack-0.8.0/tests/ui/attach_diagnostics.stderr +23 -0
- data/ext/cargo-vendor/error-stack-0.8.0/tests/ui/frames_mut_escape.rs +28 -0
- data/ext/cargo-vendor/error-stack-0.8.0/tests/ui/frames_mut_escape.stderr +13 -0
- data/ext/cargo-vendor/error-stack-0.8.0/tests/ui/macro_invalid_args.rs +32 -0
- data/ext/cargo-vendor/error-stack-0.8.0/tests/ui/macro_invalid_args.stderr +132 -0
- data/ext/cargo-vendor/error-stack-0.8.0/tests/ui/missing_args.rs +32 -0
- data/ext/cargo-vendor/error-stack-0.8.0/tests/ui/missing_args.stderr +35 -0
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/ui/must_use.rs +3 -3
- data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/ui/must_use.stderr +1 -1
- data/ext/code_ownership/Cargo.toml +1 -1
- data/ext/code_ownership/src/lib.rs +13 -1
- data/lib/code_ownership/version.rb +1 -1
- data/lib/code_ownership.rb +3 -0
- metadata +340 -431
- data/ext/cargo-vendor/ahash-0.7.8/.cargo-checksum.json +0 -1
- data/ext/cargo-vendor/ahash-0.7.8/.cargo_vcs_info.json +0 -6
- data/ext/cargo-vendor/ahash-0.7.8/.github/workflows/rust.yml +0 -151
- data/ext/cargo-vendor/ahash-0.7.8/Cargo.toml +0 -149
- data/ext/cargo-vendor/ahash-0.7.8/Cargo.toml.orig +0 -96
- data/ext/cargo-vendor/ahash-0.7.8/FAQ.md +0 -118
- data/ext/cargo-vendor/ahash-0.7.8/LICENSE-APACHE +0 -201
- data/ext/cargo-vendor/ahash-0.7.8/LICENSE-MIT +0 -25
- data/ext/cargo-vendor/ahash-0.7.8/README.md +0 -110
- data/ext/cargo-vendor/ahash-0.7.8/build.rs +0 -47
- data/ext/cargo-vendor/ahash-0.7.8/rustfmt.toml +0 -1
- data/ext/cargo-vendor/ahash-0.7.8/src/aes_hash.rs +0 -440
- data/ext/cargo-vendor/ahash-0.7.8/src/convert.rs +0 -167
- data/ext/cargo-vendor/ahash-0.7.8/src/fallback_hash.rs +0 -392
- data/ext/cargo-vendor/ahash-0.7.8/src/hash_map.rs +0 -371
- data/ext/cargo-vendor/ahash-0.7.8/src/hash_quality_test.rs +0 -517
- data/ext/cargo-vendor/ahash-0.7.8/src/hash_set.rs +0 -313
- data/ext/cargo-vendor/ahash-0.7.8/src/lib.rs +0 -263
- data/ext/cargo-vendor/ahash-0.7.8/src/operations.rs +0 -330
- data/ext/cargo-vendor/ahash-0.7.8/src/random_state.rs +0 -363
- data/ext/cargo-vendor/ahash-0.7.8/src/specialize.rs +0 -239
- data/ext/cargo-vendor/ahash-0.7.8/tests/bench.rs +0 -154
- data/ext/cargo-vendor/ahash-0.7.8/tests/map_tests.rs +0 -203
- data/ext/cargo-vendor/ahash-0.7.8/tests/nopanic.rs +0 -72
- data/ext/cargo-vendor/codeowners-0.3.3/.cargo-checksum.json +0 -1
- data/ext/cargo-vendor/codeowners-0.3.3/.github/workflows/audit.yml +0 -19
- data/ext/cargo-vendor/codeowners-0.3.3/src/ownership/file_owner_resolver.rs +0 -416
- data/ext/cargo-vendor/error-stack-0.5.0/.cargo-checksum.json +0 -1
- data/ext/cargo-vendor/error-stack-0.5.0/.cargo_vcs_info.json +0 -6
- data/ext/cargo-vendor/error-stack-0.5.0/.justfile +0 -58
- data/ext/cargo-vendor/error-stack-0.5.0/Cargo.toml.orig +0 -87
- data/ext/cargo-vendor/error-stack-0.5.0/build.rs +0 -29
- data/ext/cargo-vendor/error-stack-0.5.0/examples/exit_code.rs +0 -24
- data/ext/cargo-vendor/error-stack-0.5.0/rust-toolchain.toml +0 -4
- data/ext/cargo-vendor/error-stack-0.5.0/src/context.rs +0 -132
- data/ext/cargo-vendor/error-stack-0.5.0/src/macros.rs +0 -253
- data/ext/cargo-vendor/error-stack-0.5.0/src/result.rs +0 -267
- data/ext/cargo-vendor/error-stack-0.5.0/tests/compiletest.rs +0 -7
- data/ext/cargo-vendor/error-stack-0.5.0/tests/snapshots/test_debug__sources_nested@backtrace.snap +0 -104
- data/ext/cargo-vendor/error-stack-0.5.0/tests/snapshots/test_debug__sources_nested@spantrace.snap +0 -104
- data/ext/cargo-vendor/error-stack-0.5.0/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap +0 -104
- data/ext/cargo-vendor/error-stack-0.5.0/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap +0 -104
- data/ext/cargo-vendor/error-stack-0.5.0/tests/test_downcast.rs +0 -41
- data/ext/cargo-vendor/error-stack-0.5.0/tests/test_extend.rs +0 -78
- data/ext/cargo-vendor/error-stack-0.5.0/tests/test_frame.rs +0 -126
- data/ext/cargo-vendor/error-stack-0.5.0/tests/test_iter.rs +0 -99
- data/ext/cargo-vendor/error-stack-0.5.0/tests/ui/macro_invalid_args.rs +0 -60
- data/ext/cargo-vendor/error-stack-0.5.0/tests/ui/macro_invalid_args.stderr +0 -101
- data/ext/cargo-vendor/getrandom-0.2.16/.cargo-checksum.json +0 -1
- data/ext/cargo-vendor/getrandom-0.2.16/.cargo_vcs_info.json +0 -6
- data/ext/cargo-vendor/getrandom-0.2.16/CHANGELOG.md +0 -498
- data/ext/cargo-vendor/getrandom-0.2.16/Cargo.lock +0 -354
- data/ext/cargo-vendor/getrandom-0.2.16/Cargo.toml +0 -121
- data/ext/cargo-vendor/getrandom-0.2.16/Cargo.toml.orig +0 -67
- data/ext/cargo-vendor/getrandom-0.2.16/LICENSE-APACHE +0 -201
- data/ext/cargo-vendor/getrandom-0.2.16/LICENSE-MIT +0 -26
- data/ext/cargo-vendor/getrandom-0.2.16/README.md +0 -81
- data/ext/cargo-vendor/getrandom-0.2.16/SECURITY.md +0 -13
- data/ext/cargo-vendor/getrandom-0.2.16/benches/buffer.rs +0 -71
- data/ext/cargo-vendor/getrandom-0.2.16/src/apple-other.rs +0 -24
- data/ext/cargo-vendor/getrandom-0.2.16/src/custom.rs +0 -105
- data/ext/cargo-vendor/getrandom-0.2.16/src/error.rs +0 -189
- data/ext/cargo-vendor/getrandom-0.2.16/src/error_impls.rs +0 -15
- data/ext/cargo-vendor/getrandom-0.2.16/src/espidf.rs +0 -18
- data/ext/cargo-vendor/getrandom-0.2.16/src/fuchsia.rs +0 -13
- data/ext/cargo-vendor/getrandom-0.2.16/src/getentropy.rs +0 -21
- data/ext/cargo-vendor/getrandom-0.2.16/src/getrandom.rs +0 -25
- data/ext/cargo-vendor/getrandom-0.2.16/src/hermit.rs +0 -29
- data/ext/cargo-vendor/getrandom-0.2.16/src/js.rs +0 -155
- data/ext/cargo-vendor/getrandom-0.2.16/src/lazy.rs +0 -56
- data/ext/cargo-vendor/getrandom-0.2.16/src/lib.rs +0 -407
- data/ext/cargo-vendor/getrandom-0.2.16/src/linux_android.rs +0 -7
- data/ext/cargo-vendor/getrandom-0.2.16/src/linux_android_with_fallback.rs +0 -33
- data/ext/cargo-vendor/getrandom-0.2.16/src/netbsd.rs +0 -46
- data/ext/cargo-vendor/getrandom-0.2.16/src/rdrand.rs +0 -121
- data/ext/cargo-vendor/getrandom-0.2.16/src/solaris.rs +0 -34
- data/ext/cargo-vendor/getrandom-0.2.16/src/solid.rs +0 -18
- data/ext/cargo-vendor/getrandom-0.2.16/src/use_file.rs +0 -120
- data/ext/cargo-vendor/getrandom-0.2.16/src/util.rs +0 -35
- data/ext/cargo-vendor/getrandom-0.2.16/src/util_libc.rs +0 -162
- data/ext/cargo-vendor/getrandom-0.2.16/src/vxworks.rs +0 -29
- data/ext/cargo-vendor/getrandom-0.2.16/src/wasi.rs +0 -17
- data/ext/cargo-vendor/getrandom-0.2.16/src/windows.rs +0 -59
- data/ext/cargo-vendor/getrandom-0.2.16/tests/common/mod.rs +0 -100
- data/ext/cargo-vendor/getrandom-0.2.16/tests/custom.rs +0 -54
- data/ext/cargo-vendor/getrandom-0.2.16/tests/normal.rs +0 -11
- data/ext/cargo-vendor/getrandom-0.2.16/tests/rdrand.rs +0 -22
- data/ext/cargo-vendor/hashbrown-0.12.3/.cargo-checksum.json +0 -1
- data/ext/cargo-vendor/hashbrown-0.12.3/.cargo_vcs_info.json +0 -6
- data/ext/cargo-vendor/hashbrown-0.12.3/CHANGELOG.md +0 -402
- data/ext/cargo-vendor/hashbrown-0.12.3/Cargo.toml +0 -113
- data/ext/cargo-vendor/hashbrown-0.12.3/Cargo.toml.orig +0 -60
- data/ext/cargo-vendor/hashbrown-0.12.3/LICENSE-APACHE +0 -201
- data/ext/cargo-vendor/hashbrown-0.12.3/LICENSE-MIT +0 -25
- data/ext/cargo-vendor/hashbrown-0.12.3/README.md +0 -126
- data/ext/cargo-vendor/hashbrown-0.12.3/benches/bench.rs +0 -331
- data/ext/cargo-vendor/hashbrown-0.12.3/benches/insert_unique_unchecked.rs +0 -32
- data/ext/cargo-vendor/hashbrown-0.12.3/clippy.toml +0 -1
- data/ext/cargo-vendor/hashbrown-0.12.3/src/external_trait_impls/mod.rs +0 -4
- data/ext/cargo-vendor/hashbrown-0.12.3/src/external_trait_impls/rayon/helpers.rs +0 -27
- data/ext/cargo-vendor/hashbrown-0.12.3/src/external_trait_impls/rayon/map.rs +0 -734
- data/ext/cargo-vendor/hashbrown-0.12.3/src/external_trait_impls/rayon/mod.rs +0 -4
- data/ext/cargo-vendor/hashbrown-0.12.3/src/external_trait_impls/rayon/raw.rs +0 -231
- data/ext/cargo-vendor/hashbrown-0.12.3/src/external_trait_impls/rayon/set.rs +0 -659
- data/ext/cargo-vendor/hashbrown-0.12.3/src/external_trait_impls/serde.rs +0 -201
- data/ext/cargo-vendor/hashbrown-0.12.3/src/lib.rs +0 -150
- data/ext/cargo-vendor/hashbrown-0.12.3/src/macros.rs +0 -70
- data/ext/cargo-vendor/hashbrown-0.12.3/src/map.rs +0 -8408
- data/ext/cargo-vendor/hashbrown-0.12.3/src/raw/alloc.rs +0 -73
- data/ext/cargo-vendor/hashbrown-0.12.3/src/raw/bitmask.rs +0 -122
- data/ext/cargo-vendor/hashbrown-0.12.3/src/raw/generic.rs +0 -154
- data/ext/cargo-vendor/hashbrown-0.12.3/src/raw/mod.rs +0 -2460
- data/ext/cargo-vendor/hashbrown-0.12.3/src/raw/sse2.rs +0 -146
- data/ext/cargo-vendor/hashbrown-0.12.3/src/rustc_entry.rs +0 -630
- data/ext/cargo-vendor/hashbrown-0.12.3/src/scopeguard.rs +0 -74
- data/ext/cargo-vendor/hashbrown-0.12.3/src/set.rs +0 -2790
- data/ext/cargo-vendor/hashbrown-0.12.3/tests/hasher.rs +0 -65
- data/ext/cargo-vendor/hashbrown-0.12.3/tests/rayon.rs +0 -533
- data/ext/cargo-vendor/hashbrown-0.12.3/tests/serde.rs +0 -65
- data/ext/cargo-vendor/hashbrown-0.12.3/tests/set.rs +0 -34
- data/ext/cargo-vendor/lru-0.7.8/.cargo-checksum.json +0 -1
- data/ext/cargo-vendor/lru-0.7.8/.cargo_vcs_info.json +0 -6
- data/ext/cargo-vendor/lru-0.7.8/.github/workflows/main.yml +0 -54
- data/ext/cargo-vendor/lru-0.7.8/CHANGELOG.md +0 -194
- data/ext/cargo-vendor/lru-0.7.8/Cargo.toml +0 -42
- data/ext/cargo-vendor/lru-0.7.8/Cargo.toml.orig +0 -22
- data/ext/cargo-vendor/lru-0.7.8/LICENSE +0 -21
- data/ext/cargo-vendor/lru-0.7.8/README.md +0 -62
- data/ext/cargo-vendor/lru-0.7.8/src/lib.rs +0 -1872
- data/ext/cargo-vendor/version_check-0.9.5/.cargo-checksum.json +0 -1
- data/ext/cargo-vendor/version_check-0.9.5/.cargo_vcs_info.json +0 -6
- data/ext/cargo-vendor/version_check-0.9.5/.github/workflows/ci.yml +0 -42
- data/ext/cargo-vendor/version_check-0.9.5/.travis.yml +0 -6
- data/ext/cargo-vendor/version_check-0.9.5/Cargo.toml +0 -38
- data/ext/cargo-vendor/version_check-0.9.5/Cargo.toml.orig +0 -13
- data/ext/cargo-vendor/version_check-0.9.5/LICENSE-APACHE +0 -201
- data/ext/cargo-vendor/version_check-0.9.5/LICENSE-MIT +0 -19
- data/ext/cargo-vendor/version_check-0.9.5/README.md +0 -80
- data/ext/cargo-vendor/version_check-0.9.5/src/channel.rs +0 -195
- data/ext/cargo-vendor/version_check-0.9.5/src/date.rs +0 -203
- data/ext/cargo-vendor/version_check-0.9.5/src/lib.rs +0 -528
- data/ext/cargo-vendor/version_check-0.9.5/src/version.rs +0 -316
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/.cargo-checksum.json +0 -1
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/.cargo_vcs_info.json +0 -6
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/.github/workflows/main.yml +0 -44
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/.gitmodules +0 -3
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/CODE_OF_CONDUCT.md +0 -49
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/CONTRIBUTING.md +0 -8
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/Cargo.lock +0 -23
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/Cargo.toml +0 -59
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/Cargo.toml.orig +0 -29
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/LICENSE-APACHE +0 -201
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/LICENSE-Apache-2.0_WITH_LLVM-exception +0 -220
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/LICENSE-MIT +0 -23
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/ORG_CODE_OF_CONDUCT.md +0 -143
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/README.md +0 -94
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/SECURITY.md +0 -29
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/src/lib.rs +0 -47
- data/ext/cargo-vendor/wasi-0.11.1+wasi-snapshot-preview1/src/lib_generated.rs +0 -2366
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/.github/CODEOWNERS +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/.github/workflows/dotslash-config.json +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/.rustfmt.toml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/.rusty-hook.toml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/AGENTS.md +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/CLAUDE.md +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/README.md +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/dev/run_benchmarks_for_file.sh +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/dev/run_benchmarks_for_gv.sh +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/common_test.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/config.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/crosscheck.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/lib.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/codeowners_file_parser.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/codeowners_query.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/file_generator.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/file_owner_finder.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/mapper/annotated_file_mapper.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/mapper/directory_mapper.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/mapper/escaper.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/mapper/package_mapper.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/mapper/team_gem_mapper.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/mapper/team_glob_mapper.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/mapper/team_yml_mapper.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/ownership/mapper.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/path_utils.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/src/tracked_files.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/cache_test.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/codeowners_path_test.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/crosscheck_owners_test.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/executable_name_config_test.rs +10 -10
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/custom_codeowners_path/config/code_ownership.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/custom_codeowners_path/config/teams/test_team.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/custom_codeowners_path/docs/CODEOWNERS +3 -3
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/custom_codeowners_path/expected/CODEOWNERS +3 -3
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/custom_codeowners_path/ruby/app/models/test.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/custom_executable_name/.github/CODEOWNERS +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/custom_executable_name/app/foo.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/custom_executable_name/config/code_ownership.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/custom_executable_name/config/teams/foo.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/custom_executable_name/config/teams/payments.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/custom_executable_name/ruby/app/payments/foo.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/default_executable_name/.github/CODEOWNERS +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/default_executable_name/app/bar.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/default_executable_name/config/code_ownership.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/default_executable_name/config/teams/bar.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3/tests/fixtures/multiple-directory-owners/app/services → codeowners-0.5.0/tests/fixtures/directory-codeowner-github-team/app/by_name}/.codeowner +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3/tests/fixtures/multiple-directory-owners → codeowners-0.5.0/tests/fixtures/directory-codeowner-github-team}/config/code_ownership.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3/tests/fixtures/multiple-directory-owners → codeowners-0.5.0/tests/fixtures/directory-codeowner-github-team}/config/teams/foo.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/.github/CODEOWNERS +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/config/code_ownership.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/config/teams/payments.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/config/teams/payroll.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/gems/payroll_calculator/calculator.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/ruby/app/models/bank_account.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/ruby/app/models/blockchain.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/ruby/app/models/payroll.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/ruby/app/payments/nacha.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/ruby/app/services/.codeowner +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/ruby/app/services/multi_owned.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/ruby/app/unowned.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/invalid_project/ruby/packages/payroll_flow/package.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/javascript_only_project/.github/CODEOWNERS +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/javascript_only_project/.keep +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/javascript_only_project/config/code_ownership.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/javascript_only_project/config/teams/design.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/javascript_only_project/config/teams/frontend.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/javascript_only_project/frontend/apps/public/index.tsx +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/javascript_only_project/frontend/packages/dashboard/package.json +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/javascript_only_project/frontend/packages/dashboard/src/index.tsx +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/javascript_only_project/frontend/packages/ui-kit/.codeowner +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/javascript_only_project/frontend/packages/ui-kit/src/button.tsx +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/missing_github_team/.github/CODEOWNERS +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/missing_github_team/config/code_ownership.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/missing_github_team/config/teams/bad_team.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/missing_github_team/config/teams/good.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/missing_github_team/gems/pets/dog.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/multiple-directory-owners/.github/CODEOWNERS +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/multiple-directory-owners/app/consumers/.codeowner +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/multiple-directory-owners/app/consumers/deep/nesting/nestdir/deep_file.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/multiple-directory-owners/app/consumers/one_owner.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/multiple-directory-owners/app/services/exciting/.codeowner +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/multiple-directory-owners/app/services/exciting/some_other_file.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/multiple-directory-owners/config/teams/bar.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/.github/CODEOWNERS +9 -9
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/.ignore +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/config/code_ownership.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/config/teams/payments.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/config/teams/payroll.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/config/teams/ux.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/gems/payroll_calculator/calculator.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/gems/pets/dog.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/javascript/packages/PayrollFlow/index.tsx +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/javascript/packages/PayrollFlow/package.json +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/javascript/packages/items/(special)/.codeowner +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/javascript/packages/items/(special)/pay.ts +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/javascript/packages/items/.codeowner +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/javascript/packages/items/item.ts +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/javascript/packages/list/page-admin.tsx +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/app/models/bank_account.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/app/models/payroll.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/app/payments/foo/.codeowner +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/app/payments/foo/ownedby_payroll.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/app/payments/nacha.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/app/payroll/.codeowner +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/app/payroll/payroll.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/app/views/foos/edit.erb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/app/views/foos/index.html.erb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/app/views/foos/new.html.erb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/ignored_files/git_ignored.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/ruby/packages/payroll_flow/package.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project/should_be_ignored/an_ignored_file.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/.github/CODEOWNERS +12 -12
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/config/code_ownership.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/config/teams/brewers.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/config/teams/cubs.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/config/teams/giants.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/config/teams/rockies.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/frontend/packages/components/datepicker/package.json +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/frontend/packages/components/datepicker/src/picks/dp.tsx +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/frontend/packages/components/list/package.json +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/frontend/packages/components/list/src/item.tsx +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/frontend/packages/components/textfield/package.json +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/frontend/packages/components/textfield/src/field.tsx +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/frontend/packages/components/textfield/src/fields/small.tsx +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/gems/apollo/lib/apollo.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/gems/ivy/lib/ivy.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/gems/lager/lib/lager.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/gems/summit/lib/summit.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/packs/games/app/services/stats.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/packs/games/package.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/packs/locations/app/services/capacity.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/packs/locations/package.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/packs/schedule/app/services/date.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/packs/schedule/package.yml +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/ruby/app/brewers/lib/util.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/ruby/app/brewers/services/play.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/ruby/app/cubs/.codeowner +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/ruby/app/cubs/services/models/.codeowner +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/ruby/app/cubs/services/models/db/price.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/ruby/app/cubs/services/models/entertainment.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/ruby/app/cubs/services/play.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/ruby/app/giants/services/play.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/fixtures/valid_project_with_overrides/ruby/app/rockies/services/play.rb +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/git_stage_test.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/invalid_project_structure_test.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/missing_github_team_test.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/multiple_directory_owners_test.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/run_config_executable_override_test.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/runner_api.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/untracked_files_test.rs +0 -0
- data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/valid_project_test.rs +6 -6
- /data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/valid_project_with_overrides_test.rs +0 -0
- /data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tests/validate_files_test.rs +0 -0
- /data/ext/cargo-vendor/{codeowners-0.3.3 → codeowners-0.5.0}/tmp/.gitkeep +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/LICENSE-APACHE.md +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/LICENSE-MIT.md +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/LICENSE.md +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/src/fmt/override.rs +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/hook__location_hook.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/report_display__doc.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/doc/report_display_alt__doc.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__alt.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__charset_ascii.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__color_mode_color.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__color_mode_emphasis.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__hook.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__hook_context.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__hook_decr.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__hook_for_context.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__hook_incr.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__hook_multiple.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__hook_provider.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__multiline.snap +0 -0
- /data/ext/cargo-vendor/{error-stack-0.5.0 → error-stack-0.8.0}/tests/snapshots/test_debug__full__norm.snap +0 -0
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
#[cfg_attr(feature = "std", allow(unused_imports))]
|
|
2
1
|
use alloc::{boxed::Box, vec, vec::Vec};
|
|
3
|
-
|
|
4
|
-
use core::error::Error;
|
|
5
|
-
use core::{fmt, marker::PhantomData, mem, panic::Location};
|
|
2
|
+
use core::{error::Error, marker::PhantomData, mem, ops::ControlFlow, panic::Location};
|
|
6
3
|
#[cfg(feature = "backtrace")]
|
|
7
4
|
use std::backtrace::{Backtrace, BacktraceStatus};
|
|
8
|
-
#[cfg(all(feature = "std", not(rust_1_81)))]
|
|
9
|
-
use std::error::Error;
|
|
10
5
|
#[cfg(feature = "std")]
|
|
11
6
|
use std::process::ExitCode;
|
|
12
7
|
|
|
13
8
|
#[cfg(feature = "spantrace")]
|
|
14
9
|
use tracing_error::{SpanTrace, SpanTraceStatus};
|
|
15
10
|
|
|
16
|
-
#[cfg(any(feature = "std", rust_1_81))]
|
|
17
|
-
use crate::context::SourceContext;
|
|
18
11
|
#[cfg(nightly)]
|
|
19
12
|
use crate::iter::{RequestRef, RequestValue};
|
|
20
13
|
use crate::{
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
Attachment, Frame, OpaqueAttachment,
|
|
15
|
+
context::SourceContext,
|
|
16
|
+
iter::{self, Frames},
|
|
23
17
|
};
|
|
24
18
|
|
|
25
|
-
/// Contains a [`Frame`] stack consisting of [`
|
|
19
|
+
/// Contains a [`Frame`] stack consisting of [`Error`] contexts and attachments.
|
|
26
20
|
///
|
|
27
|
-
/// Attachments can be added by using [`
|
|
28
|
-
/// [`frames()`].
|
|
21
|
+
/// Attachments can be added by using [`attach_opaque()`]. The [`Frame`] stack can be iterated by
|
|
22
|
+
/// using [`frames()`].
|
|
29
23
|
///
|
|
30
|
-
/// When creating a `Report` by using [`new()`], the passed [`
|
|
31
|
-
/// context_ on the `Report`. To provide a new one, use [`change_context()`].
|
|
24
|
+
/// When creating a `Report` by using [`new()`], the passed [`Error`] context is used to set the
|
|
25
|
+
/// _current context_ on the `Report`. To provide a new one, use [`change_context()`].
|
|
32
26
|
///
|
|
33
|
-
/// Attachments, and objects [`provide`]d by a [`
|
|
34
|
-
/// [`request_ref()`] or [`request_value()`].
|
|
27
|
+
/// Attachments, and objects [`provide`]d by a [`Error`] context, are directly retrievable by
|
|
28
|
+
/// calling [`request_ref()`] or [`request_value()`].
|
|
35
29
|
///
|
|
36
30
|
/// ## Formatting
|
|
37
31
|
///
|
|
38
32
|
/// `Report` implements [`Display`] and [`Debug`]. When utilizing the [`Display`] implementation,
|
|
39
33
|
/// the current context of the `Report` is printed, e.g. `println!("{report}")`. For the alternate
|
|
40
|
-
/// [`Display`] output (`"{:#}"`), all [`
|
|
41
|
-
/// [`
|
|
42
|
-
/// output of the attachments in the [`Debug`] output, please see the [`error_stack::fmt`]
|
|
34
|
+
/// [`Display`] output (`"{:#}"`), all [`Error`] contexts are printed. To print the full stack of
|
|
35
|
+
/// [`Error`] contexts and attachments, use the [`Debug`] implementation (`"{:?}"`). To customize
|
|
36
|
+
/// the output of the attachments in the [`Debug`] output, please see the [`error_stack::fmt`]
|
|
37
|
+
/// module.
|
|
43
38
|
///
|
|
44
39
|
/// Please see the examples below for more information.
|
|
45
40
|
///
|
|
46
|
-
/// [`Display`]: fmt::Display
|
|
41
|
+
/// [`Display`]: core::fmt::Display
|
|
47
42
|
/// [`error_stack::fmt`]: crate::fmt
|
|
48
43
|
///
|
|
49
44
|
/// ## Multiple Errors
|
|
50
45
|
///
|
|
51
|
-
/// `Report`
|
|
52
|
-
///
|
|
53
|
-
///
|
|
46
|
+
/// `Report` comes in two variants: `Report<C>` which represents a single error context, and
|
|
47
|
+
/// `Report<[C]>` which can represent multiple error contexts. To combine multiple errors,
|
|
48
|
+
/// first convert a `Report<C>` to `Report<[C]>` using [`expand()`], then use [`push()`] to
|
|
49
|
+
/// add additional errors. This allows for representing complex error scenarios with multiple
|
|
50
|
+
/// related simultaneous errors.
|
|
51
|
+
///
|
|
52
|
+
/// [`expand()`]: Self::expand
|
|
53
|
+
/// [`push()`]: Self::push
|
|
54
54
|
///
|
|
55
55
|
/// ## `Backtrace` and `SpanTrace`
|
|
56
56
|
///
|
|
@@ -68,7 +68,7 @@ use crate::{
|
|
|
68
68
|
///
|
|
69
69
|
/// [`provide`]: core::error::Error::provide
|
|
70
70
|
/// [`ErrorLayer`]: tracing_error::ErrorLayer
|
|
71
|
-
/// [`
|
|
71
|
+
/// [`attach_opaque()`]: Self::attach
|
|
72
72
|
/// [`extend_one()`]: Self::extend_one
|
|
73
73
|
/// [`new()`]: Self::new
|
|
74
74
|
/// [`frames()`]: Self::frames
|
|
@@ -85,13 +85,13 @@ use crate::{
|
|
|
85
85
|
/// ## Provide a context for an error
|
|
86
86
|
///
|
|
87
87
|
/// ```rust
|
|
88
|
-
/// use error_stack::
|
|
88
|
+
/// use error_stack::ResultExt;
|
|
89
89
|
///
|
|
90
90
|
/// # #[allow(dead_code)]
|
|
91
|
-
/// # fn fake_main() -> Result<String, std::io::Error
|
|
91
|
+
/// # fn fake_main() -> Result<String, error_stack::Report<std::io::Error>> {
|
|
92
92
|
/// let config_path = "./path/to/config.file";
|
|
93
93
|
/// let content = std::fs::read_to_string(config_path)
|
|
94
|
-
/// .
|
|
94
|
+
/// .attach_with(|| format!("failed to read config file {config_path:?}"))?;
|
|
95
95
|
///
|
|
96
96
|
/// # const _: &str = stringify! {
|
|
97
97
|
/// ...
|
|
@@ -101,9 +101,9 @@ use crate::{
|
|
|
101
101
|
/// ## Enforce a context for an error
|
|
102
102
|
///
|
|
103
103
|
/// ```rust
|
|
104
|
-
/// use std::{fmt, path::{Path, PathBuf}};
|
|
104
|
+
/// use std::{error::Error, fmt, path::{Path, PathBuf}};
|
|
105
105
|
///
|
|
106
|
-
/// use error_stack::{
|
|
106
|
+
/// use error_stack::{Report, ResultExt};
|
|
107
107
|
///
|
|
108
108
|
/// #[derive(Debug)]
|
|
109
109
|
/// # #[derive(PartialEq)]
|
|
@@ -142,8 +142,8 @@ use crate::{
|
|
|
142
142
|
/// # }
|
|
143
143
|
/// }
|
|
144
144
|
///
|
|
145
|
-
/// impl
|
|
146
|
-
/// impl
|
|
145
|
+
/// impl Error for RuntimeError {}
|
|
146
|
+
/// impl Error for ConfigError {}
|
|
147
147
|
///
|
|
148
148
|
/// # #[allow(unused_variables)]
|
|
149
149
|
/// fn read_config(path: impl AsRef<Path>) -> Result<String, Report<ConfigError>> {
|
|
@@ -191,31 +191,31 @@ use crate::{
|
|
|
191
191
|
///
|
|
192
192
|
/// If the [`Display`] implementation of `Report` will be invoked, this will print something like:
|
|
193
193
|
/// <pre>
|
|
194
|
-
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/report_display__doc.snap"))]
|
|
194
|
+
#[cfg_attr(doc, doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/report_display__doc.snap")))]
|
|
195
195
|
/// </pre>
|
|
196
196
|
///
|
|
197
197
|
/// If the alternate [`Display`] implementation of `Report` is invoked (`{report:#}`), this will
|
|
198
198
|
/// print something like:
|
|
199
199
|
/// <pre>
|
|
200
|
-
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/report_display_alt__doc.snap"))]
|
|
200
|
+
#[cfg_attr(doc, doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/report_display_alt__doc.snap")))]
|
|
201
201
|
/// </pre>
|
|
202
202
|
///
|
|
203
203
|
/// The [`Debug`] implementation of `Report` will print something like:
|
|
204
204
|
/// <pre>
|
|
205
|
-
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/report_debug__doc.snap"))]
|
|
205
|
+
#[cfg_attr(doc, doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/report_debug__doc.snap")))]
|
|
206
206
|
/// </pre>
|
|
207
207
|
///
|
|
208
208
|
///
|
|
209
209
|
/// ## Get the attached [`Backtrace`] and [`SpanTrace`]:
|
|
210
210
|
///
|
|
211
211
|
/// ```rust,should_panic
|
|
212
|
-
/// use error_stack::{ResultExt,
|
|
212
|
+
/// use error_stack::{ResultExt, Report};
|
|
213
213
|
///
|
|
214
214
|
/// # #[allow(unused_variables)]
|
|
215
|
-
/// # fn main() -> Result<(), std::io::Error
|
|
215
|
+
/// # fn main() -> Result<(), Report<std::io::Error>> {
|
|
216
216
|
/// let config_path = "./path/to/config.file";
|
|
217
217
|
/// let content = std::fs::read_to_string(config_path)
|
|
218
|
-
/// .
|
|
218
|
+
/// .attach_with(|| format!("failed to read config file {config_path:?}"));
|
|
219
219
|
///
|
|
220
220
|
/// let content = match content {
|
|
221
221
|
/// Err(err) => {
|
|
@@ -241,14 +241,14 @@ use crate::{
|
|
|
241
241
|
/// # }
|
|
242
242
|
/// ```
|
|
243
243
|
#[must_use]
|
|
244
|
-
#[
|
|
245
|
-
pub struct Report<C> {
|
|
244
|
+
#[expect(clippy::field_scoped_visibility_modifiers)]
|
|
245
|
+
pub struct Report<C: ?Sized> {
|
|
246
246
|
// The vector is boxed as this implies a memory footprint equal to a single pointer size
|
|
247
247
|
// instead of three pointer sizes. Even for small `Result::Ok` variants, the `Result` would
|
|
248
248
|
// still have at least the size of `Report`, even at the happy path. It's unexpected, that
|
|
249
249
|
// creating or traversing a report will happen in the hot path, so a double indirection is
|
|
250
250
|
// a good trade-off.
|
|
251
|
-
#[
|
|
251
|
+
#[expect(clippy::box_collection)]
|
|
252
252
|
pub(super) frames: Box<Vec<Frame>>,
|
|
253
253
|
_context: PhantomData<fn() -> *const C>,
|
|
254
254
|
}
|
|
@@ -263,13 +263,12 @@ impl<C> Report<C> {
|
|
|
263
263
|
/// [`Backtrace` and `SpanTrace` section]: #backtrace-and-spantrace
|
|
264
264
|
#[inline]
|
|
265
265
|
#[track_caller]
|
|
266
|
-
#[
|
|
266
|
+
#[expect(clippy::missing_panics_doc, reason = "No panic possible")]
|
|
267
267
|
pub fn new(context: C) -> Self
|
|
268
268
|
where
|
|
269
|
-
C:
|
|
269
|
+
C: Error + Send + Sync + 'static,
|
|
270
270
|
{
|
|
271
|
-
|
|
272
|
-
if let Some(mut current_source) = context.__source() {
|
|
271
|
+
if let Some(mut current_source) = context.source() {
|
|
273
272
|
// The sources needs to be applied in reversed order, so we buffer them in a vector
|
|
274
273
|
let mut sources = vec![SourceContext::from_error(current_source)];
|
|
275
274
|
while let Some(source) = current_source.source() {
|
|
@@ -306,8 +305,7 @@ impl<C> Report<C> {
|
|
|
306
305
|
|
|
307
306
|
#[cfg(all(nightly, feature = "backtrace"))]
|
|
308
307
|
let backtrace = core::error::request_ref::<Backtrace>(&frame.as_error())
|
|
309
|
-
.
|
|
310
|
-
.is_none()
|
|
308
|
+
.is_none_or(|backtrace| backtrace.status() != BacktraceStatus::Captured)
|
|
311
309
|
.then(Backtrace::capture);
|
|
312
310
|
|
|
313
311
|
#[cfg(all(not(nightly), feature = "backtrace"))]
|
|
@@ -315,133 +313,194 @@ impl<C> Report<C> {
|
|
|
315
313
|
|
|
316
314
|
#[cfg(all(nightly, feature = "spantrace"))]
|
|
317
315
|
let span_trace = core::error::request_ref::<SpanTrace>(&frame.as_error())
|
|
318
|
-
.
|
|
319
|
-
.is_none()
|
|
316
|
+
.is_none_or(|span_trace| span_trace.status() != SpanTraceStatus::CAPTURED)
|
|
320
317
|
.then(SpanTrace::capture);
|
|
321
318
|
|
|
322
319
|
#[cfg(all(not(nightly), feature = "spantrace"))]
|
|
323
320
|
let span_trace = Some(SpanTrace::capture());
|
|
324
321
|
|
|
325
|
-
#[allow(unused_mut)]
|
|
326
322
|
let mut report = Self {
|
|
327
323
|
frames: Box::new(vec![frame]),
|
|
328
324
|
_context: PhantomData,
|
|
329
325
|
};
|
|
330
326
|
|
|
331
327
|
if let Some(location) = location {
|
|
332
|
-
report = report.
|
|
328
|
+
report = report.attach_opaque(*location);
|
|
333
329
|
}
|
|
334
330
|
|
|
335
331
|
#[cfg(feature = "backtrace")]
|
|
336
332
|
if let Some(backtrace) =
|
|
337
333
|
backtrace.filter(|bt| matches!(bt.status(), BacktraceStatus::Captured))
|
|
338
334
|
{
|
|
339
|
-
report = report.
|
|
335
|
+
report = report.attach_opaque(backtrace);
|
|
340
336
|
}
|
|
341
337
|
|
|
342
338
|
#[cfg(feature = "spantrace")]
|
|
343
339
|
if let Some(span_trace) = span_trace.filter(|st| st.status() == SpanTraceStatus::CAPTURED) {
|
|
344
|
-
report = report.
|
|
340
|
+
report = report.attach_opaque(span_trace);
|
|
345
341
|
}
|
|
346
342
|
|
|
347
343
|
report
|
|
348
344
|
}
|
|
349
345
|
|
|
350
|
-
///
|
|
346
|
+
/// Converts a `Report` with a single context into a `Report` with multiple contexts.
|
|
351
347
|
///
|
|
352
|
-
/// This function
|
|
353
|
-
///
|
|
354
|
-
/// Meaning `A.extend_one(B) -> A.current_frames() = A.current_frames() + B.current_frames()`
|
|
348
|
+
/// This function allows for the transformation of a `Report<C>` into a `Report<[C]>`,
|
|
349
|
+
/// enabling the report to potentially hold multiple current contexts of the same type.
|
|
355
350
|
///
|
|
356
|
-
///
|
|
357
|
-
///
|
|
358
|
-
/// ```rust
|
|
359
|
-
/// use std::{
|
|
360
|
-
/// fmt::{Display, Formatter},
|
|
361
|
-
/// path::Path,
|
|
362
|
-
/// };
|
|
351
|
+
/// # Example
|
|
363
352
|
///
|
|
364
|
-
///
|
|
353
|
+
/// ```
|
|
354
|
+
/// use error_stack::Report;
|
|
365
355
|
///
|
|
366
356
|
/// #[derive(Debug)]
|
|
367
|
-
/// struct
|
|
357
|
+
/// struct SystemFailure;
|
|
368
358
|
///
|
|
369
|
-
/// impl Display for
|
|
370
|
-
///
|
|
371
|
-
///
|
|
372
|
-
///
|
|
373
|
-
/// # );
|
|
374
|
-
/// # f.write_str("Io Error")
|
|
375
|
-
/// # }
|
|
359
|
+
/// impl std::fmt::Display for SystemFailure {
|
|
360
|
+
/// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
361
|
+
/// f.write_str("System failure occured")
|
|
362
|
+
/// }
|
|
376
363
|
/// }
|
|
377
364
|
///
|
|
378
|
-
///
|
|
365
|
+
/// impl core::error::Error for SystemFailure {}
|
|
379
366
|
///
|
|
380
|
-
///
|
|
381
|
-
///
|
|
382
|
-
///
|
|
383
|
-
/// # return Err(error_stack::report!(IoError).attach_printable("Not supported"));
|
|
384
|
-
/// # #[cfg(all(not(miri), feature = "std"))]
|
|
385
|
-
/// std::fs::read_to_string(path.as_ref())
|
|
386
|
-
/// .change_context(IoError)
|
|
387
|
-
/// }
|
|
367
|
+
/// // Type annotations are used here to illustrate the types used, these are not required
|
|
368
|
+
/// let failure: Report<SystemFailure> = Report::new(SystemFailure);
|
|
369
|
+
/// let mut failures: Report<[SystemFailure]> = failure.expand();
|
|
388
370
|
///
|
|
389
|
-
///
|
|
390
|
-
/// let error2 = read_config("config2.txt").unwrap_err();
|
|
391
|
-
/// let mut error3 = read_config("config3.txt").unwrap_err();
|
|
371
|
+
/// assert_eq!(failures.current_frames().len(), 1);
|
|
392
372
|
///
|
|
393
|
-
///
|
|
394
|
-
///
|
|
373
|
+
/// let another_failure = Report::new(SystemFailure);
|
|
374
|
+
/// failures.push(another_failure);
|
|
395
375
|
///
|
|
396
|
-
///
|
|
397
|
-
/// // error3.extend_one(error1);
|
|
398
|
-
/// // error3.extend_one(error2);
|
|
376
|
+
/// assert_eq!(failures.current_frames().len(), 2);
|
|
399
377
|
/// ```
|
|
378
|
+
pub fn expand(self) -> Report<[C]> {
|
|
379
|
+
Report {
|
|
380
|
+
frames: self.frames,
|
|
381
|
+
_context: PhantomData,
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/// Returns the direct current frames of this report.
|
|
400
386
|
///
|
|
401
|
-
///
|
|
402
|
-
/// [`Extend::extend_one` (#7261)](https://github.com/rust-lang/rust/issues/72631).
|
|
403
|
-
/// Once stabilised this function will be removed in favor of [`Extend`].
|
|
387
|
+
/// To get an iterator over the topological sorting of all frames refer to [`frames()`].
|
|
404
388
|
///
|
|
405
|
-
/// [`
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
389
|
+
/// This is not the same as [`Report::current_context`], this function gets the underlying
|
|
390
|
+
/// frames that make up this report, while [`Report::current_context`] traverses the stack of
|
|
391
|
+
/// frames to find the current context. A [`Report`] and be made up of multiple [`Frame`]s,
|
|
392
|
+
/// which stack on top of each other. Considering `PrintableA<PrintableA<Context>>`,
|
|
393
|
+
/// [`Report::current_frame`] will return the "outer" layer `PrintableA`, while
|
|
394
|
+
/// [`Report::current_context`] will return the underlying `Error` (the current type
|
|
395
|
+
/// parameter of this [`Report`]).
|
|
396
|
+
///
|
|
397
|
+
/// A report can be made up of multiple stacks of frames and builds a "group" of them, this can
|
|
398
|
+
/// be achieved through first calling [`Report::expand`] and then either using [`Extend`]
|
|
399
|
+
/// or [`Report::push`].
|
|
400
|
+
///
|
|
401
|
+
/// [`frames()`]: Self::frames
|
|
402
|
+
#[must_use]
|
|
403
|
+
pub fn current_frame(&self) -> &Frame {
|
|
404
|
+
self.frames.first().unwrap_or_else(|| {
|
|
405
|
+
unreachable!(
|
|
406
|
+
"Report does not contain any frames. This should not happen as a Report must \
|
|
407
|
+
always contain at least one frame.\n\n
|
|
408
|
+
Please file an issue to https://github.com/hashintel/hash/issues/new?template=bug-report-error-stack.yml\n\n
|
|
409
|
+
Report:\n{self:?}",
|
|
410
|
+
)
|
|
411
|
+
})
|
|
410
412
|
}
|
|
411
413
|
|
|
412
|
-
///
|
|
414
|
+
/// Returns the current context of the `Report`.
|
|
415
|
+
///
|
|
416
|
+
/// If the user want to get the latest context, `current_context` can be called. If the user
|
|
417
|
+
/// wants to handle the error, the context can then be used to directly access the context's
|
|
418
|
+
/// type. This is only possible for the latest context as the Report does not have multiple
|
|
419
|
+
/// generics as this would either require variadic generics or a workaround like tuple-list.
|
|
413
420
|
///
|
|
414
|
-
/// This
|
|
415
|
-
///
|
|
421
|
+
/// This is one disadvantage of the library in comparison to plain Errors, as in these cases,
|
|
422
|
+
/// all context types are known.
|
|
416
423
|
///
|
|
417
|
-
///
|
|
418
|
-
/// it becomes possible to merge these two methods.
|
|
424
|
+
/// ## Example
|
|
419
425
|
///
|
|
420
|
-
///
|
|
421
|
-
///
|
|
422
|
-
///
|
|
423
|
-
|
|
424
|
-
|
|
426
|
+
/// ```rust
|
|
427
|
+
/// # use std::{fs, path::Path};
|
|
428
|
+
/// # use error_stack::Report;
|
|
429
|
+
/// use std::io;
|
|
430
|
+
///
|
|
431
|
+
/// fn read_file(path: impl AsRef<Path>) -> Result<String, Report<io::Error>> {
|
|
432
|
+
/// # const _: &str = stringify! {
|
|
433
|
+
/// ...
|
|
434
|
+
/// # };
|
|
435
|
+
/// # fs::read_to_string(path.as_ref()).map_err(Report::from)
|
|
436
|
+
/// }
|
|
437
|
+
///
|
|
438
|
+
/// let report = read_file("test.txt").unwrap_err();
|
|
439
|
+
/// let io_error = report.current_context();
|
|
440
|
+
/// assert_eq!(io_error.kind(), io::ErrorKind::NotFound);
|
|
441
|
+
/// ```
|
|
442
|
+
#[must_use]
|
|
443
|
+
pub fn current_context(&self) -> &C
|
|
425
444
|
where
|
|
426
|
-
|
|
445
|
+
C: Send + Sync + 'static,
|
|
427
446
|
{
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
447
|
+
self.downcast_ref().unwrap_or_else(|| {
|
|
448
|
+
// Panics if there isn't an attached context which matches `T`. As it's not possible to
|
|
449
|
+
// create a `Report` without a valid context and this method can only be called when `T`
|
|
450
|
+
// is a valid context, it's guaranteed that the context is available.
|
|
451
|
+
unreachable!(
|
|
452
|
+
"Report does not contain a context. This should not happen as a Report must \
|
|
453
|
+
always contain at least one frame.\n\n
|
|
454
|
+
Please file an issue to https://github.com/hashintel/hash/issues/new?template=bug-report-error-stack.yml\n\n
|
|
455
|
+
Report:\n{self:?}",
|
|
456
|
+
)
|
|
457
|
+
})
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/// Converts this `Report` to an [`Error`].
|
|
461
|
+
#[must_use]
|
|
462
|
+
pub fn into_error(self) -> impl Error + Send + Sync + 'static
|
|
463
|
+
where
|
|
464
|
+
C: 'static,
|
|
465
|
+
{
|
|
466
|
+
crate::error::ReportError::new(self)
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/// Returns this `Report` as an [`Error`].
|
|
470
|
+
#[must_use]
|
|
471
|
+
pub fn as_error(&self) -> &(impl Error + Send + Sync + 'static)
|
|
472
|
+
where
|
|
473
|
+
C: 'static,
|
|
474
|
+
{
|
|
475
|
+
crate::error::ReportError::from_ref(self)
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
impl<C: ?Sized> Report<C> {
|
|
480
|
+
/// Retrieves the current frames of the `Report`, regardless of its current type state.
|
|
481
|
+
///
|
|
482
|
+
/// You should prefer using [`Report::current_frame`] or [`Report::current_frames`] instead of
|
|
483
|
+
/// this function, as those properly interact with the type state of the `Report`.
|
|
484
|
+
///
|
|
485
|
+
/// # Use Cases
|
|
486
|
+
///
|
|
487
|
+
/// This function is primarily used to implement traits that require access to the frames,
|
|
488
|
+
/// such as [`Debug`]. It allows for code reuse between `Report<C>` and `Report<[C]>`
|
|
489
|
+
/// implementations without duplicating logic.
|
|
490
|
+
#[must_use]
|
|
491
|
+
pub(crate) fn current_frames_unchecked(&self) -> &[Frame] {
|
|
492
|
+
&self.frames
|
|
434
493
|
}
|
|
435
494
|
|
|
436
495
|
/// Adds additional (printable) information to the [`Frame`] stack.
|
|
437
496
|
///
|
|
438
|
-
/// This behaves like [`
|
|
497
|
+
/// This behaves like [`attach_opaque()`] but the display implementation will be called when
|
|
439
498
|
/// printing the [`Report`].
|
|
440
499
|
///
|
|
441
|
-
/// **Note:**
|
|
442
|
-
///
|
|
500
|
+
/// **Note:** [`attach_opaque()`] will be deprecated when specialization is stabilized and
|
|
501
|
+
/// it becomes possible to merge these two methods.
|
|
443
502
|
///
|
|
444
|
-
/// [`
|
|
503
|
+
/// [`attach_opaque()`]: Self::attach
|
|
445
504
|
///
|
|
446
505
|
/// ## Example
|
|
447
506
|
///
|
|
@@ -471,9 +530,9 @@ impl<C> Report<C> {
|
|
|
471
530
|
/// assert_eq!(suggestion.0, "better use a file which exists next time!");
|
|
472
531
|
/// ```
|
|
473
532
|
#[track_caller]
|
|
474
|
-
pub fn
|
|
533
|
+
pub fn attach<A>(mut self, attachment: A) -> Self
|
|
475
534
|
where
|
|
476
|
-
A:
|
|
535
|
+
A: Attachment,
|
|
477
536
|
{
|
|
478
537
|
let old_frames = mem::replace(self.frames.as_mut(), Vec::with_capacity(1));
|
|
479
538
|
self.frames.push(Frame::from_printable_attachment(
|
|
@@ -483,14 +542,38 @@ impl<C> Report<C> {
|
|
|
483
542
|
self
|
|
484
543
|
}
|
|
485
544
|
|
|
486
|
-
///
|
|
545
|
+
/// Adds additional information to the [`Frame`] stack.
|
|
546
|
+
///
|
|
547
|
+
/// This behaves like [`attach()`] but will not be shown when printing the [`Report`].
|
|
548
|
+
/// To benefit from seeing attachments in normal error outputs, use [`attach()`].
|
|
549
|
+
///
|
|
550
|
+
/// **Note:** This will be deprecated in favor of [`attach()`] when specialization is
|
|
551
|
+
/// stabilized it becomes possible to merge these two methods.
|
|
552
|
+
///
|
|
553
|
+
/// [`Display`]: core::fmt::Display
|
|
554
|
+
/// [`Debug`]: core::fmt::Debug
|
|
555
|
+
/// [`attach()`]: Self::attach
|
|
556
|
+
#[track_caller]
|
|
557
|
+
pub fn attach_opaque<A>(mut self, attachment: A) -> Self
|
|
558
|
+
where
|
|
559
|
+
A: OpaqueAttachment,
|
|
560
|
+
{
|
|
561
|
+
let old_frames = mem::replace(self.frames.as_mut(), Vec::with_capacity(1));
|
|
562
|
+
self.frames.push(Frame::from_attachment(
|
|
563
|
+
attachment,
|
|
564
|
+
old_frames.into_boxed_slice(),
|
|
565
|
+
));
|
|
566
|
+
self
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/// Add a new [`Error`] object to the top of the [`Frame`] stack, changing the type of the
|
|
487
570
|
/// `Report`.
|
|
488
571
|
///
|
|
489
|
-
/// Please see the [`
|
|
572
|
+
/// Please see the [`Error`] documentation for more information.
|
|
490
573
|
#[track_caller]
|
|
491
574
|
pub fn change_context<T>(mut self, context: T) -> Report<T>
|
|
492
575
|
where
|
|
493
|
-
T:
|
|
576
|
+
T: Error + Send + Sync + 'static,
|
|
494
577
|
{
|
|
495
578
|
let old_frames = mem::replace(self.frames.as_mut(), Vec::with_capacity(1));
|
|
496
579
|
let context_frame = vec![Frame::from_context(context, old_frames.into_boxed_slice())];
|
|
@@ -504,48 +587,65 @@ impl<C> Report<C> {
|
|
|
504
587
|
}
|
|
505
588
|
}
|
|
506
589
|
|
|
507
|
-
/// Return the direct current frames of this report,
|
|
508
|
-
/// to get an iterator over the topological sorting of all frames refer to [`frames()`]
|
|
509
|
-
///
|
|
510
|
-
/// This is not the same as [`Report::current_context`], this function gets the underlying
|
|
511
|
-
/// frames that make up this report, while [`Report::current_context`] traverses the stack of
|
|
512
|
-
/// frames to find the current context. A [`Report`] and be made up of multiple [`Frame`]s,
|
|
513
|
-
/// which stack on top of each other. Considering `PrintableA<PrintableA<Context>>`,
|
|
514
|
-
/// [`Report::current_frames`] will return the "outer" layer `PrintableA`, while
|
|
515
|
-
/// [`Report::current_context`] will return the underlying `Context` (the current type
|
|
516
|
-
/// parameter of this [`Report`])
|
|
517
|
-
///
|
|
518
|
-
/// Using [`Extend`] and [`extend_one()`], a [`Report`] can additionally be made up of multiple
|
|
519
|
-
/// stacks of frames and builds a "group" of them, but a [`Report`] can only ever have a single
|
|
520
|
-
/// `Context`, therefore this function returns a slice instead, while
|
|
521
|
-
/// [`Report::current_context`] only returns a single reference.
|
|
522
|
-
///
|
|
523
|
-
/// [`frames()`]: Self::frames
|
|
524
|
-
/// [`extend_one()`]: Self::extend_one
|
|
525
|
-
#[must_use]
|
|
526
|
-
pub fn current_frames(&self) -> &[Frame] {
|
|
527
|
-
&self.frames
|
|
528
|
-
}
|
|
529
|
-
|
|
530
590
|
/// Returns an iterator over the [`Frame`] stack of the report.
|
|
531
591
|
pub fn frames(&self) -> Frames<'_> {
|
|
532
592
|
Frames::new(&self.frames)
|
|
533
593
|
}
|
|
534
594
|
|
|
535
|
-
///
|
|
536
|
-
|
|
537
|
-
|
|
595
|
+
/// Visits every [`Frame`] of the report mutably, in the same order as [`frames()`].
|
|
596
|
+
///
|
|
597
|
+
/// Returning [`ControlFlow::Break`] from `visitor` stops the traversal early. The break is
|
|
598
|
+
/// propagated to the caller, a full traversal returns [`ControlFlow::Continue`].
|
|
599
|
+
///
|
|
600
|
+
/// This is deliberately not an [`Iterator`]: an iterator over `&mut Frame` hands out
|
|
601
|
+
/// references whose lifetimes are independent of each other, so a frame and one of its
|
|
602
|
+
/// sources (reachable via [`Frame::sources_mut`]) could be borrowed mutably at the same
|
|
603
|
+
/// time. Scoping mutable access to a visitor rules that out.
|
|
604
|
+
///
|
|
605
|
+
/// ## Example
|
|
606
|
+
///
|
|
607
|
+
/// ```rust
|
|
608
|
+
/// # use std::{fs, io, path::Path};
|
|
609
|
+
/// # use core::ops::ControlFlow;
|
|
610
|
+
/// # use error_stack::Report;
|
|
611
|
+
/// # fn read_file(path: impl AsRef<Path>) -> Result<String, Report<io::Error>> {
|
|
612
|
+
/// # fs::read_to_string(path.as_ref()).map_err(Report::from)
|
|
613
|
+
/// # }
|
|
614
|
+
/// let mut report = read_file("test.txt").unwrap_err();
|
|
615
|
+
/// let flow = report.frames_mut(|frame| {
|
|
616
|
+
/// if let Some(io_error) = frame.downcast_mut::<io::Error>() {
|
|
617
|
+
/// *io_error = io::Error::from(io::ErrorKind::Other);
|
|
618
|
+
/// return ControlFlow::Break(());
|
|
619
|
+
/// }
|
|
620
|
+
/// ControlFlow::Continue(())
|
|
621
|
+
/// });
|
|
622
|
+
/// assert!(flow.is_break());
|
|
623
|
+
/// ```
|
|
624
|
+
///
|
|
625
|
+
/// [`frames()`]: Self::frames
|
|
626
|
+
pub fn frames_mut(
|
|
627
|
+
&mut self,
|
|
628
|
+
mut visitor: impl FnMut(&mut Frame) -> ControlFlow<()>,
|
|
629
|
+
) -> ControlFlow<()> {
|
|
630
|
+
// If lending iterators ever land in `core`, this should become one: yielding `&mut Frame`
|
|
631
|
+
// bound to the `next()` borrow is sound and more ergonomic than a visitor.
|
|
632
|
+
let mut stack = vec![self.frames.iter_mut()];
|
|
633
|
+
while let Some(frame) = iter::next(&mut stack) {
|
|
634
|
+
visitor(frame)?;
|
|
635
|
+
stack.push(frame.sources_mut().iter_mut());
|
|
636
|
+
}
|
|
637
|
+
ControlFlow::Continue(())
|
|
538
638
|
}
|
|
539
639
|
|
|
540
640
|
/// Creates an iterator of references of type `T` that have been [`attached`](Self::attach) or
|
|
541
|
-
/// that are [`provide`](Error::provide)d by [`
|
|
641
|
+
/// that are [`provide`](Error::provide)d by [`Error`] objects.
|
|
542
642
|
#[cfg(nightly)]
|
|
543
643
|
pub fn request_ref<T: ?Sized + Send + Sync + 'static>(&self) -> RequestRef<'_, T> {
|
|
544
644
|
RequestRef::new(&self.frames)
|
|
545
645
|
}
|
|
546
646
|
|
|
547
647
|
/// Creates an iterator of values of type `T` that have been [`attached`](Self::attach) or
|
|
548
|
-
/// that are [`provide`](Error::provide)d by [`
|
|
648
|
+
/// that are [`provide`](Error::provide)d by [`Error`] objects.
|
|
549
649
|
#[cfg(nightly)]
|
|
550
650
|
pub fn request_value<T: Send + Sync + 'static>(&self) -> RequestValue<'_, T> {
|
|
551
651
|
RequestValue::new(&self.frames)
|
|
@@ -553,7 +653,7 @@ impl<C> Report<C> {
|
|
|
553
653
|
|
|
554
654
|
/// Returns if `T` is the type held by any frame inside of the report.
|
|
555
655
|
///
|
|
556
|
-
/// `T` could either be an attachment or a [`
|
|
656
|
+
/// `T` could either be an attachment or a [`Error`] context.
|
|
557
657
|
///
|
|
558
658
|
/// ## Example
|
|
559
659
|
///
|
|
@@ -578,7 +678,7 @@ impl<C> Report<C> {
|
|
|
578
678
|
/// Searches the frame stack for a context provider `T` and returns the most recent context
|
|
579
679
|
/// found.
|
|
580
680
|
///
|
|
581
|
-
/// `T` can either be an attachment or a [`
|
|
681
|
+
/// `T` can either be an attachment or a new [`Error`] context.
|
|
582
682
|
///
|
|
583
683
|
/// ## Example
|
|
584
684
|
///
|
|
@@ -605,21 +705,149 @@ impl<C> Report<C> {
|
|
|
605
705
|
|
|
606
706
|
/// Searches the frame stack for an instance of type `T`, returning the most recent one found.
|
|
607
707
|
///
|
|
608
|
-
/// `T` can either be an attachment or a [`
|
|
708
|
+
/// `T` can either be an attachment or a new [`Error`] context.
|
|
609
709
|
#[must_use]
|
|
610
710
|
pub fn downcast_mut<T: Send + Sync + 'static>(&mut self) -> Option<&mut T> {
|
|
611
|
-
|
|
711
|
+
// This cannot use `frames_mut` as the found reference needs to outlive the visitor
|
|
712
|
+
// closure. Each frame is either returned or descended into, never both, so the borrow
|
|
713
|
+
// checker accepts this without `unsafe`.
|
|
714
|
+
let mut stack = vec![self.frames.iter_mut()];
|
|
715
|
+
while let Some(frame) = iter::next(&mut stack) {
|
|
716
|
+
if frame.is::<T>() {
|
|
717
|
+
return frame.downcast_mut();
|
|
718
|
+
}
|
|
719
|
+
stack.push(frame.sources_mut().iter_mut());
|
|
720
|
+
}
|
|
721
|
+
None
|
|
612
722
|
}
|
|
723
|
+
}
|
|
613
724
|
|
|
614
|
-
|
|
725
|
+
impl<C> Report<[C]> {
|
|
726
|
+
/// Returns the direct current frames of this report.
|
|
615
727
|
///
|
|
616
|
-
///
|
|
617
|
-
/// wants to handle the error, the context can then be used to directly access the context's
|
|
618
|
-
/// type. This is only possible for the latest context as the Report does not have multiple
|
|
619
|
-
/// generics as this would either require variadic generics or a workaround like tuple-list.
|
|
728
|
+
/// To get an iterator over the topological sorting of all frames refer to [`frames()`].
|
|
620
729
|
///
|
|
621
|
-
/// This is
|
|
622
|
-
///
|
|
730
|
+
/// This is not the same as [`Report::current_context`], this function gets the underlying
|
|
731
|
+
/// frames that make up this report, while [`Report::current_context`] traverses the stack of
|
|
732
|
+
/// frames to find the current context. A [`Report`] and be made up of multiple [`Frame`]s,
|
|
733
|
+
/// which stack on top of each other. Considering `PrintableA<PrintableA<Context>>`,
|
|
734
|
+
/// [`Report::current_frames`] will return the "outer" layer `PrintableA`, while
|
|
735
|
+
/// [`Report::current_context`] will return the underlying `Error` (the current type
|
|
736
|
+
/// parameter of this [`Report`]).
|
|
737
|
+
///
|
|
738
|
+
/// Using [`Extend`], [`push()`] and [`append()`], a [`Report`] can additionally be made up of
|
|
739
|
+
/// multiple stacks of frames and builds a "group" of them, therefore this function returns a
|
|
740
|
+
/// slice instead, while [`Report::current_context`] only returns a single reference.
|
|
741
|
+
///
|
|
742
|
+
/// [`push()`]: Self::push
|
|
743
|
+
/// [`append()`]: Self::append
|
|
744
|
+
/// [`frames()`]: Self::frames
|
|
745
|
+
/// [`extend_one()`]: Self::extend_one
|
|
746
|
+
#[must_use]
|
|
747
|
+
pub fn current_frames(&self) -> &[Frame] {
|
|
748
|
+
&self.frames
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/// Pushes a new context to the `Report`.
|
|
752
|
+
///
|
|
753
|
+
/// This function adds a new [`Frame`] to the current frames with the frame from the given
|
|
754
|
+
/// [`Report`].
|
|
755
|
+
///
|
|
756
|
+
/// [`current_frames()`]: Self::current_frames
|
|
757
|
+
///
|
|
758
|
+
/// ## Example
|
|
759
|
+
///
|
|
760
|
+
/// ```rust
|
|
761
|
+
/// use std::{fmt, path::Path};
|
|
762
|
+
///
|
|
763
|
+
/// use error_stack::{Report, ResultExt};
|
|
764
|
+
///
|
|
765
|
+
/// #[derive(Debug)]
|
|
766
|
+
/// struct IoError;
|
|
767
|
+
///
|
|
768
|
+
/// impl fmt::Display for IoError {
|
|
769
|
+
/// # fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
770
|
+
/// # const _: &str = stringify!(
|
|
771
|
+
/// ...
|
|
772
|
+
/// # );
|
|
773
|
+
/// # fmt.write_str("Io Error")
|
|
774
|
+
/// # }
|
|
775
|
+
/// }
|
|
776
|
+
///
|
|
777
|
+
/// # impl core::error::Error for IoError {}
|
|
778
|
+
///
|
|
779
|
+
/// # #[allow(unused_variables)]
|
|
780
|
+
/// fn read_config(path: impl AsRef<Path>) -> Result<String, Report<IoError>> {
|
|
781
|
+
/// # #[cfg(any(miri, not(feature = "std")))]
|
|
782
|
+
/// # return Err(error_stack::report!(IoError).attach("Not supported"));
|
|
783
|
+
/// # #[cfg(all(not(miri), feature = "std"))]
|
|
784
|
+
/// std::fs::read_to_string(path.as_ref())
|
|
785
|
+
/// .change_context(IoError)
|
|
786
|
+
/// }
|
|
787
|
+
///
|
|
788
|
+
/// let mut error1 = read_config("config.txt").unwrap_err().expand();
|
|
789
|
+
/// let error2 = read_config("config2.txt").unwrap_err();
|
|
790
|
+
/// let error3 = read_config("config3.txt").unwrap_err();
|
|
791
|
+
///
|
|
792
|
+
/// error1.push(error2);
|
|
793
|
+
/// error1.push(error3);
|
|
794
|
+
/// ```
|
|
795
|
+
pub fn push(&mut self, mut report: Report<C>) {
|
|
796
|
+
self.frames.append(&mut report.frames);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/// Appends the frames from another `Report` to this one.
|
|
800
|
+
///
|
|
801
|
+
/// This method combines the frames of the current `Report` with those of the provided `Report`,
|
|
802
|
+
/// effectively merging the two error reports.
|
|
803
|
+
///
|
|
804
|
+
/// ## Example
|
|
805
|
+
///
|
|
806
|
+
/// ```rust
|
|
807
|
+
/// use std::{fmt, path::Path};
|
|
808
|
+
///
|
|
809
|
+
/// use error_stack::{Report, ResultExt};
|
|
810
|
+
///
|
|
811
|
+
/// #[derive(Debug)]
|
|
812
|
+
/// struct IoError;
|
|
813
|
+
///
|
|
814
|
+
/// impl fmt::Display for IoError {
|
|
815
|
+
/// # fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
816
|
+
/// # const _: &str = stringify!(
|
|
817
|
+
/// ...
|
|
818
|
+
/// # );
|
|
819
|
+
/// # fmt.write_str("Io Error")
|
|
820
|
+
/// # }
|
|
821
|
+
/// }
|
|
822
|
+
///
|
|
823
|
+
/// # impl core::error::Error for IoError {}
|
|
824
|
+
///
|
|
825
|
+
/// # #[allow(unused_variables)]
|
|
826
|
+
/// fn read_config(path: impl AsRef<Path>) -> Result<String, Report<IoError>> {
|
|
827
|
+
/// # #[cfg(any(miri, not(feature = "std")))]
|
|
828
|
+
/// # return Err(error_stack::report!(IoError).attach("Not supported"));
|
|
829
|
+
/// # #[cfg(all(not(miri), feature = "std"))]
|
|
830
|
+
/// std::fs::read_to_string(path.as_ref())
|
|
831
|
+
/// .change_context(IoError)
|
|
832
|
+
/// }
|
|
833
|
+
///
|
|
834
|
+
/// let mut error1 = read_config("config.txt").unwrap_err().expand();
|
|
835
|
+
/// let error2 = read_config("config2.txt").unwrap_err();
|
|
836
|
+
/// let mut error3 = read_config("config3.txt").unwrap_err().expand();
|
|
837
|
+
///
|
|
838
|
+
/// error1.push(error2);
|
|
839
|
+
/// error3.append(error1);
|
|
840
|
+
/// ```
|
|
841
|
+
pub fn append(&mut self, mut report: Self) {
|
|
842
|
+
self.frames.append(&mut report.frames);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
/// Returns an iterator over the current contexts of the `Report`.
|
|
846
|
+
///
|
|
847
|
+
/// This method is similar to [`current_context`], but instead of returning a single context,
|
|
848
|
+
/// it returns an iterator over all contexts in the `Report`.
|
|
849
|
+
///
|
|
850
|
+
/// The order of the contexts should not be relied upon, as it is not guaranteed to be stable.
|
|
623
851
|
///
|
|
624
852
|
/// ## Example
|
|
625
853
|
///
|
|
@@ -635,77 +863,93 @@ impl<C> Report<C> {
|
|
|
635
863
|
/// # fs::read_to_string(path.as_ref()).map_err(Report::from)
|
|
636
864
|
/// }
|
|
637
865
|
///
|
|
638
|
-
/// let
|
|
639
|
-
/// let
|
|
640
|
-
///
|
|
866
|
+
/// let mut a = read_file("test.txt").unwrap_err().expand();
|
|
867
|
+
/// let b = read_file("test2.txt").unwrap_err();
|
|
868
|
+
///
|
|
869
|
+
/// a.push(b);
|
|
870
|
+
///
|
|
871
|
+
/// let io_error = a.current_contexts();
|
|
872
|
+
/// assert_eq!(io_error.count(), 2);
|
|
641
873
|
/// ```
|
|
642
|
-
|
|
643
|
-
|
|
874
|
+
///
|
|
875
|
+
/// [`current_context`]: Self::current_context
|
|
876
|
+
pub fn current_contexts(&self) -> impl Iterator<Item = &C>
|
|
644
877
|
where
|
|
645
878
|
C: Send + Sync + 'static,
|
|
646
879
|
{
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
reported to https://github.com/hashintel/hash/issues/new/choose"
|
|
654
|
-
);
|
|
655
|
-
})
|
|
656
|
-
}
|
|
880
|
+
// this needs a manual traveral implementation, why?
|
|
881
|
+
// We know that each arm has a current context, but we don't know where that context is,
|
|
882
|
+
// therefore we need to search for it on each branch, but stop once we found it, that way
|
|
883
|
+
// we're able to return the current context, even if it is "buried" underneath a bunch of
|
|
884
|
+
// attachments.
|
|
885
|
+
let mut output = Vec::new();
|
|
657
886
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
887
|
+
// this implementation does some "weaving" in a sense, it goes L->R for the frames, then
|
|
888
|
+
// R->L for the sources, which means that some sources might be out of order, but this
|
|
889
|
+
// simplifies implementation.
|
|
890
|
+
let mut stack = vec![self.current_frames()];
|
|
891
|
+
while let Some(frames) = stack.pop() {
|
|
892
|
+
for frame in frames {
|
|
893
|
+
// check if the frame is the current context, in that case we don't need to follow
|
|
894
|
+
// the tree anymore
|
|
895
|
+
if let Some(context) = frame.downcast_ref::<C>() {
|
|
896
|
+
output.push(context);
|
|
897
|
+
continue;
|
|
898
|
+
}
|
|
667
899
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
900
|
+
// descend into the tree
|
|
901
|
+
let sources = frame.sources();
|
|
902
|
+
match sources {
|
|
903
|
+
[] => unreachable!(
|
|
904
|
+
"Report does not contain a context. This is considered a bug and should be \
|
|
905
|
+
reported to https://github.com/hashintel/hash/issues/new/choose"
|
|
906
|
+
),
|
|
907
|
+
sources => {
|
|
908
|
+
stack.push(sources);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
output.into_iter()
|
|
676
915
|
}
|
|
677
916
|
}
|
|
678
917
|
|
|
679
|
-
#[cfg(any(feature = "std", rust_1_81))]
|
|
680
918
|
impl<C: 'static> From<Report<C>> for Box<dyn Error> {
|
|
681
919
|
fn from(report: Report<C>) -> Self {
|
|
682
920
|
Box::new(report.into_error())
|
|
683
921
|
}
|
|
684
922
|
}
|
|
685
923
|
|
|
686
|
-
#[cfg(any(feature = "std", rust_1_81))]
|
|
687
924
|
impl<C: 'static> From<Report<C>> for Box<dyn Error + Send> {
|
|
688
925
|
fn from(report: Report<C>) -> Self {
|
|
689
926
|
Box::new(report.into_error())
|
|
690
927
|
}
|
|
691
928
|
}
|
|
692
929
|
|
|
693
|
-
#[cfg(any(feature = "std", rust_1_81))]
|
|
694
930
|
impl<C: 'static> From<Report<C>> for Box<dyn Error + Sync> {
|
|
695
931
|
fn from(report: Report<C>) -> Self {
|
|
696
932
|
Box::new(report.into_error())
|
|
697
933
|
}
|
|
698
934
|
}
|
|
699
935
|
|
|
700
|
-
#[cfg(any(feature = "std", rust_1_81))]
|
|
701
936
|
impl<C: 'static> From<Report<C>> for Box<dyn Error + Send + Sync> {
|
|
702
937
|
fn from(report: Report<C>) -> Self {
|
|
703
938
|
Box::new(report.into_error())
|
|
704
939
|
}
|
|
705
940
|
}
|
|
706
941
|
|
|
942
|
+
impl<C> From<Report<C>> for Report<[C]> {
|
|
943
|
+
fn from(report: Report<C>) -> Self {
|
|
944
|
+
Self {
|
|
945
|
+
frames: report.frames,
|
|
946
|
+
_context: PhantomData,
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
707
951
|
#[cfg(feature = "std")]
|
|
708
|
-
impl<
|
|
952
|
+
impl<C> std::process::Termination for Report<C> {
|
|
709
953
|
fn report(self) -> ExitCode {
|
|
710
954
|
#[cfg(not(nightly))]
|
|
711
955
|
return ExitCode::FAILURE;
|
|
@@ -718,23 +962,97 @@ impl<Context> std::process::Termination for Report<Context> {
|
|
|
718
962
|
}
|
|
719
963
|
}
|
|
720
964
|
|
|
721
|
-
impl<
|
|
722
|
-
fn from_iter<T: IntoIterator<Item = Report<
|
|
965
|
+
impl<C> FromIterator<Report<C>> for Option<Report<[C]>> {
|
|
966
|
+
fn from_iter<T: IntoIterator<Item = Report<C>>>(iter: T) -> Self {
|
|
723
967
|
let mut iter = iter.into_iter();
|
|
724
968
|
|
|
725
|
-
let mut base = iter.next()
|
|
969
|
+
let mut base = iter.next()?.expand();
|
|
726
970
|
for rest in iter {
|
|
727
|
-
base.
|
|
971
|
+
base.push(rest);
|
|
728
972
|
}
|
|
729
973
|
|
|
730
974
|
Some(base)
|
|
731
975
|
}
|
|
732
976
|
}
|
|
733
977
|
|
|
734
|
-
impl<
|
|
735
|
-
fn
|
|
978
|
+
impl<C> FromIterator<Report<[C]>> for Option<Report<[C]>> {
|
|
979
|
+
fn from_iter<T: IntoIterator<Item = Report<[C]>>>(iter: T) -> Self {
|
|
980
|
+
let mut iter = iter.into_iter();
|
|
981
|
+
|
|
982
|
+
let mut base = iter.next()?;
|
|
983
|
+
for mut rest in iter {
|
|
984
|
+
base.frames.append(&mut rest.frames);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
Some(base)
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
impl<C> Extend<Report<C>> for Report<[C]> {
|
|
992
|
+
fn extend<T: IntoIterator<Item = Report<C>>>(&mut self, iter: T) {
|
|
736
993
|
for item in iter {
|
|
737
|
-
self.
|
|
994
|
+
self.push(item);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
impl<C> Extend<Self> for Report<[C]> {
|
|
1000
|
+
fn extend<T: IntoIterator<Item = Self>>(&mut self, iter: T) {
|
|
1001
|
+
for mut item in iter {
|
|
1002
|
+
self.frames.append(&mut item.frames);
|
|
738
1003
|
}
|
|
739
1004
|
}
|
|
740
1005
|
}
|
|
1006
|
+
|
|
1007
|
+
/// Provides unified way to convert an error-like structure to a [`Report`].
|
|
1008
|
+
///
|
|
1009
|
+
/// This trait allows both [`Report<C>`] instances and regular error types to be converted into a
|
|
1010
|
+
/// [`Report`]. It is automatically implemented for any type that can be converted into a [`Report`]
|
|
1011
|
+
/// via the [`Into`] trait.
|
|
1012
|
+
///
|
|
1013
|
+
/// This trait is particularly useful when working with functions that need to return a [`Report`],
|
|
1014
|
+
/// as it provides a consistent way to convert errors into reports without explicitly calling
|
|
1015
|
+
/// conversion methods.
|
|
1016
|
+
///
|
|
1017
|
+
/// # Examples
|
|
1018
|
+
///
|
|
1019
|
+
/// ```rust
|
|
1020
|
+
/// use std::io;
|
|
1021
|
+
///
|
|
1022
|
+
/// use error_stack::{IntoReport as _, Report};
|
|
1023
|
+
///
|
|
1024
|
+
/// # #[expect(dead_code)]
|
|
1025
|
+
/// fn example() -> Result<(), Report<io::Error>> {
|
|
1026
|
+
/// // io::Error implements Into<Report<io::Error>>, so we can use into_report()
|
|
1027
|
+
/// let err = io::Error::new(io::ErrorKind::Other, "oh no!");
|
|
1028
|
+
/// Err(err.into_report())
|
|
1029
|
+
/// }
|
|
1030
|
+
/// ```
|
|
1031
|
+
pub trait IntoReport {
|
|
1032
|
+
/// The context type that will be used in the resulting [`Report`].
|
|
1033
|
+
type Context: ?Sized;
|
|
1034
|
+
|
|
1035
|
+
/// Converts this value into a [`Report`].
|
|
1036
|
+
fn into_report(self) -> Report<Self::Context>;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
impl<C: ?Sized> IntoReport for Report<C> {
|
|
1040
|
+
type Context = C;
|
|
1041
|
+
|
|
1042
|
+
#[track_caller]
|
|
1043
|
+
fn into_report(self) -> Report<Self::Context> {
|
|
1044
|
+
self
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
impl<E> IntoReport for E
|
|
1049
|
+
where
|
|
1050
|
+
E: Into<Report<E>>,
|
|
1051
|
+
{
|
|
1052
|
+
type Context = E;
|
|
1053
|
+
|
|
1054
|
+
#[track_caller]
|
|
1055
|
+
fn into_report(self) -> Report<Self::Context> {
|
|
1056
|
+
self.into()
|
|
1057
|
+
}
|
|
1058
|
+
}
|