cormac-obrien / richter

A modern Quake engine.
http://c-obrien.org/richter/
MIT License
533 stars 33 forks source link

error: could not compile `richter` (lib) due to previous error; 14 warnings emitted #57

Open nbro opened 1 year ago

nbro commented 1 year ago

I'm getting the following error when I do cargo run --bin quake-client. Before this error, I was getting this error https://github.com/cormac-obrien/richter/issues/56, which I solved by installing ninja with winget. Before that, I was getting a similar error, which I solved by install cmake. I am on Windows 11.

PS C:\Users\me\Desktop\richter\src\bin> cargo run --bin quake-client
   Compiling gfx-hal v0.8.0
   Compiling shaderc-sys v0.6.3
   Compiling time v0.1.45
   Compiling thread_local v0.3.6
   Compiling aho-corasick v0.6.10
   Compiling arrayvec v0.7.4
   Compiling utf8-ranges v1.0.5
   Compiling claxon v0.4.3
   Compiling itoa v1.0.9
   Compiling hound v3.5.0
   Compiling structopt v0.3.26
   Compiling failure v0.1.8
   Compiling winit v0.22.2 (https://github.com/chemicstry/winit?branch=optional_drag_and_drop#6e7df749)
   Compiling env_logger v0.5.13
   Compiling cgmath v0.17.0
   Compiling num v0.1.42
   Compiling png v0.16.8
   Compiling rand v0.7.3
   Compiling nom v5.1.3
   Compiling futures v0.3.28
   Compiling serde_json v1.0.104
   Compiling regex v0.2.11
   Compiling uluru v2.2.0
   Compiling chrono v0.4.26
   Compiling strum v0.18.0
   Compiling bumpalo v3.13.0
   Compiling rodio v0.11.0 (https://github.com/RustAudio/rodio?rev=82b4952#82b49524)
   Compiling gfx-auxil v0.9.0
   Compiling gfx-backend-empty v0.8.0
   Compiling gfx-backend-vulkan v0.8.0
   Compiling gfx-backend-dx12 v0.8.0
   Compiling gfx-backend-dx11 v0.8.0
   Compiling wgpu-core v0.8.2
   Compiling wgpu v0.8.1
   Compiling shaderc v0.6.3
   Compiling richter v0.1.0 (C:\Users\me\Desktop\richter)
warning: unused import: `iter::FromIterator`
 --> src\client\render\ui\hud.rs:1:33
  |
1 | use std::{collections::HashMap, iter::FromIterator};
  |                                 ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `arrayvec::ArrayVec`
  --> src\client\render\ui\hud.rs:22:5
   |
22 | use arrayvec::ArrayVec;
   |     ^^^^^^^^^^^^^^^^^^

warning: unused import: `std::cell::RefCell`
 --> src\client\render\ui\mod.rs:8:5
  |
8 | use std::cell::RefCell;
  |     ^^^^^^^^^^^^^^^^^^

warning: unused imports: `DynamicUniformBufferBlock`, `QuadUniforms`, `self`, `util::any_slice_as_bytes`
  --> src\client\render\ui\mod.rs:19:59
   |
19 |                 quad::{QuadRenderer, QuadRendererCommand, QuadUniforms},
   |                                                           ^^^^^^^^^^^^
20 |             },
21 |             uniform::{self, DynamicUniformBufferBlock},
   |                       ^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^
...
25 |     common::{console::Console, util::any_slice_as_bytes},
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused imports: `InnerSpace`, `Vector2`
 --> src\client\render\warp.rs:5:14
  |
5 | use cgmath::{InnerSpace, Vector2, Vector3};
  |              ^^^^^^^^^^  ^^^^^^^

warning: unused imports: `model::Model`, `net::SignOnStage`
   --> src\client\render\mod.rs:102:9
    |
102 |         model::Model,
    |         ^^^^^^^^^^^^
103 |         net::SignOnStage,
    |         ^^^^^^^^^^^^^^^^

warning: unused import: `InnerSpace`
   --> src\client\render\mod.rs:111:19
    |
111 | use cgmath::{Deg, InnerSpace, Vector3, Zero};
    |                   ^^^^^^^^^^

warning: unused import: `Duration`
   --> src\client\render\mod.rs:112:24
    |
112 | use chrono::{DateTime, Duration, Utc};
    |                        ^^^^^^^^

warning: unused import: `BufReader`
  --> src\client\sound\mod.rs:26:16
   |
26 |     io::{self, BufReader, Cursor, Read},
   |                ^^^^^^^^^

warning: unused import: `chrono::Duration`
  --> src\common\bsp\load.rs:40:5
   |
40 | use chrono::Duration;
   |     ^^^^^^^^^^^^^^^^

warning: unused import: `std::path::PathBuf`
  --> src\common\mod.rs:38:5
   |
38 | use std::path::PathBuf;
   |     ^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> src\lib.rs:19:12
   |
19 | #![feature(drain_filter)]
   |            ^^^^^^^^^^^^

warning: use of deprecated method `std::error::Error::description`: use the Display impl or to_string()
   --> src\common\bsp\mod.rs:173:42
    |
173 |             BspError::Io(ref err) => err.description(),
    |                                          ^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: use of deprecated method `std::error::Error::description`: use the Display impl or to_string()
  --> src\common\net\mod.rs:98:42
   |
98 |             NetError::Io(ref err) => err.description(),
   |                                          ^^^^^^^^^^^

warning: unreachable expression
   --> src\server\mod.rs:956:9
    |
954 |         todo!("SV_CheckWaterTransition");
    |         -------------------------------- any code following this expression is unreachable
955 |
956 |         Ok(())
    |         ^^^^^^ unreachable expression
    |
    = note: `#[warn(unreachable_code)]` on by default

For more information about this error, try `rustc --explain E0554`.
warning: `richter` (lib) generated 14 warnings
error: could not compile `richter` (lib) due to previous error; 14 warnings emitted
nbro commented 1 year ago

So, I tried to install the nightly toolchain by doing rustup default nightly. I then tried with cargo +nightly run --bin quake-client, and now I get 3 errors

   Compiling richter v0.1.0 (C:\Users\me\Desktop\richter)
warning: unused import: `iter::FromIterator`
 --> src\client\render\ui\hud.rs:1:33
  |
1 | use std::{collections::HashMap, iter::FromIterator};
  |                                 ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `arrayvec::ArrayVec`
  --> src\client\render\ui\hud.rs:22:5
   |
22 | use arrayvec::ArrayVec;
   |     ^^^^^^^^^^^^^^^^^^

warning: unused import: `std::cell::RefCell`
 --> src\client\render\ui\mod.rs:8:5
  |
8 | use std::cell::RefCell;
  |     ^^^^^^^^^^^^^^^^^^

warning: unused imports: `DynamicUniformBufferBlock`, `QuadUniforms`, `self`, `util::any_slice_as_bytes`
  --> src\client\render\ui\mod.rs:19:59
   |
19 |                 quad::{QuadRenderer, QuadRendererCommand, QuadUniforms},
   |                                                           ^^^^^^^^^^^^
20 |             },
21 |             uniform::{self, DynamicUniformBufferBlock},
   |                       ^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^
