From 44cad267c29b6b41e0ec935bd312cee179e28ad9 Mon Sep 17 00:00:00 2001 From: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> Date: Wed, 13 Dec 2023 10:50:50 +0100 Subject: [PATCH] Add wrapping behaviour to code labels (#116) Our error reporter had no wrapping behaviour for code labels: they would happily go as far right as they wanted, often overflowing the assumed width of the terminal they are being printed on. This PR changes that behaviour in two ways: - Labels are no longer forced to be right-positioned to the code span they refer to. If it helps to keep them on one line, we now position them to the left or centred (with this order of preference). - If they would necessarily overflow the maximum allowed width, we perform text wrapping. Getting this right was... tricky. But we have a fairly extensive collection of error messages in our UI tests and the new version seems to work as expected. --- doc_examples/quickstart/05-error.snap | 4 +- libs/Cargo.lock | 3 +- .../expectations/stderr.txt | 18 +-- .../expectations/stderr.txt | 10 +- .../expectations/stderr.txt | 24 +-- .../expectations/stderr.txt | 8 +- .../expectations/stderr.txt | 8 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 24 +-- .../expectations/stderr.txt | 6 +- .../expectations/stderr.txt | 4 +- .../expectations/stderr.txt | 6 +- .../expectations/stderr.txt | 12 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 4 +- .../expectations/stderr.txt | 4 +- .../invalid_paths/expectations/stderr.txt | 8 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 21 +-- .../expectations/stderr.txt | 6 +- .../expectations/stderr.txt | 4 +- .../expectations/stderr.txt | 4 +- .../expectations/stderr.txt | 6 +- .../expectations/stderr.txt | 6 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 8 +- .../expectations/stderr.txt | 4 +- .../expectations/stderr.txt | 4 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 4 +- .../expectations/stderr.txt | 2 +- .../expectations/stderr.txt | 6 +- .../expectations/stderr.txt | 14 +- .../src/graphical_report_handler.rs | 147 +++++++++++++++--- 44 files changed, 255 insertions(+), 154 deletions(-) diff --git a/doc_examples/quickstart/05-error.snap b/doc_examples/quickstart/05-error.snap index ddc63dcc5..4c76eb78b 100644 --- a/doc_examples/quickstart/05-error.snap +++ b/doc_examples/quickstart/05-error.snap @@ -7,14 +7,14 @@ ERROR: │ 13 │ bp.route(GET, "/api/ping", f!(crate::routes::status::ping)); │ 14 │ bp.route(GET, "/api/greet/:name", f!(crate::routes::greet::greet)); │ · ───────────────┬─────────────── - │ · ╰── The request handler was registered here + │ · The request handler was registered here ──╯ │ 15 │ bp │ ╰──── │ ╭─[demo/src/routes/greet.rs:10:1] │ 10 │ │ 11 │ pub fn greet(params: RouteParams, user_agent: UserAgent) -> Response { │ · ────┬──── - │ · ╰── I don't know how to construct an instance of this input parameter + │ · I don't know how to construct an instance of this input parameter │ 12 │ if let UserAgent::Unknown = user_agent { │ ╰──── │ help: Register a constructor for `demo::user_agent::UserAgent` diff --git a/libs/Cargo.lock b/libs/Cargo.lock index c036ed21f..53bdc988e 100644 --- a/libs/Cargo.lock +++ b/libs/Cargo.lock @@ -263,7 +263,8 @@ dependencies = [ [[package]] name = "cargo-generate" version = "0.18.5" -source = "git+https://github.com/LukeMathWalker/cargo-generate?branch=main#3bf2c4b88732a9e5f6247997dbcc83f0feb9b9ef" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a2885ae054e000b117515ab33e91c10eca90c2788a7baec1b97ada1f1f51e57" dependencies = [ "anyhow", "auth-git2", diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/common/cannot_return_the_unit_type/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/common/cannot_return_the_unit_type/expectations/stderr.txt index cf91ea2de..7ee8952b2 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/common/cannot_return_the_unit_type/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/common/cannot_return_the_unit_type/expectations/stderr.txt @@ -6,7 +6,7 @@ │ 44 │ let mut bp = Blueprint::new(); │ 45 │ bp.constructor(f!(crate::constructor), Lifecycle::Singleton); │ ·  ───────────┬────────── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 46 │ bp.constructor( │ ╰──── @@ -19,7 +19,7 @@ │ 46 │ bp.constructor( │ 47 │ f!(crate::fallible_constructor_building_unit), │ ·  ──────────────────────┬────────────────────── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 48 │ Lifecycle::RequestScoped, │ ╰──── @@ -33,7 +33,7 @@ │ 56 │ bp.route(GET, "/home", f!(crate::handler)); │ 57 │ bp.route(GET, "/unit", f!(crate::unit_handler)); │ ·  ───────────┬─────────── - │ · ╰── The request handler was registered here + │ · The request handler was registered here │ 58 │ bp.route(GET, "/fallible_unit", f!(crate::fallible_unit_handler)) │ ╰──── @@ -47,7 +47,7 @@ │ 57 │ bp.route(GET, "/unit", f!(crate::unit_handler)); │ 58 │ bp.route(GET, "/fallible_unit", f!(crate::fallible_unit_handler)) │ ·  ────────────────┬─────────────── - │ · ╰── The request handler was registered here + │ · The request handler was registered here ──╯ │ 59 │ .error_handler(f!(crate::error_handler)); │ ╰──── @@ -61,7 +61,7 @@ │ 52 │ │ 53 │ bp.wrap(f!(crate::unit_wrapping_middleware)); │ ·  ─────────────────┬───────────────── - │ · ╰── The wrapping middleware was registered here + │ · The wrapping middleware was registered here │ 54 │ bp.wrap(f!(crate::fallible_wrapping_middleware)) │ ╰──── @@ -75,7 +75,7 @@ │ 53 │ bp.wrap(f!(crate::unit_wrapping_middleware)); │ 54 │ bp.wrap(f!(crate::fallible_wrapping_middleware)) │ ·  ───────────────────┬─────────────────── - │ · ╰── The wrapping middleware was registered here + │ · The wrapping middleware was registered here │ 55 │ .error_handler(f!(crate::error_handler)); │ ╰──── @@ -89,7 +89,7 @@ │ 54 │ bp.wrap(f!(crate::fallible_wrapping_middleware)) │ 55 │ .error_handler(f!(crate::error_handler)); │ ·  ────────────┬─────────── - │ · ╰── The error handler was registered here + │ · The error handler was registered here │ 56 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── @@ -103,7 +103,7 @@ │ 58 │ bp.route(GET, "/fallible_unit", f!(crate::fallible_unit_handler)) │ 59 │ .error_handler(f!(crate::error_handler)); │ ·  ────────────┬─────────── - │ · ╰── The error handler was registered here + │ · The error handler was registered here │ 60 │ bp │ ╰──── @@ -117,6 +117,6 @@ │ 50 │ bp.constructor(f!(crate::fallible_constructor), Lifecycle::RequestScoped) │ 51 │ .error_handler(f!(crate::error_handler)); │ ·  ────────────┬─────────── - │ · ╰── The error handler was registered here + │ · The error handler was registered here │ 52 │ │ ╰──── \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/common/output_type_must_implement_into_response/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/common/output_type_must_implement_into_response/expectations/stderr.txt index 14683b2ec..e07bdf255 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/common/output_type_must_implement_into_response/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/common/output_type_must_implement_into_response/expectations/stderr.txt @@ -7,7 +7,7 @@ │ 37 │ .error_handler(f!(crate::error_handler)); │ 38 │ bp.route(GET, "/home", f!(crate::handler)) │ ·  ─────────┬──────── - │ · ╰── The request handler was registered here + │ · The request handler was registered here │ 39 │ .error_handler(f!(crate::error_handler)); │ ╰──── │  help: Implement `pavex::response::IntoResponse` for @@ -22,7 +22,7 @@ │ 33 │ let mut bp = Blueprint::new(); │ 34 │ bp.wrap(f!(crate::wrapping_middleware)) │ ·  ───────────────┬────────────── - │ · ╰── The wrapping middleware was registered here + │ · ╰── The wrapping middleware was registered here │ 35 │ .error_handler(f!(crate::error_handler)); │ ╰──── │  help: Implement `pavex::response::IntoResponse` for @@ -37,7 +37,7 @@ │ 34 │ bp.wrap(f!(crate::wrapping_middleware)) │ 35 │ .error_handler(f!(crate::error_handler)); │ ·  ────────────┬─────────── - │ · ╰── The error handler was registered here + │ · The error handler was registered here │ 36 │ bp.constructor(f!(crate::request_scoped), Lifecycle::RequestScoped) │ ╰──── │  help: Implement `pavex::response::IntoResponse` for @@ -52,7 +52,7 @@ │ 38 │ bp.route(GET, "/home", f!(crate::handler)) │ 39 │ .error_handler(f!(crate::error_handler)); │ ·  ────────────┬─────────── - │ · ╰── The error handler was registered here + │ · The error handler was registered here │ 40 │ bp │ ╰──── │  help: Implement `pavex::response::IntoResponse` for @@ -67,7 +67,7 @@ │ 36 │ bp.constructor(f!(crate::request_scoped), Lifecycle::RequestScoped) │ 37 │ .error_handler(f!(crate::error_handler)); │ ·  ────────────┬─────────── - │ · ╰── The error handler was registered here + │ · The error handler was registered here │ 38 │ bp.route(GET, "/home", f!(crate::handler)) │ ╰──── │  help: Implement `pavex::response::IntoResponse` for diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/constructors/constructors_input_parameters_cannot_be_generic/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/constructors/constructors_input_parameters_cannot_be_generic/expectations/stderr.txt index e8f876911..95c1723f8 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/constructors/constructors_input_parameters_cannot_be_generic/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/constructors/constructors_input_parameters_cannot_be_generic/expectations/stderr.txt @@ -9,14 +9,14 @@ │ 27 │ let mut bp = Blueprint::new(); │ 28 │ bp.constructor(f!(crate::generic_constructor), Lifecycle::RequestScoped); │ ·  ───────────────┬────────────── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 29 │ bp.constructor( │ ╰──── │ ╭─[src/lib.rs:1:1] │ 1 │ pub fn generic_constructor(generic_input: GenericType) -> u8 { │ ·  ┬ ─┬ - │ · │ ╰── ..because it is not used here - │ · ╰── I can't infer this.. + │ · │ ..because it is not used here ──╯ + │ · ╰── I can't infer this.. │ 2 │ todo!() │ ╰──── │  help: Specify the concrete type(s) for the problematic generic @@ -37,15 +37,15 @@ │ 29 │ bp.constructor( │ 30 │ f!(crate::doubly_generic_constructor), │ ·  ──────────────────┬────────────────── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 31 │ Lifecycle::RequestScoped, │ ╰──── │ ╭─[src/lib.rs:1:1] │ 1 │ pub fn doubly_generic_constructor(i1: GenericType, i2: GenericType) -> u16 { │ ·  ┬ ┬ ─┬─ - │ · │ │ ╰── ..because they are not used here - │ · │ ╰── I can't infer this.. - │ · ╰── I can't infer this.. + │ · │ │ ..because they are not used here ──╯ + │ · │ ╰── I can't infer this.. + │ · ╰── I can't infer this.. │ 2 │ todo!() │ ╰──── │  help: Specify the concrete type(s) for the problematic generic @@ -66,22 +66,22 @@ │ 33 │ bp.constructor( │ 34 │ f!(crate::triply_generic_constructor), │ ·  ──────────────────┬────────────────── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 35 │ Lifecycle::RequestScoped, │ ╰──── │ ╭─[src/lib.rs:1:1] │ 1 │ pub fn triply_generic_constructor( │ ·  ┬ ┬ ┬ - │ · │ │ ╰── I can't infer this.. - │ · │ ╰── I can't infer this.. - │ · ╰── I can't infer this.. + │ · │ │ ╰── I can't infer this.. + │ · │ ╰── I can't infer this.. + │ · ╰── I can't infer this.. │ 2 │ i1: GenericType, │ ╰──── │ ╭─[src/lib.rs:4:1] │ 4 │ i3: GenericType, │ 5 │ ) -> u32 { │ ·  ─┬─ - │ · ╰── ..because they are not used here + │ · ╰── ..because they are not used here │ 6 │ todo!() │ ╰──── │  help: Specify the concrete type(s) for the problematic generic diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/constructors/output_type_of_constructors_cannot_be_a_naked_generic/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/constructors/output_type_of_constructors_cannot_be_a_naked_generic/expectations/stderr.txt index 350a9ae2a..2f532b6e9 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/constructors/output_type_of_constructors_cannot_be_a_naked_generic/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/constructors/output_type_of_constructors_cannot_be_a_naked_generic/expectations/stderr.txt @@ -10,13 +10,13 @@ │ 23 │ let mut bp = Blueprint::new(); │ 24 │ bp.constructor(f!(crate::naked), Lifecycle::RequestScoped); │ ·  ────────┬─────── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 25 │ bp.constructor(f!(crate::fallible_naked), Lifecycle::RequestScoped) │ ╰──── │ ╭─[src/lib.rs:1:1] │ 1 │ pub fn naked() -> T { │ ·  ┬ - │ · ╰── The invalid output type + │ · ╰── The invalid output type │ 2 │ todo!() │ ╰──── │  help: Can you return a concrete type as output? @@ -35,13 +35,13 @@ │ 24 │ bp.constructor(f!(crate::naked), Lifecycle::RequestScoped); │ 25 │ bp.constructor(f!(crate::fallible_naked), Lifecycle::RequestScoped) │ ·  ────────────┬──────────── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 26 │ .error_handler(f!(crate::error_handler)); │ ╰──── │ ╭─[src/lib.rs:1:1] │ 1 │ pub fn fallible_naked() -> Result { │ ·  ────────────┬─────────── - │ · ╰── The invalid output type + │ · ╰── The invalid output type │ 2 │ todo!() │ ╰──── │  help: Can you return a concrete type as output? diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/constructors/trait_constraints_on_runtime_singletons/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/constructors/trait_constraints_on_runtime_singletons/expectations/stderr.txt index 3255b7246..d89a2b621 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/constructors/trait_constraints_on_runtime_singletons/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/constructors/trait_constraints_on_runtime_singletons/expectations/stderr.txt @@ -5,7 +5,7 @@ │ 52 │ bp.constructor(f!(crate::NonSendSingleton::new), Lifecycle::Singleton); │ 53 │ bp.constructor(f!(crate::NonCloneSingleton::new), Lifecycle::Singleton); │ ·  ────────────────┬──────────────── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 54 │ bp.constructor(f!(crate::NonSyncSingleton::new), Lifecycle::Singleton); │ ╰──── │  help: All singletons must implement the `Send`, `Sync` and `Clone` traits. @@ -19,7 +19,7 @@ │ 53 │ bp.constructor(f!(crate::NonCloneSingleton::new), Lifecycle::Singleton); │ 54 │ bp.constructor(f!(crate::NonSyncSingleton::new), Lifecycle::Singleton); │ ·  ────────────────┬─────────────── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 55 │ // The handler is needed because bounds are only checked for singletons │ ╰──── │  help: All singletons must implement the `Send`, `Sync` and `Clone` traits. @@ -33,7 +33,7 @@ │ 51 │ let mut bp = Blueprint::new(); │ 52 │ bp.constructor(f!(crate::NonSendSingleton::new), Lifecycle::Singleton); │ ·  ────────────────┬─────────────── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 53 │ bp.constructor(f!(crate::NonCloneSingleton::new), Lifecycle::Singleton); │ ╰──── │  help: All singletons must implement the `Send`, `Sync` and `Clone` traits. @@ -47,7 +47,7 @@ │ 51 │ let mut bp = Blueprint::new(); │ 52 │ bp.constructor(f!(crate::NonSendSingleton::new), Lifecycle::Singleton); │ ·  ────────────────┬─────────────── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 53 │ bp.constructor(f!(crate::NonCloneSingleton::new), Lifecycle::Singleton); │ ╰──── │  help: All singletons must implement the `Send`, `Sync` and `Clone` traits. diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/cannot_register_an_error_handler_for_a_sync_infallible_constructor/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/cannot_register_an_error_handler_for_a_sync_infallible_constructor/expectations/stderr.txt index da28e8ebc..d3f1a7feb 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/cannot_register_an_error_handler_for_a_sync_infallible_constructor/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/cannot_register_an_error_handler_for_a_sync_infallible_constructor/expectations/stderr.txt @@ -6,7 +6,7 @@ │ 23 │ bp.constructor(f!(crate::infallible_constructor), Lifecycle::RequestScoped) │ 24 │ .error_handler(f!(crate::error_handler)); │ ·  ────────────┬─────────── - │ · ╰── The unnecessary error handler was registered here + │ · The unnecessary error handler was registered here │ 25 │ bp.route(GET, "/home", f!(crate::request_handler)); │ ╰──── │  help: Remove the error handler, it is not needed. The constructor is diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/cannot_register_an_error_handler_for_an_async_infallible_constructor/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/cannot_register_an_error_handler_for_an_async_infallible_constructor/expectations/stderr.txt index da28e8ebc..d3f1a7feb 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/cannot_register_an_error_handler_for_an_async_infallible_constructor/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/cannot_register_an_error_handler_for_an_async_infallible_constructor/expectations/stderr.txt @@ -6,7 +6,7 @@ │ 23 │ bp.constructor(f!(crate::infallible_constructor), Lifecycle::RequestScoped) │ 24 │ .error_handler(f!(crate::error_handler)); │ ·  ────────────┬─────────── - │ · ╰── The unnecessary error handler was registered here + │ · The unnecessary error handler was registered here │ 25 │ bp.route(GET, "/home", f!(crate::request_handler)); │ ╰──── │  help: Remove the error handler, it is not needed. The constructor is diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/error_handlers_must_take_a_reference_to_the_error_as_input/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/error_handlers_must_take_a_reference_to_the_error_as_input/expectations/stderr.txt index 098db1b64..d2461194f 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/error_handlers_must_take_a_reference_to_the_error_as_input/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/error_handlers_must_take_a_reference_to_the_error_as_input/expectations/stderr.txt @@ -8,6 +8,6 @@ │ 22 │ bp.constructor(f!(crate::fallible_constructor), Lifecycle::RequestScoped) │ 23 │ .error_handler(f!(crate::error_handler)); │ ·  ────────────┬─────────── - │ · ╰── The error handler was registered here + │ · The error handler was registered here │ 24 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/generics_in_error_handlers_must_be_tied_to_the_error/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/generics_in_error_handlers_must_be_tied_to_the_error/expectations/stderr.txt index 688794230..88dc99c1e 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/generics_in_error_handlers_must_be_tied_to_the_error/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/error_handlers/generics_in_error_handlers_must_be_tied_to_the_error/expectations/stderr.txt @@ -9,14 +9,14 @@ │ 53 │ bp.constructor(f!(crate::constructor1), Lifecycle::RequestScoped) │ 54 │ .error_handler(f!(crate::generic_error_handler)); │ ·  ────────────────┬─────────────── - │ · ╰── The error handler was registered here + │ · The error handler was registered here │ 55 │ bp.constructor(f!(crate::constructor2), Lifecycle::RequestScoped) │ ╰──── │ ╭─[src/lib.rs:1:1] │ 1 │ pub fn generic_error_handler(error: &Error, generic_input: GenericType) -> Response { │ ·  ┬ ──────┬────── - │ · │ ╰── ..because it is not used here - │ · ╰── I can't infer this.. + │ · │ ╰── ..because it is not used here + │ · ╰── I can't infer this.. │ 2 │ todo!() │ ╰──── │  help: Specify the concrete type(s) for the problematic generic @@ -37,17 +37,17 @@ │ 55 │ bp.constructor(f!(crate::constructor2), Lifecycle::RequestScoped) │ 56 │ .error_handler(f!(crate::doubly_generic_error_handler)); │ ·  ───────────────────┬─────────────────── - │ · ╰── The error handler was registered here + │ · The error handler was registered here ──╯ │ 57 │ bp.constructor(f!(crate::constructor3), Lifecycle::Transient) │ ╰──── │ ╭─[src/lib.rs:1:1] │ 1 │ pub fn doubly_generic_error_handler( │ ·  ┬ ┬ - │ · │ ╰── I can't infer this.. - │ · ╰── I can't infer this.. + │ · │ ╰── I can't infer this.. + │ · ╰── I can't infer this.. │ 2 │ error: &Error, │ ·  ──────┬────── - │ · ╰── ..because they are not used here + │ · ╰── ..because they are not used here │ 3 │ i1: GenericType, │ ╰──── │  help: Specify the concrete type(s) for the problematic generic @@ -68,18 +68,18 @@ │ 57 │ bp.constructor(f!(crate::constructor3), Lifecycle::Transient) │ 58 │ .error_handler(f!(crate::triply_generic_error_handler)); │ ·  ───────────────────┬─────────────────── - │ · ╰── The error handler was registered here + │ · The error handler was registered here ──╯ │ 59 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── │ ╭─[src/lib.rs:1:1] │ 1 │ pub fn triply_generic_error_handler( │ ·  ┬ ┬ ┬ - │ · │ │ ╰── I can't infer this.. - │ · │ ╰── I can't infer this.. - │ · ╰── I can't infer this.. + │ · │ │ ╰── I can't infer this.. + │ · │ ╰── I can't infer this.. + │ · ╰── I can't infer this.. │ 2 │ error: &Error, │ ·  ──────┬────── - │ · ╰── ..because they are not used here + │ · ╰── ..because they are not used here │ 3 │ i1: GenericType, │ ╰──── │  help: Specify the concrete type(s) for the problematic generic diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nest_at_prefix_is_validated/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nest_at_prefix_is_validated/expectations/stderr.txt index 7340219f1..a8f57bab9 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nest_at_prefix_is_validated/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nest_at_prefix_is_validated/expectations/stderr.txt @@ -11,7 +11,7 @@ │ 12 │ // If the prefix is not empty, it **cannot** end with a `/` │ 13 │ bp.nest_at("/api/", sub_blueprint()); │ ·  ───┬─── - │ · ╰── The prefix ending with a trailing '/' + │ · ╰── The prefix ending with a trailing '/' │ 14 │ bp │ ╰──── │  help: Remove the '/' at the end of the path prefix to fix this error: use @@ -25,7 +25,7 @@ │ 10 │ // If the prefix is not empty, it **must** start with a `/` │ 11 │ bp.nest_at("api", sub_blueprint()); │ ·  ──┬── - │ · ╰── The prefix missing a leading '/' + │ · ╰── The prefix missing a leading '/' │ 12 │ // If the prefix is not empty, it **cannot** end with a `/` │ ╰──── │  help: Add a '/' at the beginning of the path prefix to fix this error: use @@ -38,7 +38,7 @@ │  8 │ // The prefix cannot be empty │  9 │ bp.nest_at("", sub_blueprint()); │ ·  ─┬ - │ · ╰── The empty prefix + │ · ╰── The empty prefix │ 10 │ // If the prefix is not empty, it **must** start with a `/` │ ╰──── │  help: If you don't want to add a common prefix to all routes in the nested diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_fails_if_parent_singleton_is_overridden/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_fails_if_parent_singleton_is_overridden/expectations/stderr.txt index f9870cda3..9dcd62117 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_fails_if_parent_singleton_is_overridden/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_fails_if_parent_singleton_is_overridden/expectations/stderr.txt @@ -10,14 +10,14 @@ │  8 │ let mut bp = Blueprint::new(); │  9 │ bp.constructor(f!(crate::singleton), Lifecycle::Singleton); │ ·  ──────────┬───────── - │ · ╰── A constructor was registered here + │ · ╰── A constructor was registered here │ 10 │ bp.route(GET, "/parent", f!(crate::handler)); │ ╰──── │ ╭─[src/lib.rs:28:1] │ 28 │ let mut bp = Blueprint::new(); │ 29 │ bp.constructor(f!(crate::overridden_singleton), Lifecycle::Singleton); │ ·  ───────────────┬─────────────── - │ · ╰── A constructor was registered here + │ · ╰── A constructor was registered here │ 30 │ bp.route(GET, "/child", f!(crate::handler)); │ ╰──── │  help: If you want a single instance of `u64`, remove constructors for diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_fails_if_the_same_singleton_constructor_is_registered_in_different_scopes/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_fails_if_the_same_singleton_constructor_is_registered_in_different_scopes/expectations/stderr.txt index 05d94c915..555dc3e82 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_fails_if_the_same_singleton_constructor_is_registered_in_different_scopes/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_fails_if_the_same_singleton_constructor_is_registered_in_different_scopes/expectations/stderr.txt @@ -10,14 +10,14 @@ │  8 │ let mut bp = Blueprint::new(); │  9 │ bp.constructor(f!(crate::singleton), Lifecycle::Singleton); │ ·  ──────────┬───────── - │ · ╰── A constructor was registered here + │ · ╰── A constructor was registered here │ 10 │ bp.route(GET, "/parent", f!(crate::handler)); │ ╰──── │ ╭─[src/lib.rs:24:1] │ 24 │ let mut bp = Blueprint::new(); │ 25 │ bp.constructor(f!(crate::singleton), Lifecycle::Singleton); │ ·  ──────────┬───────── - │ · ╰── A constructor was registered here + │ · ╰── A constructor was registered here │ 26 │ bp.route(GET, "/child", f!(crate::handler)); │ ╰──── │ help: If you want to share a single instance of `u64`, remove constructors @@ -28,7 +28,7 @@ │ 7 │ pub fn blueprint() -> Blueprint { │ 8 │ let mut bp = Blueprint::new(); │ ·  ────────┬─────── - │ · ╰── Register your constructor against this blueprint + │ · Register your constructor against this blueprint │ 9 │ bp.constructor(f!(crate::singleton), Lifecycle::Singleton); │ ╰──── │  help: If you want different instances, consider creating separate newtypes diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_hides_constructors_of_the_nested_bp_to_the_parent_bp/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_hides_constructors_of_the_nested_bp_to_the_parent_bp/expectations/stderr.txt index c9c285b7e..260650bfc 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_hides_constructors_of_the_nested_bp_to_the_parent_bp/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/nesting/nesting_hides_constructors_of_the_nested_bp_to_the_parent_bp/expectations/stderr.txt @@ -6,14 +6,14 @@ │  9 │ bp.nest(sub_blueprint()); │ 10 │ bp.route(GET, "/parent", f!(crate::handler)); │ ·  ─────────┬──────── - │ · ╰── The request handler was registered here + │ · The request handler was registered here │ 11 │ bp │ ╰──── │ ╭─[src/lib.rs:25:1] │ 25 │ │ 26 │ pub fn handler(_x: u64, _y: u32, _z: u16) -> StatusCode { │ ·  ─┬─ - │ · ╰── I don't know how to construct an instance of this input parameter + │ · I don't know how to construct an instance of this input parameter │ 27 │ todo!() │ ╰──── │  help: Register a constructor for `u64` @@ -26,14 +26,14 @@ │  9 │ bp.nest(sub_blueprint()); │ 10 │ bp.route(GET, "/parent", f!(crate::handler)); │ ·  ─────────┬──────── - │ · ╰── The request handler was registered here + │ · The request handler was registered here │ 11 │ bp │ ╰──── │ ╭─[src/lib.rs:25:1] │ 25 │ │ 26 │ pub fn handler(_x: u64, _y: u32, _z: u16) -> StatusCode { │ ·  ─┬─ - │ · ╰── I don't know how to construct an instance of this input parameter + │ · I don't know how to construct an instance of this input parameter │ 27 │ todo!() │ ╰──── │  help: Register a constructor for `u32` @@ -46,14 +46,14 @@ │  9 │ bp.nest(sub_blueprint()); │ 10 │ bp.route(GET, "/parent", f!(crate::handler)); │ ·  ─────────┬──────── - │ · ╰── The request handler was registered here + │ · The request handler was registered here │ 11 │ bp │ ╰──── │ ╭─[src/lib.rs:25:1] │ 25 │ │ 26 │ pub fn handler(_x: u64, _y: u32, _z: u16) -> StatusCode { │ ·  ─┬─ - │ · ╰── I don't know how to construct an instance of this input parameter + │ · I don't know how to construct an instance of this input parameter │ 27 │ todo!() │ ╰──── │  help: Register a constructor for `u16` \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/router/ambiguous_fallback/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/router/ambiguous_fallback/expectations/stderr.txt index 135f278de..d32a19609 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/router/ambiguous_fallback/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/router/ambiguous_fallback/expectations/stderr.txt @@ -13,7 +13,7 @@ │ 26 │ }); │ 27 │ bp.route(POST, "/users/yo", f!(crate::handler)); │ ·  ─────┬───── - │ · ╰── The route was registered here + │ · ╰── The route was registered here │ 28 │ bp │ ╰──── │  help: You can fix this by registering `POST /users/yo` against the nested diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/router/conflicting_any_and_single_method_guards/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/router/conflicting_any_and_single_method_guards/expectations/stderr.txt index e91e87b0e..a23ef0d66 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/router/conflicting_any_and_single_method_guards/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/router/conflicting_any_and_single_method_guards/expectations/stderr.txt @@ -6,14 +6,14 @@ │ 16 │ let mut bp = Blueprint::new(); │ 17 │ bp.route(ANY, "/home", f!(crate::handler_1)); │ ·  ──────────┬───────── - │ · ╰── The first conflicting handler + │ · ╰── The first conflicting handler │ 18 │ bp.route(GET, "/home", f!(crate::handler_2)); │ ╰──── │ ╭─[src/lib.rs:17:1] │ 17 │ bp.route(ANY, "/home", f!(crate::handler_1)); │ 18 │ bp.route(GET, "/home", f!(crate::handler_2)); │ ·  ──────────┬───────── - │ · ╰── The second conflicting handler + │ · ╰── The second conflicting handler │ 19 │ bp │ ╰──── │  help: You can only register one request handler for each path+method diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/router/different_fallback_for_each_method/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/router/different_fallback_for_each_method/expectations/stderr.txt index 011d609b7..4a61e758f 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/router/different_fallback_for_each_method/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/router/different_fallback_for_each_method/expectations/stderr.txt @@ -13,14 +13,14 @@ │ 29 │ bp.route(POST, "/id", f!(crate::handler)); │ 30 │ bp.fallback(f!(crate::fallback2)); │ ·  ──────────┬───────── - │ · ╰── The first fallback + │ · ╰── The first fallback │ 31 │ bp │ ╰──── │ ╭─[src/lib.rs:23:1] │ 23 │ bp.route(GET, "/id", f!(crate::handler)); │ 24 │ bp.fallback(f!(crate::fallback1)); │ ·  ──────────┬───────── - │ · ╰── The second fallback + │ · ╰── The second fallback │ 25 │ bp │ ╰──── │  help: Adjust your blueprint to have the same fallback handler for all `/ diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/router/invalid_paths/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/router/invalid_paths/expectations/stderr.txt index f39224b83..4904dcf45 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/router/invalid_paths/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/router/invalid_paths/expectations/stderr.txt @@ -5,7 +5,7 @@ │ 12 │ let mut bp = Blueprint::new(); │ 13 │ bp.route(ANY, "/:too:many:params", f!(crate::handler)); │ ·  ─────────┬───────── - │ · ╰── The problematic path + │ · ╰── The problematic path │ 14 │ bp.route(GET, "/*invalid_catch_all/hey", f!(crate::handler)); │ ╰──── @@ -16,7 +16,7 @@ │ 13 │ bp.route(ANY, "/:too:many:params", f!(crate::handler)); │ 14 │ bp.route(GET, "/*invalid_catch_all/hey", f!(crate::handler)); │ ·  ────────────┬──────────── - │ · ╰── The problematic path + │ · ╰── The problematic path │ 15 │ bp.route(GET, "/home/:id", f!(crate::handler)); │ ╰──── @@ -28,7 +28,7 @@ │ 16 │ // Route conflict with the previous one │ 17 │ bp.route(GET, "/home/:home_id", f!(crate::handler)); │ ·  ────────┬─────── - │ · ╰── The problematic path + │ · ╰── The problematic path │ 18 │ // Unnamed parameter │ ╰──── @@ -40,6 +40,6 @@ │ 18 │ // Unnamed parameter │ 19 │ bp.route(GET, "/room/:", f!(crate::handler)); │ ·  ────┬──── - │ · ╰── The problematic path + │ · ╰── The problematic path │ 20 │ bp │ ╰──── \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/router/route_path_is_validated/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/router/route_path_is_validated/expectations/stderr.txt index 9fd2ffbb8..17cafa626 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/router/route_path_is_validated/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/router/route_path_is_validated/expectations/stderr.txt @@ -6,7 +6,7 @@ │ 12 │ // If the path is not empty, it *must* start with a `/` │ 13 │ bp.route(GET, "api", f!(crate::handler)); │ ·  ──┬── - │ · ╰── The path missing a leading '/' + │ · ╰── The path missing a leading '/' │ 14 │ bp │ ╰──── │  help: Add a '/' at the beginning of the route path to fix this error: use diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/router/structs_cannot_be_registered_as_handlers/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/router/structs_cannot_be_registered_as_handlers/expectations/stderr.txt index f7a173477..08455d0d4 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/router/structs_cannot_be_registered_as_handlers/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/router/structs_cannot_be_registered_as_handlers/expectations/stderr.txt @@ -6,6 +6,6 @@ │ 7 │ let mut bp = Blueprint::new(); │ 8 │ bp.route(GET, "/home", f!(crate::Streamer)); │ ·  ─────────┬───────── - │ · ╰── It was registered as a request handler here + │ · It was registered as a request handler here │ 9 │ bp │ ╰──── \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/cannot_have_multiple_next_inputs/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/cannot_have_multiple_next_inputs/expectations/stderr.txt index 9161ceb0a..cc7b90097 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/cannot_have_multiple_next_inputs/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/cannot_have_multiple_next_inputs/expectations/stderr.txt @@ -7,7 +7,7 @@ │ 20 │ let mut bp = Blueprint::new(); │ 21 │ bp.wrap(f!(crate::mw)); │ ·  ──────┬────── - │ · ╰── The wrapping middleware was registered here + │ · ╰── The wrapping middleware was registered here │ 22 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── │  help: Remove the extra `Next` input parameters until only one is left. \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/must_take_next_as_input/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/must_take_next_as_input/expectations/stderr.txt index cdccce4da..a4587b757 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/must_take_next_as_input/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/must_take_next_as_input/expectations/stderr.txt @@ -7,6 +7,6 @@ │ 14 │ let mut bp = Blueprint::new(); │ 15 │ bp.wrap(f!(crate::mw)); │ ·  ──────┬────── - │ · ╰── The wrapping middleware was registered here + │ · ╰── The wrapping middleware was registered here │ 16 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/next_must_take_a_naked_generic_parameter/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/next_must_take_a_naked_generic_parameter/expectations/stderr.txt index cc5653c1b..9aea103e6 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/next_must_take_a_naked_generic_parameter/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/next_must_take_a_naked_generic_parameter/expectations/stderr.txt @@ -8,7 +8,7 @@ │ 31 │ let mut bp = Blueprint::new(); │ 32 │ bp.wrap(f!(crate::mw)); │ ·  ──────┬────── - │ · ╰── The wrapping middleware was registered here + │ · ╰── The wrapping middleware was registered here │ 33 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── │  help: Take `Next` rather than `Next>` as input parameter diff --git a/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/wrapping_middlewares_input_parameters_cannot_be_generic/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/wrapping_middlewares_input_parameters_cannot_be_generic/expectations/stderr.txt index ddc9fa1e4..9ba6dfc8b 100644 --- a/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/wrapping_middlewares_input_parameters_cannot_be_generic/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/blueprint/wrapping_middlewares/wrapping_middlewares_input_parameters_cannot_be_generic/expectations/stderr.txt @@ -9,13 +9,13 @@ │ 45 │ let mut bp = Blueprint::new(); │ 46 │ bp.wrap(f!(crate::generic_wrapping_middleware)); │ ·  ───────────────────┬────────────────── - │ · ╰── The wrapping middleware was registered here + │ · The wrapping middleware was registered here │ 47 │ bp.wrap(f!(crate::doubly_generic_wrapping_middleware)); │ ╰──── │ ╭─[src/lib.rs:1:1] │ 1 │ pub fn generic_wrapping_middleware(_next: Next, generic_input: GenericType) -> u8 │ ·  ┬ - │ · ╰── The generic parameter without a concrete type + │ · ╰── The generic parameter without a concrete type │ 2 │ where │ ╰──── │  help: Specify the concrete type for `T` when registering the wrapping @@ -35,14 +35,15 @@ │ 46 │ bp.wrap(f!(crate::generic_wrapping_middleware)); │ 47 │ bp.wrap(f!(crate::doubly_generic_wrapping_middleware)); │ ·  ──────────────────────┬────────────────────── - │ · ╰── The wrapping middleware was registered here + │ · The wrapping middleware was registered here │ 48 │ bp.wrap(f!(crate::triply_generic_wrapping_middleware)); │ ╰──── │ ╭─[src/lib.rs:1:1] │ 1 │ pub fn doubly_generic_wrapping_middleware( │ ·  ┬ ┬ - │ · │ ╰── The generic parameter without a concrete type - │ · ╰── The generic parameter without a concrete type + │ · │The generic parameter without + │ · │ a concrete type + │ · The generic parameter without a concrete type │ 2 │ _next: Next, │ ╰──── │  help: Specify the concrete types for `T` and `S` when registering the @@ -62,15 +63,17 @@ │ 47 │ bp.wrap(f!(crate::doubly_generic_wrapping_middleware)); │ 48 │ bp.wrap(f!(crate::triply_generic_wrapping_middleware)); │ ·  ──────────────────────┬────────────────────── - │ · ╰── The wrapping middleware was registered here + │ · The wrapping middleware was registered here │ 49 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── │ ╭─[src/lib.rs:1:1] │ 1 │ pub fn triply_generic_wrapping_middleware( │ ·  ┬ ┬ ┬ - │ · │ │ ╰── The generic parameter without a concrete type - │ · │ ╰── The generic parameter without a concrete type - │ · ╰── The generic parameter without a concrete type + │ · │ │ The generic parameter + │ · │ │ without a concrete type + │ · │The generic parameter without + │ · │ a concrete type + │ · The generic parameter without a concrete type │ 2 │ _next: Next, │ ╰──── │  help: Specify the concrete types for `T`, `S` and `U` when registering the diff --git a/libs/pavex_cli/tests/ui_tests/borrow_checker/control_flow/multiple_consumers_pass_takes_control_flow_into_account_for_errors/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/borrow_checker/control_flow/multiple_consumers_pass_takes_control_flow_into_account_for_errors/expectations/stderr.txt index 565f8aa58..07ff9ab30 100644 --- a/libs/pavex_cli/tests/ui_tests/borrow_checker/control_flow/multiple_consumers_pass_takes_control_flow_into_account_for_errors/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/borrow_checker/control_flow/multiple_consumers_pass_takes_control_flow_into_account_for_errors/expectations/stderr.txt @@ -13,7 +13,7 @@ │ 65 │ .error_handler(f!(crate::error_handler)); │ 66 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 67 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped); │ ╰──── │ help: Considering changing the signature of the components that consume @@ -24,7 +24,7 @@ │ 67 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped); │ 68 │ bp.route(GET, "/home", f!(crate::handler)); │ ·  ─────────┬──────── - │ · ╰── One of the consuming request handlers + │ · One of the consuming request handlers │ 69 │ bp │ ╰──── │ ☞ @@ -32,7 +32,7 @@ │ 66 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ 67 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── One of the consuming constructors + │ · ╰── One of the consuming constructors │ 68 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── │ help: If `app::B` itself cannot implement `Clone`, consider wrapping it in diff --git a/libs/pavex_cli/tests/ui_tests/borrow_checker/diamond/diamond_cannot_be_solved_if_we_cannot_clone/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/borrow_checker/diamond/diamond_cannot_be_solved_if_we_cannot_clone/expectations/stderr.txt index 8c8c612fe..b62dc3788 100644 --- a/libs/pavex_cli/tests/ui_tests/borrow_checker/diamond/diamond_cannot_be_solved_if_we_cannot_clone/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/borrow_checker/diamond/diamond_cannot_be_solved_if_we_cannot_clone/expectations/stderr.txt @@ -13,7 +13,7 @@ │ 51 │ let mut bp = Blueprint::new(); │ 52 │ bp.constructor(f!(crate::a), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 53 │ // Being a singleton, this will be an input type of the dependency closure for the request handler │ ╰──── │ help: Considering changing the signature of `app::a`. @@ -37,7 +37,7 @@ │ 53 │ // Being a singleton, this will be an input type of the dependency closure for the request handler │ 54 │ bp.constructor(f!(crate::b), Lifecycle::Singleton); │ ·  ──────┬───── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 55 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped); │ ╰──── │ help: Considering changing the signature of `app::b`. diff --git a/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_framework_type_cannot_be_moved_twice/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_framework_type_cannot_be_moved_twice/expectations/stderr.txt index 62f8dee78..49bc71450 100644 --- a/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_framework_type_cannot_be_moved_twice/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_framework_type_cannot_be_moved_twice/expectations/stderr.txt @@ -13,7 +13,7 @@ │ 40 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ 41 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── One of the consuming constructors + │ · ╰── One of the consuming constructors │ 42 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── │ ☞ @@ -21,6 +21,6 @@ │ 39 │ let mut bp = Blueprint::new(); │ 40 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── One of the consuming constructors + │ · ╰── One of the consuming constructors │ 41 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped); │ ╰──── \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_input_type_cannot_be_moved_twice/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_input_type_cannot_be_moved_twice/expectations/stderr.txt index 91173ed99..dd7105cb4 100644 --- a/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_input_type_cannot_be_moved_twice/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_input_type_cannot_be_moved_twice/expectations/stderr.txt @@ -13,7 +13,7 @@ │ 43 │ // `A` is a singleton, therefore it will be an input of the dependency closure for the handler │ 44 │ bp.constructor(f!(crate::a), Lifecycle::Singleton); │ ·  ──────┬───── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 45 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ╰──── │ help: Considering changing the signature of the components that consume @@ -24,7 +24,7 @@ │ 45 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ 46 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── One of the consuming constructors + │ · ╰── One of the consuming constructors │ 47 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── │ ☞ @@ -32,6 +32,6 @@ │ 44 │ bp.constructor(f!(crate::a), Lifecycle::Singleton); │ 45 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── One of the consuming constructors + │ · ╰── One of the consuming constructors │ 46 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped); │ ╰──── \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_type_cannot_be_moved_twice/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_type_cannot_be_moved_twice/expectations/stderr.txt index d3cc5144c..6aa8f135a 100644 --- a/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_type_cannot_be_moved_twice/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/borrow_checker/multiple_consumers/a_non_clonable_type_cannot_be_moved_twice/expectations/stderr.txt @@ -13,7 +13,7 @@ │ 41 │ let mut bp = Blueprint::new(); │ 42 │ bp.constructor(f!(crate::a), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 43 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ╰──── │ help: Considering changing the signature of the components that consume @@ -24,7 +24,7 @@ │ 43 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ 44 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── One of the consuming constructors + │ · ╰── One of the consuming constructors │ 45 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── │ ☞ @@ -32,7 +32,7 @@ │ 42 │ bp.constructor(f!(crate::a), Lifecycle::RequestScoped); │ 43 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── One of the consuming constructors + │ · ╰── One of the consuming constructors │ 44 │ bp.constructor(f!(crate::c), Lifecycle::RequestScoped); │ ╰──── │ help: If `app::A` itself cannot implement `Clone`, consider wrapping it in diff --git a/libs/pavex_cli/tests/ui_tests/borrow_checker/transitive_borrows/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/borrow_checker/transitive_borrows/expectations/stderr.txt index 092bc4060..fa1a498f1 100644 --- a/libs/pavex_cli/tests/ui_tests/borrow_checker/transitive_borrows/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/borrow_checker/transitive_borrows/expectations/stderr.txt @@ -15,7 +15,7 @@ │ 47 │ let mut bp = Blueprint::new(); │ 48 │ bp.constructor(f!(crate::a), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 49 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ╰──── │ help: Consider changing the signature of `app::b`. diff --git a/libs/pavex_cli/tests/ui_tests/borrow_checker/triangle/triangle_cannot_be_solved_if_input_type_is_not_clonable/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/borrow_checker/triangle/triangle_cannot_be_solved_if_input_type_is_not_clonable/expectations/stderr.txt index 4393665a3..f2bfceae3 100644 --- a/libs/pavex_cli/tests/ui_tests/borrow_checker/triangle/triangle_cannot_be_solved_if_input_type_is_not_clonable/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/borrow_checker/triangle/triangle_cannot_be_solved_if_input_type_is_not_clonable/expectations/stderr.txt @@ -14,7 +14,7 @@ │ 37 │ // A is a singleton, so it will be an input parameter of the dependency closure for `handler` │ 38 │ bp.constructor(f!(crate::a), Lifecycle::Singleton); │ ·  ──────┬───── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 39 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ╰──── │ help: Consider changing the signature of `app::b`. diff --git a/libs/pavex_cli/tests/ui_tests/borrow_checker/triangle/triangle_cannot_be_solved_if_type_is_not_clonable/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/borrow_checker/triangle/triangle_cannot_be_solved_if_type_is_not_clonable/expectations/stderr.txt index e0b6c0751..ee1384222 100644 --- a/libs/pavex_cli/tests/ui_tests/borrow_checker/triangle/triangle_cannot_be_solved_if_type_is_not_clonable/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/borrow_checker/triangle/triangle_cannot_be_solved_if_type_is_not_clonable/expectations/stderr.txt @@ -14,7 +14,7 @@ │ 36 │ let mut bp = Blueprint::new(); │ 37 │ bp.constructor(f!(crate::a), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── The constructor was registered here + │ · ╰── The constructor was registered here │ 38 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ╰──── │ help: Consider changing the signature of `app::b`. diff --git a/libs/pavex_cli/tests/ui_tests/dependency_injection/lifecycles/singletons_cannot_depend_on_shorter_lifecycles/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/dependency_injection/lifecycles/singletons_cannot_depend_on_shorter_lifecycles/expectations/stderr.txt index bae461e63..9c3f14d0d 100644 --- a/libs/pavex_cli/tests/ui_tests/dependency_injection/lifecycles/singletons_cannot_depend_on_shorter_lifecycles/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/dependency_injection/lifecycles/singletons_cannot_depend_on_shorter_lifecycles/expectations/stderr.txt @@ -9,14 +9,14 @@ │ 29 │ let mut bp = Blueprint::new(); │ 30 │ bp.constructor(f!(crate::a), Lifecycle::Singleton); │ ·  ──────┬───── - │ · ╰── The singleton was registered here + │ · ╰── The singleton was registered here │ 31 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ╰──── │ ╭─[src/lib.rs:30:1] │ 30 │ bp.constructor(f!(crate::a), Lifecycle::Singleton); │ 31 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ·  ──────┬───── - │ · ╰── The request-scoped dependency was registered here + │ · The request-scoped dependency was registered here │ 32 │ bp.constructor(f!(crate::c), Lifecycle::Transient); │ ╰──── @@ -31,13 +31,13 @@ │ 29 │ let mut bp = Blueprint::new(); │ 30 │ bp.constructor(f!(crate::a), Lifecycle::Singleton); │ ·  ──────┬───── - │ · ╰── The singleton was registered here + │ · ╰── The singleton was registered here │ 31 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ ╰──── │ ╭─[src/lib.rs:31:1] │ 31 │ bp.constructor(f!(crate::b), Lifecycle::RequestScoped); │ 32 │ bp.constructor(f!(crate::c), Lifecycle::Transient); │ ·  ──────┬───── - │ · ╰── The transient dependency was registered here + │ · ╰── The transient dependency was registered here │ 33 │ bp.route(GET, "/", f!(crate::handler)); │ ╰──── \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/dependency_injection/missing_handler_dependency/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/dependency_injection/missing_handler_dependency/expectations/stderr.txt index 90531dac0..c74d47e39 100644 --- a/libs/pavex_cli/tests/ui_tests/dependency_injection/missing_handler_dependency/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/dependency_injection/missing_handler_dependency/expectations/stderr.txt @@ -7,14 +7,14 @@ │ 11 │ let mut bp = Blueprint::new(); │ 12 │ bp.route(GET, "/home", f!(crate::stream_file)); │ ·  ───────────┬────────── - │ · ╰── The request handler was registered here + │ · The request handler was registered here │ 13 │ bp │ ╰──── │ ╭─[src/lib.rs:5:1] │ 5 │ │ 6 │ pub fn stream_file(_inner: PathBuf) -> pavex::response::Response { │ ·  ───┬─── - │ · ╰── I don't know how to construct an instance of this input parameter + │ · I don't know how to construct an instance of this input parameter │ 7 │ todo!() │ ╰──── │  help: Register a constructor for `std::path::PathBuf` \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/dependency_injection/pavex_honors_the_restrictions_on_generics_introduced_by_constructors/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/dependency_injection/pavex_honors_the_restrictions_on_generics_introduced_by_constructors/expectations/stderr.txt index 71d202d2b..720d8bc87 100644 --- a/libs/pavex_cli/tests/ui_tests/dependency_injection/pavex_honors_the_restrictions_on_generics_introduced_by_constructors/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/dependency_injection/pavex_honors_the_restrictions_on_generics_introduced_by_constructors/expectations/stderr.txt @@ -7,14 +7,14 @@ │ 19 │ bp.constructor(f!(crate::tied), Lifecycle::RequestScoped); │ 20 │ bp.route(GET, "/home", f!(crate::handler)); │ ·  ─────────┬──────── - │ · ╰── The request handler was registered here + │ · The request handler was registered here │ 21 │ bp │ ╰──── │ ╭─[src/lib.rs:11:1] │ 11 │ // This can't be built because `tied` can only give you Tied or Tied! │ 12 │ tied: Tied, │ ·  ───────┬────── - │ · ╰── I don't know how to construct an instance of this input parameter + │ · I don't know how to construct an instance of this input parameter │ 13 │ ) -> pavex::response::Response { │ ╰──── │  help: Register a constructor for `app::Tied` \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/reflection/crate_resolution/remote_callable_paths_must_be_absolute/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/reflection/crate_resolution/remote_callable_paths_must_be_absolute/expectations/stderr.txt index e37222ea9..ef84359b5 100644 --- a/libs/pavex_cli/tests/ui_tests/reflection/crate_resolution/remote_callable_paths_must_be_absolute/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/reflection/crate_resolution/remote_callable_paths_must_be_absolute/expectations/stderr.txt @@ -5,7 +5,7 @@ │ 10 │ let mut bp = Blueprint::new(); │ 11 │ bp.constructor(f!(new_logger), Lifecycle::Singleton); │ ·  ───────┬────── - │ · ╰── The relative import path was registered here + │ · ╰── The relative import path was registered here │ 12 │ bp.route(GET, "/home", f!(crate::handler)); │ ╰──── │  help: If it is a local import, the path must start with `crate::`. diff --git a/libs/pavex_cli/tests/ui_tests/reflection/invalid_callable_path/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/reflection/invalid_callable_path/expectations/stderr.txt index c405a937a..b4a78949a 100644 --- a/libs/pavex_cli/tests/ui_tests/reflection/invalid_callable_path/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/reflection/invalid_callable_path/expectations/stderr.txt @@ -5,6 +5,6 @@ │ 10 │ }; │ 11 │ bp.route(POST, "/home", callable); │ ·  ────┬─── - │ · ╰── The invalid import path was registered here + │ · The invalid import path was registered here │ 12 │ bp │ ╰──── \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/reflection/local_callable_paths_must_be_prefixed_with_crate/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/reflection/local_callable_paths_must_be_prefixed_with_crate/expectations/stderr.txt index b0953da2e..7cafec234 100644 --- a/libs/pavex_cli/tests/ui_tests/reflection/local_callable_paths_must_be_prefixed_with_crate/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/reflection/local_callable_paths_must_be_prefixed_with_crate/expectations/stderr.txt @@ -5,7 +5,7 @@ │  9 │ let mut bp = Blueprint::new(); │ 10 │ bp.route(GET, "/home", f!(handler)); │ ·  ─────┬───── - │ · ╰── The relative import path was registered here + │ · The relative import path was registered here │ 11 │ bp │ ╰──── │  help: If it is a local import, the path must start with `crate::`. diff --git a/libs/pavex_cli/tests/ui_tests/reflection/output_parameter_cannot_be_handled/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/reflection/output_parameter_cannot_be_handled/expectations/stderr.txt index 4b6a0ea88..b782b2858 100644 --- a/libs/pavex_cli/tests/ui_tests/reflection/output_parameter_cannot_be_handled/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/reflection/output_parameter_cannot_be_handled/expectations/stderr.txt @@ -5,13 +5,13 @@ │  9 │ let mut bp = Blueprint::new(); │ 10 │ bp.route(GET, "/home", f!(crate::c)); │ ·  ──────┬───── - │ · ╰── The request handler was registered here + │ · The request handler was registered here │ 11 │ bp │ ╰──── │ ╭─[src/lib.rs:3:1] │ 3 │ │ 4 │ pub fn c() -> Box { │ ·  ─────────────┬──────────── - │ · ╰── The output type that I can't handle + │ · ╰── The output type that I can't handle │ 5 │ todo!() │ ╰──── \ No newline at end of file diff --git a/libs/pavex_cli/tests/ui_tests/reflection/the_path_for_generic_arguments_must_be_absolute/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/reflection/the_path_for_generic_arguments_must_be_absolute/expectations/stderr.txt index 0cba888a9..753fdb300 100644 --- a/libs/pavex_cli/tests/ui_tests/reflection/the_path_for_generic_arguments_must_be_absolute/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/reflection/the_path_for_generic_arguments_must_be_absolute/expectations/stderr.txt @@ -5,7 +5,7 @@ │ 15 │ let mut bp = Blueprint::new(); │ 16 │ bp.constructor(f!(crate::new_logger::), Lifecycle::Singleton); │ ·  ───────────────┬─────────────── - │ · ╰── The relative import path was registered here + │ · The relative import path was registered here │ 17 │ bp.route(GET, "/home", f!(crate::handler::)); │ ╰──── │  help: If it is a local import, the path must start with `crate::`. diff --git a/libs/pavex_cli/tests/ui_tests/route_parameters/route_parameters_non_existing_fields/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/route_parameters/route_parameters_non_existing_fields/expectations/stderr.txt index 3ce29dd00..bf0b4064d 100644 --- a/libs/pavex_cli/tests/ui_tests/route_parameters/route_parameters_non_existing_fields/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/route_parameters/route_parameters_non_existing_fields/expectations/stderr.txt @@ -12,7 +12,7 @@ │ 44 │ )); │ 45 │ bp.route(GET, "/a/:x", f!(crate::missing_one)); │ ·  ───────────┬────────── - │ · ╰── The request handler asking for `RouteParams` + │ · The request handler asking for `RouteParams` │ 46 │ bp.route(GET, "/b/:x", f!(crate::missing_two)); │ ╰──── │  help: Remove or rename the fields that do not map to a valid route @@ -32,7 +32,7 @@ │ 45 │ bp.route(GET, "/a/:x", f!(crate::missing_one)); │ 46 │ bp.route(GET, "/b/:x", f!(crate::missing_two)); │ ·  ───────────┬────────── - │ · ╰── The request handler asking for `RouteParams` + │ · The request handler asking for `RouteParams` │ 47 │ bp.route(GET, "/c", f!(crate::no_route_params)); │ ╰──── │  help: Remove or rename the fields that do not map to a valid route @@ -48,7 +48,7 @@ │ 46 │ bp.route(GET, "/b/:x", f!(crate::missing_two)); │ 47 │ bp.route(GET, "/c", f!(crate::no_route_params)); │ ·  ─────────────┬──────────── - │ · ╰── The request handler asking for `RouteParams` + │ · The request handler asking for `RouteParams` │ 48 │ bp │ ╰──── │  help: Stop trying to extract route parameters, or add them to the route diff --git a/libs/pavex_cli/tests/ui_tests/route_parameters/route_parameters_unsupported_types/expectations/stderr.txt b/libs/pavex_cli/tests/ui_tests/route_parameters/route_parameters_unsupported_types/expectations/stderr.txt index bab1d4d60..fdd366eb1 100644 --- a/libs/pavex_cli/tests/ui_tests/route_parameters/route_parameters_unsupported_types/expectations/stderr.txt +++ b/libs/pavex_cli/tests/ui_tests/route_parameters/route_parameters_unsupported_types/expectations/stderr.txt @@ -10,7 +10,7 @@ │ 61 │ )); │ 62 │ bp.route(GET, "/a/:x", f!(crate::primitive)); │ ·  ──────────┬───────── - │ · ╰── The request handler asking for `RouteParams` + │ · The request handler asking for `RouteParams` │ 63 │ bp.route(GET, "/b/:x/:y", f!(crate::tuple)); │ ╰──── │  help: Use a plain struct with named fields to extract route parameters. @@ -29,7 +29,7 @@ │ 62 │ bp.route(GET, "/a/:x", f!(crate::primitive)); │ 63 │ bp.route(GET, "/b/:x/:y", f!(crate::tuple)); │ ·  ────────┬─────── - │ · ╰── The request handler asking for `RouteParams<(u32, u32)>` + │ · The request handler asking for `RouteParams<(u32, u32)>` │ 64 │ bp.route(GET, "/c/:x/:z", f!(crate::slice_ref)); │ ╰──── │  help: Use a plain struct with named fields to extract route parameters. @@ -48,7 +48,7 @@ │ 63 │ bp.route(GET, "/b/:x/:y", f!(crate::tuple)); │ 64 │ bp.route(GET, "/c/:x/:z", f!(crate::slice_ref)); │ ·  ──────────┬───────── - │ · ╰── The request handler asking for `RouteParams<&[u32]>` + │ · The request handler asking for `RouteParams<&[u32]>` │ 65 │ bp.route(GET, "/d/:x/:y", f!(crate::reference::)); │ ╰──── │  help: Use a plain struct with named fields to extract route parameters. @@ -67,7 +67,7 @@ │ 64 │ bp.route(GET, "/c/:x/:z", f!(crate::slice_ref)); │ 65 │ bp.route(GET, "/d/:x/:y", f!(crate::reference::)); │ ·  ───────────────────┬─────────────────── - │ · ╰── The request handler asking for `RouteParams<&app::MyStruct>` + │ · The request handler asking for `RouteParams<&app::MyStruct>` │ 66 │ bp.route(GET, "/e/:x/:y", f!(crate::enum_)); │ ╰──── │  help: Use a plain struct with named fields to extract route parameters. @@ -86,7 +86,7 @@ │ 65 │ bp.route(GET, "/d/:x/:y", f!(crate::reference::)); │ 66 │ bp.route(GET, "/e/:x/:y", f!(crate::enum_)); │ ·  ────────┬─────── - │ · ╰── The request handler asking for `RouteParams` + │ · The request handler asking for `RouteParams` │ 67 │ bp.route(GET, "/f/:x/:y", f!(crate::tuple_struct)); │ ╰──── │  help: Use a plain struct with named fields to extract route parameters. @@ -105,7 +105,7 @@ │ 66 │ bp.route(GET, "/e/:x/:y", f!(crate::enum_)); │ 67 │ bp.route(GET, "/f/:x/:y", f!(crate::tuple_struct)); │ ·  ───────────┬─────────── - │ · ╰── The request handler asking for `RouteParams` + │ · The request handler asking for `RouteParams` │ 68 │ bp.route(GET, "/g/:x/:y", f!(crate::unit_struct)); │ ╰──── │  help: Use a plain struct with named fields to extract route parameters. @@ -124,7 +124,7 @@ │ 67 │ bp.route(GET, "/f/:x/:y", f!(crate::tuple_struct)); │ 68 │ bp.route(GET, "/g/:x/:y", f!(crate::unit_struct)); │ ·  ───────────┬────────── - │ · ╰── The request handler asking for `RouteParams` + │ · The request handler asking for `RouteParams` │ 69 │ bp │ ╰──── │  help: Use a plain struct with named fields to extract route parameters. diff --git a/libs/pavex_miette/src/graphical_report_handler.rs b/libs/pavex_miette/src/graphical_report_handler.rs index a3aefaa11..f5e5e2f24 100644 --- a/libs/pavex_miette/src/graphical_report_handler.rs +++ b/libs/pavex_miette/src/graphical_report_handler.rs @@ -1,3 +1,4 @@ +use std::cmp::max; use std::fmt::{self, Write}; use miette::{ @@ -201,7 +202,7 @@ impl GraphicalReportHandler { write!(header, "{}", link)?; writeln!(f, "{}", header)?; } else if let Some(code) = diagnostic.code() { - write!(header, "{}", code.style(severity_style),)?; + write!(header, "{}", code.style(severity_style), )?; if self.links == LinkStyle::Text && diagnostic.url().is_some() { let url = diagnostic.url().unwrap(); // safe write!(header, " ({})", url.style(self.theme.styles.link))?; @@ -260,8 +261,8 @@ impl GraphicalReportHandler { " {}{}{} ", char, self.theme.characters.hbar, self.theme.characters.rarrow ) - .style(severity_style) - .to_string(); + .style(severity_style) + .to_string(); let rest_indent = format!( " {} ", if is_last { @@ -270,8 +271,8 @@ impl GraphicalReportHandler { self.theme.characters.vbar } ) - .style(severity_style) - .to_string(); + .style(severity_style) + .to_string(); let opts = textwrap::Options::new(width) .initial_indent(&initial_indent) .subsequent_indent(&rest_indent); @@ -631,7 +632,7 @@ impl GraphicalReportHandler { } /// Returns an iterator over the visual width of each character in a line. - fn line_visual_char_width<'a>(&self, text: &'a str) -> impl Iterator + 'a { + fn line_visual_char_width<'a>(&self, text: &'a str) -> impl Iterator + 'a { let mut column = 0; let tab_width = self.tab_width; text.chars().map(move |c| { @@ -724,8 +725,8 @@ impl GraphicalReportHandler { chars.underline.to_string().repeat(num_right), width = start.saturating_sub(highest), ) - .style(hl.style) - .to_string(), + .style(hl.style) + .to_string(), ); } highest = std::cmp::max(highest, end); @@ -735,28 +736,124 @@ impl GraphicalReportHandler { .collect(); writeln!(f, "{}", underlines)?; + enum LabelPosition { + Left, + Center, + Right, + } + + let post_linum_width = self.termwidth.saturating_sub(linum_width + 4 /* length of " │" */); + for hl in single_liners.iter().rev() { - if let Some(label) = hl.label() { + if let Some(label) = &hl.label { self.write_no_linum(f, linum_width)?; self.render_highlight_gutter(f, max_gutter, line, all_highlights)?; let mut curr_offset = 1usize; - for (offset_hl, vbar_offset) in &vbar_offsets { - while curr_offset < *vbar_offset + 1 { - write!(f, " ")?; - curr_offset += 1; - } - if *offset_hl != hl { - write!(f, "{}", chars.vbar.to_string().style(offset_hl.style))?; - curr_offset += 1; + + let (label_index, (_, label_vbar_offset)) = vbar_offsets + .iter() + .enumerate() + .find(|(_, (offset_hl, _))| offset_hl == &hl) + .unwrap(); + + let max_allowed_width = max(post_linum_width, line.text.len()); + let available_right_space = max_allowed_width + .saturating_sub(label_vbar_offset + 4 /* length of "╰── " */); + let available_left_space = { + label_vbar_offset + .saturating_sub(4 /* length of " ──╯" */) + .saturating_sub(if label_index != 0 { + let previous_vbar_offset = vbar_offsets[label_index - 1].1; + previous_vbar_offset + 1 + } else { + 0 + }) + }; + let available_centered_space = + max_allowed_width.saturating_sub(if label_index != 0 { + let previous_vbar_offset = vbar_offsets[label_index - 1].1; + previous_vbar_offset } else { - let lines = format!( - "{}{} {}", - chars.lbot, - chars.hbar.to_string().repeat(2), - label, - ); - writeln!(f, "{}", lines.style(hl.style))?; - break; + 0 + }); + let (available_space, position) = if label.len() <= available_right_space { + (available_right_space, LabelPosition::Right) + } else if label.len() <= available_left_space { + (available_left_space, LabelPosition::Left) + } else { + (available_centered_space, LabelPosition::Center) + }; + let sigil = match position { + LabelPosition::Right => { + format!("{}{} ", chars.lbot, chars.hbar.to_string().repeat(2), ) + } + LabelPosition::Left => { + format!("{}{} ", chars.hbar.to_string().repeat(2), chars.rbot) + } + LabelPosition::Center => "".to_string(), + }; + let label_lines = textwrap::wrap(&label, available_space); + let n_label_lines = label_lines.len(); + 'outer: for (i, label_line) in label_lines.iter().enumerate() { + 'inner: for (offset_hl, vbar_offset) in &vbar_offsets { + if *offset_hl != hl { + while curr_offset < *vbar_offset + 1 { + write!(f, " ")?; + curr_offset += 1; + } + write!(f, "{}", chars.vbar.to_string().style(offset_hl.style))?; + curr_offset += 1; + continue 'inner; + } + + let n_leading_whitespaces = match position { + LabelPosition::Left => available_space - label_line.len() + 1, + LabelPosition::Center => (available_space - label_line.len()) / 2, + LabelPosition::Right => vbar_offset - curr_offset + 1, + }; + for _ in 0..n_leading_whitespaces { + write!(f, " ")?; + curr_offset += 1; + } + + let label_line = if i == 0 { + match position { + LabelPosition::Left => { + format!( + "{} {}{}", + label_line, + chars.hbar.to_string().repeat(2), + chars.rbot + ) + } + LabelPosition::Center => label_line.clone().into_owned(), + LabelPosition::Right => format!( + "{}{} {}", + chars.lbot, + chars.hbar.to_string().repeat(2), + label_line + ), + } + } else { + match position { + LabelPosition::Left => { + format!("{}{}", label_line, " ".repeat(sigil.len())) + } + LabelPosition::Right => { + format!("{}{}", " ".repeat(sigil.len()), label_line) + } + LabelPosition::Center => label_line.clone().into_owned(), + } + }; + writeln!(f, "{}", label_line.style(hl.style))?; + + // Init new line + if i + 1 != n_label_lines { + self.write_no_linum(f, linum_width)?; + self.render_highlight_gutter(f, max_gutter, line, all_highlights)?; + } + curr_offset = 1; + continue 'outer; } } }