Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Playground snippet fails to compile #2481

Open
franciszekjob opened this issue Nov 13, 2024 · 1 comment
Open

Playground snippet fails to compile #2481

franciszekjob opened this issue Nov 13, 2024 · 1 comment
Labels
C-bug Category: A bug, incorrect or unintended behavior

Comments

@franciszekjob
Copy link

Problem

Playground snippet in "Hints For Implementing A Preprocessor" section fails to compile.

Image

Steps

  1. Go to https://rust-lang.github.io/mdBook/for_developers/preprocessors.html#hints-for-implementing-a-preprocessor
  2. Run the playground snippet

Image

Possible Solution(s)

No response

Notes

No response

Version


@franciszekjob franciszekjob added the C-bug Category: A bug, incorrect or unintended behavior label Nov 13, 2024
@bobhy
Copy link

bobhy commented Dec 12, 2024

(I am not experienced with this project, so this is not a definitive answer!)
I tried this just now and am now getting missing crate errors for mdbook as well as pulldown_cmark_to_cmark.
I'm not sure what changed since last month, or what I might be doing differently.

I think the fundamental problem is that Rust Playground doesn't support either of these crates, so the example won't compile there. E.g, to see what crates it does support:

$ wget -qO - https://play.rust-lang.org/meta/crates | grep mdbook

fails to find anything.

   Compiling playground v0.0.1 (/playground)
error[E0433]: failed to resolve: use of undeclared crate or module `mdbook`
 --> src/main.rs:4:5
  |
4 | use mdbook::book::{Book, Chapter};
  |     ^^^^^^ use of undeclared crate or module `mdbook`

error[E0433]: failed to resolve: use of undeclared crate or module `mdbook`
 --> src/main.rs:5:5
  |
5 | use mdbook::errors::Error;
  |     ^^^^^^ use of undeclared crate or module `mdbook`

error[E0433]: failed to resolve: use of undeclared crate or module `mdbook`
 --> src/main.rs:6:5
  |
6 | use mdbook::preprocess::{CmdPreprocessor, Preprocessor, PreprocessorContext};
  |     ^^^^^^ use of undeclared crate or module `mdbook`

error[E0432]: unresolved import `mdbook`
 --> src/main.rs:7:5
  |
7 | use mdbook::BookItem;
  |     ^^^^^^ use of undeclared crate or module `mdbook`

error[E0432]: unresolved import `pulldown_cmark`
 --> src/main.rs:8:5
  |
8 | use pulldown_cmark::{Event, Parser, Tag, TagEnd};
  |     ^^^^^^^^^^^^^^ use of undeclared crate or module `pulldown_cmark`

error[E0433]: failed to resolve: use of undeclared crate or module `pulldown_cmark_to_cmark`
  --> src/main.rs:69:8
   |
69 |     Ok(pulldown_cmark_to_cmark::cmark(events, &mut buf).map(|_| buf)?)
   |        ^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `pulldown_cmark_to_cmark`

Some errors have detailed explanations: E0432, E0433.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `playground` (bin "playground") due to 6 previous errors

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: A bug, incorrect or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants