vec![] expands to Vec::new(), but expanding macros takes a bit of
time and takes memory in rust-analyzer. Also, the code was using a mix
of vec![] and Vec::new(), so this is more consistent.
They should be in the lines, but the problem is that this causes issues
in the .mdx files.
License header doesn't really make sense for .md files anyway
When using rust, allow panics to cross the boundaries of our vtable traits.
This avoids panic producing two backtrace with panic=unwind
This patch doesn't touch the ABI of out FFI interface, they stay extern "C", because
if a panic or exception crosses these boundaries, we are in trouble.
(Also, we have a panic=abort in our Cargo.toml anyway)
`__CARGO_FIX_YOLO=1` is a hack, but it does help a lot with the tedious fixes where the result is fairly clear.
See https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
```
__CARGO_FIX_YOLO=1 cargo clippy --fix --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::needless_lifetimes
cargo fmt --all
```
```
warning: non-local `macro_rules!` definition, `#[macro_export]` macro should be written at top level module
--> helper_crates/vtable/tests/test_vtable.rs:159:5
|
159 | #[vtable]
| ^^^^^^^^^ in this procedural macro expansion
|
= help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `test3`
```
Put the macro in the module with everything else, so it is re-exported
with the same visibility
Dyn is currently Send+Sync, so `VRc<WhateverVTable, Dyn>` is also
Send+Sync. So we shouldn't really allow conversion between
`VRc<WhateverVTable, SomeThingNotSend>` to `VRc<_, Dyn>` that can be
sent between threads
This is a breaking change of the vtable crate, but also a soundness fix
Also VRc shouldn't be shared between thread if the vtable itself can't
be shared between threads
```
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> helper_crates/vtable/src/vrc.rs:109:56
|
109 | let mut layout = VTable::drop_in_place(&*vtable, data);
| ^^^^^^^^ help: change this to: `*vtable`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> helper_crates/vtable/src/vrc.rs:124:37
|
124 | VTable::dealloc(&*vtable, self.inner.cast().as_ptr(), layout);
| ^^^^^^^^ help: change this to: `*vtable`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
```
We can't create references for things that aren't represented by the
reference. Even if we never dereference that reference.
Also add a miri test in the CI that runs the test on crate which are
error free.
I get warnings about unused members using the nightly compiler, one for
each member in all structs that derive the `FieldOffsets` macro. That is
a lot.
This fixes that as well as the one occurrence of that same warning in
unrelated code.