Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Tutorial: invalid crate-type syntax and inconsistent command-component example

Ouverte
#376 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
68/100
Type d'issue
Documentation
Clarté
Plutôt claire
Activité
Active
Stack technique
rust
Domaine
documentation

Piste de recherche

Start with the Create a command component section in tutorial.html, then compare it with examples/tutorial/command/src/main.rs, examples/tutorial/command/Cargo.toml, and examples/tutorial/wit/calculator/world.wit. Choose one entrypoint approach and make the tutorial and completed example consistent, including valid crate-type syntax where applicable. Verify the documented project with cargo metadata --no-deps --format-version 1 --offline and the tutorial's build steps.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

The Create a command component section has two problems: an invalid Cargo configuration and a mismatch between the library-based instructions and the linked binary example.

1. Invalid crate-type syntax

The tutorial asks readers to create a library with cargo new --lib example and add:

[lib]
crate-type = "cdylib"

Running cargo metadata --no-deps --format-version 1 --offline in that project fails with:

error: invalid type: string "cdylib", expected a sequence

Reproduced with Cargo 1.98.1. The configuration should be:

[lib]
crate-type = ["cdylib"]

2. The completed example uses a different entrypoint approach

The tutorial creates a library crate and asks readers to add export wasi:cli/[email protected] to the app world. However, its linked completed example is a binary:

  • src/main.rs uses an ordinary fn main().
  • Cargo.toml has no [lib] configuration.
  • The app world imports calculate but does not explicitly export wasi:cli/run.

Both approaches are valid, but copying that main() into the tutorial's library project does not implement the requested wasi:cli/run export. Fixing the manifest syntax alone does not resolve this mismatch.

The tutorial and completed example should use the same approach: either keep the cdylib instructions and provide the explicit run implementation and export, or use a binary project built for wasm32-wasip2, where Rust supplies the entrypoint for main().

Langage dominant
Rust
Étoiles
138
Forks
89
Merge moyen
10 h 38 min
PR mergées (30 j)
2

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de bytecodealliance/component-docs

Toutes les issues de bytecodealliance/component-docs

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.