...
25 |     common::{console::Console, util::any_slice_as_bytes},
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused imports: `InnerSpace`, `Vector2`
 --> src\client\render\warp.rs:5:14
  |
5 | use cgmath::{InnerSpace, Vector2, Vector3};
  |              ^^^^^^^^^^  ^^^^^^^

warning: unused imports: `model::Model`, `net::SignOnStage`
   --> src\client\render\mod.rs:102:9
    |
102 |         model::Model,
    |         ^^^^^^^^^^^^
103 |         net::SignOnStage,
    |         ^^^^^^^^^^^^^^^^

warning: unused import: `InnerSpace`
   --> src\client\render\mod.rs:111:19
    |
111 | use cgmath::{Deg, InnerSpace, Vector3, Zero};
    |                   ^^^^^^^^^^

warning: unused import: `Duration`
   --> src\client\render\mod.rs:112:24
    |
112 | use chrono::{DateTime, Duration, Utc};
    |                        ^^^^^^^^

warning: unused import: `BufReader`
  --> src\client\sound\mod.rs:26:16
   |
26 |     io::{self, BufReader, Cursor, Read},
   |                ^^^^^^^^^

warning: unused import: `chrono::Duration`
  --> src\common\bsp\load.rs:40:5
   |
40 | use chrono::Duration;
   |     ^^^^^^^^^^^^^^^^

warning: unused import: `std::path::PathBuf`
  --> src\common\mod.rs:38:5
   |
38 | use std::path::PathBuf;
   |     ^^^^^^^^^^^^^^^^^^

error[E0635]: unknown feature `drain_filter`
  --> src\lib.rs:19:12
   |
19 | #![feature(drain_filter)]
   |            ^^^^^^^^^^^^

error[E0599]: no method named `drain_filter` found for struct `LinkedList` in the current scope
  --> src\common\alloc.rs:86:24
   |
86 |         self.allocated.drain_filter(|k| *k == key);
   |                        ^^^^^^^^^^^^ method not found in `LinkedList<usize>`

error[E0599]: no method named `drain_filter` found for struct `LinkedList` in the current scope
   --> src\common\alloc.rs:110:19
    |
110 |         allocated.drain_filter(|k| {
    |         ----------^^^^^^^^^^^^ method not found in `LinkedList<usize>`

warning: use of deprecated method `std::error::Error::description`: use the Display impl or to_string()
   --> src\common\bsp\mod.rs:173:42
    |
173 |             BspError::Io(ref err) => err.description(),
    |                                          ^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: use of deprecated method `std::error::Error::description`: use the Display impl or to_string()
  --> src\common\net\mod.rs:98:42
   |
98 |             NetError::Io(ref err) => err.description(),
   |                                          ^^^^^^^^^^^

warning: unreachable expression
   --> src\server\mod.rs:956:9
    |
954 |         todo!("SV_CheckWaterTransition");
    |         -------------------------------- any code following this expression is unreachable
955 |
956 |         Ok(())
    |         ^^^^^^ unreachable expression
    |
    = note: `#[warn(unreachable_code)]` on by default

Some errors have detailed explanations: E0599, E0635.
For more information about an error, try `rustc --explain E0599`.
warning: `richter` (lib) generated 14 warnings
error: could not compile `richter` (lib) due to 3 previous errors; 14 warnings emitted

The 3 errors are related to drain_filter feature/method, which seems to have been renamed https://github.com/rust-lang/rust/issues/43244. The other errors also seem to be related. So, maybe just need to rename the filter in the code to fix this.

It seems that if we replace drain_filter with extract_if and assign the result to unnamed variable with let _ = ..., we are able to compile the code. This needs to be done in src\common\alloc.rs in 2 places and in src/lib.rs, which needs to use #![feature(extract_if)].