shiika-lang / shiika

A statically-typed programming language
MIT License
223 stars 15 forks source link

Warning: calls to std::mem::drop with a reference encountered while following instructions in instruction.md. #523

Open yamakoud opened 9 months ago

yamakoud commented 9 months ago

my environment

I Encountered warning while following instructiosn in install.md.

Executing the command cd lib/skc_rustlib; cargo build; cd ../../ resulted in a warning message related to calls to std::mem::drop with a reference.

kyama@Nyanko-Book-Pro shiika % cd lib/skc_rustlib; cargo build; cd ../../
  Downloaded unicode-segmentation v1.10.1
  Downloaded cmake v0.1.50
  Downloaded rand_chacha v0.3.1
  Downloaded uncased v0.9.9
  Downloaded ppv-lite86 v0.2.17
  Downloaded getrandom v0.2.10
  Downloaded plain v0.2.3
  Downloaded chrono-tz-build v0.0.3
  Downloaded chrono-tz v0.6.3
  Downloaded bdwgc-alloc v0.6.6
  Downloaded 10 crates (1.8 MB) in 1.61s
   Compiling libc v0.2.147
   Compiling regex-syntax v0.7.4
   Compiling uncased v0.9.9
   Compiling ppv-lite86 v0.2.17
   Compiling shiika_ffi v0.1.0 (/Users/kyama/Projects/shiika/lib/shiika_ffi)
   Compiling plain v0.2.3
   Compiling unicode-segmentation v1.10.1
   Compiling shiika_ffi_macro v0.1.0 (/Users/kyama/Projects/shiika/lib/shiika_ffi_macro)
   Compiling cc v1.0.82
   Compiling getrandom v0.2.10
   Compiling time v0.1.45
   Compiling phf_shared v0.11.2
   Compiling rand_core v0.6.4
   Compiling phf v0.11.2
   Compiling phf_generator v0.11.2
   Compiling chrono v0.4.26
   Compiling phf_codegen v0.11.2
   Compiling rand_chacha v0.3.1
   Compiling rand v0.8.5
   Compiling cmake v0.1.50
   Compiling regex-automata v0.3.6
   Compiling bdwgc-alloc v0.6.6
   Compiling regex v1.9.3
   Compiling parse-zoneinfo v0.3.0
   Compiling chrono-tz-build v0.0.3
   Compiling chrono-tz v0.6.3
   Compiling skc_rustlib v0.1.0 (/Users/kyama/Projects/shiika/lib/skc_rustlib)
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
  --> lib/skc_rustlib/src/builtin/file.rs:65:5
   |
65 |     std::mem::drop(SkFile(shiika_file).file_mut());
   |     ^^^^^^^^^^^^^^^------------------------------^
   |                    |
   |                    argument has type `&mut File`
   |
   = note: use `let _ = ...` to ignore the expression or result
   = note: `#[warn(dropping_references)]` on by default

warning: `skc_rustlib` (lib) generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 8.00s
yhara commented 9 months ago

Thank you for reporting! It seems that I was using older rustc. After upgrading to 1.74.1, I got the same warning.

yamakoud commented 9 months ago

Shall I write the rust version in install.md to unify the versions in the environment?

Currently rust version is not specified in install.md.

image

What rust version are you currently using?

yhara commented 9 months ago

Currently rust version is not specified in install.md.

Right, I have no policy about Rust version other than using latest stable.

Shall I write the rust version in install.md to unify the versions in the environment?

Fine, but how about just write "latest stable"? (because if you write "1.74.1" there then you need to update it everytime new rust is released)

What rust version are you currently using?

Installed 1.74.1 last night, so I'll keep using it.

yamakoud commented 9 months ago

Fine, but how about just write "latest stable"? (because if you write "1.74.1" there then you need to update it everytime new rust is released)

Nice. Check this. I've made change. https://github.com/shiika-lang/shiika/pull/528

Installed 1.74.1 last night, so I'll keep using it.

OK thx. I'll also keep using 1.74.1.

yhara commented 9 months ago

Oh we should fix the warning.