Skip to content

Conversation

@m4tx
Copy link
Member

@m4tx m4tx commented Nov 5, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 5, 2025 19:23
@github-actions github-actions bot added C-lib Crate: cot (main library crate) C-macros Crate: cot-macros A-ci Area: CI (Continuous Integration) labels Nov 5, 2025
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

🐰 Bencher Report

Branchtrait_upcasting
Testbedgithub-ubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
empty_router/empty_router📈 view plot
🚷 view threshold
5,000.20 µs
(-17.13%)Baseline: 6,034.02 µs
6,783.39 µs
(73.71%)
json_api/json_api📈 view plot
🚷 view threshold
846.16 µs
(-17.15%)Baseline: 1,021.31 µs
1,139.01 µs
(74.29%)
nested_routers/nested_routers📈 view plot
🚷 view threshold
795.50 µs
(-16.15%)Baseline: 948.77 µs
1,059.73 µs
(75.07%)
single_root_route/single_root_route📈 view plot
🚷 view threshold
754.67 µs
(-16.66%)Baseline: 905.51 µs
1,008.75 µs
(74.81%)
single_root_route_burst/single_root_route_burst📈 view plot
🚷 view threshold
13,746.00 µs
(-20.98%)Baseline: 17,395.41 µs
21,436.10 µs
(64.13%)
🐰 View full continuous benchmarking report in Bencher

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the minimum supported Rust version (MSRV) from 1.85 to 1.86 to leverage the stabilized trait upcasting feature, eliminating the need for workaround methods that were previously required.

  • Updates MSRV to Rust 1.86 in Cargo.toml and CI configuration
  • Removes as_box_request_handler() workaround method from OpenAPI traits
  • Removes as_any() workaround method from AdminModel trait and its implementations

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Cargo.toml Updates rust-version to 1.86
.github/workflows/rust.yml Updates MSRV version in test matrix to 1.86
cot/src/openapi.rs Removes as_box_request_handler() method from BoxApiEndpointRequestHandler trait
cot/src/router.rs Uses direct trait upcasting instead of as_box_request_handler() call
cot/src/admin.rs Removes as_any() method from AdminModel trait and updates downcasting logic
cot-macros/src/admin.rs Removes as_any() implementation from AdminModel derive macro

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

cot/src/admin.rs Outdated
.as_any()
.downcast_ref::<T>()
.expect("Invalid object type");
let object_any: &dyn Any = &object;
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The downcasting logic is incorrect. object is a Box<dyn AdminModel>, and taking a reference to it (&object) creates a &Box<dyn AdminModel>, not &dyn AdminModel. The code should dereference the box first: let object_any: &dyn Any = &*object; to perform trait upcasting from &dyn AdminModel to &dyn Any before downcasting to &T.

Suggested change
let object_any: &dyn Any = &object;
let object_any: &dyn Any = &*object;

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings November 5, 2025 20:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
rust 90.19% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cot-macros/src/admin.rs 89.58% <ø> (ø)
cot/src/admin.rs 72.06% <ø> (ø)
cot/src/openapi.rs 94.14% <ø> (-0.03%) ⬇️
cot/src/router.rs 93.27% <100.00%> (-0.02%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@m4tx m4tx merged commit 6dc14ac into master Nov 5, 2025
35 of 36 checks passed
@m4tx m4tx deleted the trait_upcasting branch November 5, 2025 21:30
@cotbot cotbot bot mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ci Area: CI (Continuous Integration) C-lib Crate: cot (main library crate) C-macros Crate: cot-macros

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants