"Unreachable call" warning from derive Routable and `String` dynamic segments
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- backend-api-design
Research direction
The reproducer is in the issue body: a Routable enum with a String dynamic segment. Start by running cargo check on that example, then inspect the Routable derive implementation and its route parsing tests. Done means the example compiles without the unreachable-call warning and relevant tests pass.
Written by the indexing model from the issue text.
Description
Problem
Starting from Rust 1.100.0, I get a warning (unreachable call) when using #[derive(Routable)] if the route takes a String dynamic segment.
Steps To Reproduce
Steps to reproduce the behavior:
- create a new web project with routes
- add a route with a
Stringdynamic segment cargo check
This main.rs is enough to expose the problem:
use dioxus::prelude::*;
#[derive(Debug, Clone, Routable, PartialEq)]
#[rustfmt::skip]
enum Route {
#[route("/:s")]
Echo { s: String },
}
fn main() {
dioxus::launch(App);
}
#[component]
fn App() -> Element {
rsx! {
Router::<Route> {}
}
}
#[component]
pub fn Echo(s: String) -> Element {
rsx! { "You said: {s}" }
}
Expected behavior
I expect it to compile without warnings.
** Screenshot **
❯ cargo check
warning: unreachable call
--> src/main.rs:3:24
|
3 | #[derive(Debug, Clone, Routable, PartialEq)]
| ^^^^^^^^
| |
| unreachable call
| any code following this expression is unreachable
|
= note: `#[warn(unreachable_code)]` (part of `#[warn(unused)]`) on by default
= note: this warning originates in the derive macro `Routable` (in Nightly builds, run with -Z macro-backtrace for more info)
Environment:
- Dioxus version: dioxus 0.7.10 (57d6794)
- Rust version: 1.100.0
- OS info: Linux (Ubuntu 26.04)
- App platform: web
Questionnaire
I don't have time to fix this right now, but maybe later.
- Dominant language
- Rust
- Stars
- 39.8k
- Forks
- 2k
- Avg merge
- 14h 29m
- Merged PRs (30d)
- 20
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DioxusLabs/dioxus
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
DioxusLabs/dioxus#6089 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
DioxusLabs/dioxus#6063 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DioxusLabs/dioxus#6058 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DioxusLabs/dioxus#6008 ·
Maintainers usually reply within 1 day
-
dioxus-desktop on macOS: Finder file drops never fire `ondrop` — `dragenter` is not cancelledPossibly taken @staging-devin-ai-integration claimed this 23 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
DioxusLabs/dioxus#6006 ·
Maintainers usually reply within 1 day
All issues in DioxusLabs/dioxus
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
longbridge/gpui-kit#4031 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
neuralmagic/crucible#465 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
compiler P3
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
HerringtonDarkholme/hd-lang#2162 ·
Maintainers usually reply within 1 day
-
embedded SQL: pin correlated-guard behaviour when a closed variable is reassigned inside a branchOpenpriority: low
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
jonathanong/no-mistakes#3627 ·
Maintainers usually reply within 1 day