Stream: git-wasmtime

Topic: wasmtime / issue #3588 Cranelift: Cranelift-jit: feature:...


view this post on Zulip Wasmtime GitHub notifications bot (Dec 08 2021 at 13:22):

YC-Lammy labeled issue #3588:

Trace

error[E0308]: mismatched types
  --> /home/username/.cargo/registry/src/github.com/cranelift-jit-0.78.0/src/memory.rs:37:9
   |
35 |       fn with_size(size: usize) -> io::Result<Self> {
   |                                    ---------------- expected `std::result::Result<PtrLen, std::io::Error>` because of return type
36 |           let alloc_size = region::page::ceil(size);
37 | /         MmapMut::map_anon(alloc_size).map(|mut mmap| {
38 | |             // The order here is important; we assign the pointer first to get
39 | |             // around compile time borrow errors.
40 | |             Ok(Self {
...  |
44 | |             })
45 | |         })
   | |__________^ expected struct `PtrLen`, found enum `std::result::Result`
   |
   = note: expected enum `std::result::Result<PtrLen, _>`
              found enum `std::result::Result<std::result::Result<PtrLen, _>, _>`

Fix

    #[cfg(all(not(target_os = "windows"), feature = "selinux-fix"))]
    fn with_size(size: usize) -> io::Result<Self> {
        let alloc_size = region::page::ceil(size);
        let mut mmap = MmapMut::map_anon(alloc_size)?;
        // The order here is important; we assign the pointer first to get
        // around compile time borrow errors.
        Ok(Self {
            ptr: mmap.as_mut_ptr(),
            map: Some(mmap),
            len: alloc_size,
        })
    }

Versions and Environment

Cranelift version or commit: 0.78.0

Operating system: Fedora 34

Architecture: amd64

Cpu: amd R5 4500u

view this post on Zulip Wasmtime GitHub notifications bot (Dec 08 2021 at 13:22):

YC-Lammy labeled issue #3588:

Trace

error[E0308]: mismatched types
  --> /home/username/.cargo/registry/src/github.com/cranelift-jit-0.78.0/src/memory.rs:37:9
   |
35 |       fn with_size(size: usize) -> io::Result<Self> {
   |                                    ---------------- expected `std::result::Result<PtrLen, std::io::Error>` because of return type
36 |           let alloc_size = region::page::ceil(size);
37 | /         MmapMut::map_anon(alloc_size).map(|mut mmap| {
38 | |             // The order here is important; we assign the pointer first to get
39 | |             // around compile time borrow errors.
40 | |             Ok(Self {
...  |
44 | |             })
45 | |         })
   | |__________^ expected struct `PtrLen`, found enum `std::result::Result`
   |
   = note: expected enum `std::result::Result<PtrLen, _>`
              found enum `std::result::Result<std::result::Result<PtrLen, _>, _>`

Fix

    #[cfg(all(not(target_os = "windows"), feature = "selinux-fix"))]
    fn with_size(size: usize) -> io::Result<Self> {
        let alloc_size = region::page::ceil(size);
        let mut mmap = MmapMut::map_anon(alloc_size)?;
        // The order here is important; we assign the pointer first to get
        // around compile time borrow errors.
        Ok(Self {
            ptr: mmap.as_mut_ptr(),
            map: Some(mmap),
            len: alloc_size,
        })
    }

Versions and Environment

Cranelift version or commit: 0.78.0

Operating system: Fedora 34

Architecture: amd64

Cpu: amd R5 4500u

view this post on Zulip Wasmtime GitHub notifications bot (Dec 08 2021 at 13:22):

YC-Lammy opened issue #3588:

Trace

error[E0308]: mismatched types
  --> /home/username/.cargo/registry/src/github.com/cranelift-jit-0.78.0/src/memory.rs:37:9
   |
35 |       fn with_size(size: usize) -> io::Result<Self> {
   |                                    ---------------- expected `std::result::Result<PtrLen, std::io::Error>` because of return type
36 |           let alloc_size = region::page::ceil(size);
37 | /         MmapMut::map_anon(alloc_size).map(|mut mmap| {
38 | |             // The order here is important; we assign the pointer first to get
39 | |             // around compile time borrow errors.
40 | |             Ok(Self {
...  |
44 | |             })
45 | |         })
   | |__________^ expected struct `PtrLen`, found enum `std::result::Result`
   |
   = note: expected enum `std::result::Result<PtrLen, _>`
              found enum `std::result::Result<std::result::Result<PtrLen, _>, _>`

Fix

    #[cfg(all(not(target_os = "windows"), feature = "selinux-fix"))]
    fn with_size(size: usize) -> io::Result<Self> {
        let alloc_size = region::page::ceil(size);
        let mut mmap = MmapMut::map_anon(alloc_size)?;
        // The order here is important; we assign the pointer first to get
        // around compile time borrow errors.
        Ok(Self {
            ptr: mmap.as_mut_ptr(),
            map: Some(mmap),
            len: alloc_size,
        })
    }

Versions and Environment

Cranelift version or commit: 0.78.0

Operating system: Fedora 34

Architecture: amd64

Cpu: amd R5 4500u

view this post on Zulip Wasmtime GitHub notifications bot (Dec 08 2021 at 13:23):

YC-Lammy edited issue #3588:

Trace

error[E0308]: mismatched types
  --> /home/username/.cargo/registry/src/github.com/cranelift-jit-0.78.0/src/memory.rs:37:9
   |
35 |       fn with_size(size: usize) -> io::Result<Self> {
   |                                    ---------------- expected `std::result::Result<PtrLen, std::io::Error>` because of return type
36 |           let alloc_size = region::page::ceil(size);
37 | /         MmapMut::map_anon(alloc_size).map(|mut mmap| {
38 | |             // The order here is important; we assign the pointer first to get
39 | |             // around compile time borrow errors.
40 | |             Ok(Self {
...  |
44 | |             })
45 | |         })
   | |__________^ expected struct `PtrLen`, found enum `std::result::Result`
   |
   = note: expected enum `std::result::Result<PtrLen, _>`
              found enum `std::result::Result<std::result::Result<PtrLen, _>, _>`

Fix

    #[cfg(all(not(target_os = "windows"), feature = "selinux-fix"))]
    fn with_size(size: usize) -> io::Result<Self> {
        let alloc_size = region::page::ceil(size);
        let mut mmap = MmapMut::map_anon(alloc_size)?;
        // The order here is important; we assign the pointer first to get
        // around compile time borrow errors.
        Ok(Self {
            ptr: mmap.as_mut_ptr(),
            map: Some(mmap),
            len: alloc_size,
        })
    }

Versions and Environment

Cranelift version or commit: 0.78.0

Operating system: Fedora 34

Architecture: amd64


Last updated: Nov 22 2024 at 17:03 UTC