oxidecomputer / oxidecomputer/progenitor

Problems with code bases already using `std::error:Error`

Open
#1,020 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1k
Forks
136
Avg merge
8h 36m
Merged PRs (30d)
14

Description

Progenitor has an enum called Error, so if you try import std::error::Error you'll get errors about it being defined multiple times, along with an onslaught of other type errors due to the compiler trying to match the uses of Error to your enum

Maybe the enum should be renamed something else less generic to prevent clashes with code already in use, or at least a warning in the README about it?
I understand completely if you consider this a non-problem though too, just wanted to make the suggestion

error[E0252]: the name `Error` is defined multiple times
 --> /home/kamwithk/repos/funkyduck/target/debug/build/funkyduck-693277bb923d1a99/out/codegen.rs:2:41
  |
2 | pub use progenitor_client::{ByteStream, Error, ResponseValue};
  |                                         ^^^^^ `Error` reimported here
  |
 ::: src/main.rs:4:5
  |
4 | use std::error::Error;
  |     ----------------- previous import of the trait `Error` here
  |
  = note: `Error` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
 --> src/main.rs:4:22
  |
4 | use std::error::Error as OtherError;
  |                       +++++++++++++

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the generated code shown in the issue and inspect where the progenitor_client Error export is produced. Determine whether the naming collision should be addressed in generated output or documented as a workaround; done means the proposed behavior is agreed and the std::error::Error example no longer produces the reported conflict.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.