rust-cookbook icon indicating copy to clipboard operation
rust-cookbook copied to clipboard

Broken Example (Check a webpage for broken links)

Open Arteiii opened this issue 10 months ago • 0 comments
trafficstars

https://rust-lang-nursery.github.io/rust-cookbook/web/scraping.html#check-a-webpage-for-broken-links

   Compiling playground v0.0.1 (/playground)
error[E0670]: `async fn` is not permitted in Rust 2015
  --> src/main.rs:31:1
   |
31 | async fn get_base_url(url: &Url, doc: &Document) -> Result<Url, BrokenError> {
   | ^^^^^ to use `async fn`, switch to Rust 2018 or later
   |
   = help: set `edition = "2021"` in `Cargo.toml`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
  --> src/main.rs:38:1
   |
38 | async fn check_link(url: &Url) -> Result<bool, BrokenError> {
   | ^^^^^ to use `async fn`, switch to Rust 2018 or later
   |
   = help: set `edition = "2021"` in `Cargo.toml`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
  --> src/main.rs:43:5
   |
43 | pub async fn check(site: &str) -> Result<CategorizedUrls, BrokenError> {
   |     ^^^^^ to use `async fn`, switch to Rust 2018 or later
   |
   = help: set `edition = "2021"` in `Cargo.toml`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: `async move` blocks are only allowed in Rust 2018 or later
  --> src/main.rs:59:33
   |
59 |         tasks.push(tokio::spawn(async move {
   |                                 ^^^^^^^^^^

error: expected item, found `[`
  --> src/main.rs:80:1
   |
80 | [tokio::main]
   | ^ expected item
   |
   = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>

For more information about this error, try `rustc --explain E0670`.
error: could not compile `playground` (bin "playground") due to 5 previous errors

Arteiii avatar Jan 09 '25 13:01 Arteiii