Skip to content

Latest commit

 

History

History
207 lines (127 loc) · 5.54 KB

PITFALLS.md

File metadata and controls

207 lines (127 loc) · 5.54 KB

Development Pitfalls

This document summarizes common pitfalls encountered during development.

VSCode Behaviors

  • Avoid using println!() in release code for VSCode extensions, as this can lead to unexpected behaviors.
  • If the user mistakenly uses lib.rs instead of lib.hsy, ensure that errors are reported in Corgi.toml.

Missing libtorch

  • This issue might be related to environment variables set in the fish shell. Consider using the -gx flag.

Error: Undefined Symbol c10::detail::torchCheckFail

  • This error may occur if you are using libtorch.so from the Python package, which does not include all necessary dependencies.

VSCode Environment Variables Not Updated for Rust Analyzer Actions

  • Solution: Restart VSCode to refresh environment variables.

LD_LIBRARY_PATH Missing Paths Outside Target

Unresolved Import Errors

  • This might be due to a mismatched edition key in Cargo.toml.

VSCode Extension Not Working Without Error Messages

  • Ensure there are no type errors in TypeScript code.
  • Compare with rust-analyzer as a last resort.
  • Watch for infinite loops.

Couldn’t Find VSCode Publisher

lsp-type Version Issues

  • Note: Version 94.1 is problematic due to numerous bugs; use 94.0 instead.

debug_with_db Not Working

  • Ensure that the db trait extends the other db trait.

Introducing a Dependency Breaks Things

  • The issue might be due to feature flags introduced by the dependency, affecting other dependencies (e.g., smallvec/union).

Consolidating Dependency Versions

  • Use the command:

    cargo update -p bson:0.11.1 --precise 0.10.0

Macro Trailing Commas

  • Example of handling optional trailing commas in macros:

    ($Name:ident { $($Variant:ident),* $(,)? }) => {
    //                                 ^^^^^
  • Read more on Stack Overflow.

LLDB Not Showing Full Path

  • Set the frame format with the following command:

    settings set frame-format frame #${frame.index}: ${frame.pc}{ ${module.file.basename}{\`${function.name}}}{ at ${line.file.fullpath}:${line.number}}\n
    

Lean Server Outputting fwIn.txt, fwOut.txt, wdErr.txt, wdIn.txt, wdOut.txt

  • Search for "Server Logging: Enabled" in its settings.

#[cfg(test)] Not Running During Testing in linkages_emancipated_by_javelin

  • This issue is still under investigation.

VSCode Regex

The path Attribute

ld.lld: error: unable to find library -lstdc++

  • Try installing the appropriate version of libstdc++:
sudo apt install libstdc++-14-dev

or another relevant version.

Tracing

  • Crate Name: Ensure the crate name is in snake case.
tracing_subscriber::registry()
    .with(tracing_subscriber::EnvFilter::new(
        "husky_websocket_utils=info",
    ))
    .with(tracing_subscriber::fmt::layer())
    .init();

Rust Panic

panic using any type:

std::panic::panic_any(t)

Rust Macro

How to use variadic macros to call nested constructors?

https://stackoverflow.com/questions/24512356/how-to-use-variadic-macros-to-call-nested-constructors

catch unwind anything

https://doc.rust-lang.org/std/panic/struct.AssertUnwindSafe.html

rust item path not found by pub use

Maybe it got shadowed in the way.

vm

vm value not recorded

crates/vmir/husky-vmir/src/expr.rs not using eval_expr_itself properly

raw string tabs

vscode will convert tab into space even for raw string, be careful

cuda12.4

https://askubuntu.com/questions/1491254/installing-cuda-on-ubuntu-23-10-libt5info-not-installable

Note that the tutorial for ubuntu24 is different from ubuntu23.

fish environment variables

Please check fish_variables and config.fish

python module not found

Please check $PYTHONPATH

docker gpu support

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html

install nvidia container toolkit

don't listen to llms, they suck at this.

rustc borrow checker closure

If a closure has a &mut reference to a variable, not writing out the exact type can lead to rustc borrow checker error.

use crate::*;

pub(crate) fn foldm_aux<Engine, S, I, R>(
    engine: &mut Engine,
    state: &S,
    mut iter: impl Iterator<Item = I> + Clone,
    fs: &[&dyn Fn(&mut Engine, &S, &I) -> S],
    g: &impl Fn(&mut Engine, &S) -> MiracleAltMaybeResult<R>,
) -> MiracleAltMaybeResult<R>
where
    Engine: HasMiracleFull,
{
    let Some(item) = iter.next() else {
        return g(engine, state);
    };
    let fs = fs
        .iter()
        .map(|f| {
            |engine| -> MiracleAltMaybeResult<R> {
                let state = f(engine, state, &item);
                foldm_aux(engine, &state, iter.clone(), fs, g)
            }
        })
        .collect::<Vec<_>>();
    engine.exec_batch2(&fs)
}

in crates/abstractions/miracle/src/foldm.rs.