Skip to content

? couldn't convert the error to HyperlightError on Linux #408

Closed
@Magicloud

Description

@Magicloud

What happened?

Trying out hyperlight-host 0.3 with code:

use hyperlight_host::{
    MultiUseSandbox, UninitializedSandbox, func::ReturnType, sandbox_state::transition::Noop,
};


fn main() -> hyperlight_host::Result<()> {
    let mut uninitialized_sandbox = UninitializedSandbox::new(
        hyperlight_host::GuestBinary::FilePath("".to_string()),
        None, // default configuration
        None, // default run options
        None, // default host print function
    )?;

    Ok(())
}

Failed to build with error:

error[E0277]: `?` couldn't convert the error to `HyperlightError`
   --> /home/magicloud/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/hyperlight-host-0.3.0/src/hypervisor/hyperv_linux.rs:586:56
    |
586 |                     let io_message = m.to_ioport_info()?;
    |                                        ----------------^ the trait `From<vmm_sys_util::errno::Error>` is not implemented for `HyperlightError`
    |                                        |
    |                                        this can't be annotated with `?` because it has type `Result<_, vmm_sys_util::errno::Error>`
    |
note: `HyperlightError` needs to implement `From<vmm_sys_util::errno::Error>`
   --> /home/magicloud/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/hyperlight-host-0.3.0/src/error.rs:55:1
    |
55  | pub enum HyperlightError {
    | ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              `HyperlightError` implements `From<&str>`
              `HyperlightError` implements `From<BackendError>`
              `HyperlightError` implements `From<BorrowError>`
              `HyperlightError` implements `From<BorrowMutError>`
              `HyperlightError` implements `From<FromUtf8Error>`
              `HyperlightError` implements `From<Infallible>`
              `HyperlightError` implements `From<InvalidFlatbuffer>`
              `HyperlightError` implements `From<MshvError>`
            and 14 others

And same error at some other places.

What did you expect to happen?

Testing code pass building.

Steps to reproduce the behavior

  1. Write the example code,
  2. cargo build

Hyperlight Version

0.3.0

OS version

On Linux:
$ cat /etc/os-release
ANSI_COLOR="0;38;2;126;186;228"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
BUILD_ID="25.05pre780010.063dece00c5a"
CPE_NAME="cpe:/o:nixos:nixos:25.05"
DEFAULT_HOSTNAME=nixos
DOCUMENTATION_URL="https://nixos.org/learn.html"
HOME_URL="https://nixos.org/"
ID=nixos
ID_LIKE=""
IMAGE_ID=""
IMAGE_VERSION=""
LOGO="nix-snowflake"
NAME=NixOS
PRETTY_NAME="NixOS 25.05 (Warbler)"
SUPPORT_URL="https://nixos.org/community.html"
VARIANT=""
VARIANT_ID=""
VENDOR_NAME=NixOS
VENDOR_URL="https://nixos.org/"
VERSION="25.05 (Warbler)"
VERSION_CODENAME=warbler
VERSION_ID="25.05"

$ uname -a
Linux nixos 6.12.20 #1-NixOS SMP PREEMPT_DYNAMIC Sat Mar 22 19:54:28 UTC 2025 x86_64 GNU/Linux
</details>


### Additional Information

rustc version: 1.87.0-beta.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions