gluon-lang / gluon

A static, type inferred and embeddable language written in Rust.
https://gluon-lang.org
MIT License
3.16k stars 145 forks source link

Changed array size to be 40 for E0308 #958

Closed rowanfr closed 10 months ago

rowanfr commented 10 months ago

This changes the array size to be 40 within the test to resolve the error E0308. This will close #957

rowanfr commented 10 months ago

Now there's the issue of:

error[E0793]: reference to packed field is unaligned
    --> C:\Users\appveyor\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ntapi-0.3.6\src\ntexapi.rs:2785:52
     |
2785 |         *tick_count.QuadPart_mut() = read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad);
     |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
     = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
     = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
    --> C:\Users\appveyor\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ntapi-0.3.6\src\ntexapi.rs:2809:25
     |
2809 |         ((read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad)
     |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
     = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
     = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)

I'm working to try to resolve it

rowanfr commented 10 months ago

The previous error was caused by an outdated Tokio dependency as shown here: My Rust project is broken all of the sudden (StackOverflow). After using cargo-edit for upgrade, the output is attached. cargoupgrade.txt

The new error is:

error[E0491]: in type `&mut QueryTable<'me, Q, <Q as AsyncQueryFunction<'_, 'me>>::SendDb>`, reference has a longer lifetime than the data it references
   --> ~\.cargo\registry\src\index.crates.io-6f17d22bba15001f\gluon-salsa-0.15.2\src\lib.rs:696:28
    |
696 |     pub async fn get_async(&mut self, key: Q::Key) -> Q::Value {
    |                            ^^^^^^^^^
    |
note: the pointer is valid for the anonymous lifetime defined here
   --> ~\.cargo\registry\src\index.crates.io-6f17d22bba15001f\gluon-salsa-0.15.2\src\lib.rs:696:28
    |
696 |     pub async fn get_async(&mut self, key: Q::Key) -> Q::Value {
    |                            ^^^^^^^^^
note: but the referenced data is only valid for the lifetime `'me` as defined here
   --> ~\.cargo\registry\src\index.crates.io-6f17d22bba15001f\gluon-salsa-0.15.2\src\lib.rs:684:6
    |
684 | impl<'me, Q> QueryTable<'me, Q, <Q as QueryDb<'me>>::Db>
    |      ^^^

error[E0491]: in type `&mut QueryTable<'me, Q, <Q as AsyncQueryFunction<'_, 'me>>::SendDb>`, reference has a longer lifetime than the data it references
   --> ~\.cargo\registry\src\index.crates.io-6f17d22bba15001f\gluon-salsa-0.15.2\src\lib.rs:703:9
    |
703 |         &mut self,
    |         ^^^^^^^^^
    |
note: the pointer is valid for the anonymous lifetime defined here
   --> ~\.cargo\registry\src\index.crates.io-6f17d22bba15001f\gluon-salsa-0.15.2\src\lib.rs:703:9
    |
703 |         &mut self,
    |         ^^^^^^^^^
note: but the referenced data is only valid for the lifetime `'me` as defined here
   --> ~\.cargo\registry\src\index.crates.io-6f17d22bba15001f\gluon-salsa-0.15.2\src\lib.rs:684:6
    |
684 | impl<'me, Q> QueryTable<'me, Q, <Q as QueryDb<'me>>::Db>
    |      ^^^

error[E0491]: in type `&QueryTable<'me, Q, <Q as AsyncQueryFunction<'_, 'me>>::SendDb>`, reference has a longer lifetime than the data it references
   --> ~\.cargo\registry\src\index.crates.io-6f17d22bba15001f\gluon-salsa-0.15.2\src\lib.rs:714:18
    |
714 |     pub fn purge(&self)
    |                  ^^^^^
    |
note: the pointer is valid for the anonymous lifetime defined here
   --> ~\.cargo\registry\src\index.crates.io-6f17d22bba15001f\gluon-salsa-0.15.2\src\lib.rs:714:18
    |
714 |     pub fn purge(&self)
    |                  ^^^^^
note: but the referenced data is only valid for the lifetime `'me` as defined here
   --> ~\.cargo\registry\src\index.crates.io-6f17d22bba15001f\gluon-salsa-0.15.2\src\lib.rs:684:6
    |
684 | impl<'me, Q> QueryTable<'me, Q, <Q as QueryDb<'me>>::Db>
    |      ^^^

For more information about this error, try `rustc --explain E0491`.
error: could not compile `gluon-salsa` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...

I'm working on that now

rowanfr commented 10 months ago

The previously mentioned issue was caused by an Internal Compilation Error (ICE) in rustc detailed in rust-lang/rust#112832 which has been resolved now thanks to rust-lang/rust#115559. This fork should be able to be merged to resolve the other mentioned issues. After attempting to run cargo test --all-features --all-targets 3 tests don't pass, specifically:

running 5 tests
test [compile-fail] compile-fail\getable-reference.rs ... FAILED
test [compile-fail] compile-fail\store-ref.rs ... FAILED
test [compile-fail] compile-fail\get-reference.rs ... ok
test [compile-fail] compile-fail\run_expr_str_ref.rs ... ok
test [compile-fail] compile-fail\getable-reference-str.rs ... FAILED

but that seems to be somewhat deliberate given that their error message is included as a comment and their tested as "compile-fail". As a result I added the should_panic attribute to that particular batch of tests. Lastly I changed appveyor to use the nightly rustc compiler instead of the stable version due to the ICE only being resolved in the nightly version.

rowanfr commented 10 months ago

alt-text IT COMPILED

Separately their are a few other issues that were shown in the compilation such as cloning static references, unnecessary muts, etc... but those can be resolved later. At this point I think this is ready to merge

rowanfr commented 10 months ago

I'm going to work on it a bit using my own appveyor so I don't continue to waste CI time