bjorn3 / browser_wasi_shim Goto Github PK
View Code? Open in Web Editor NEWA WASI shim for in the browser
License: Apache License 2.0
A WASI shim for in the browser
License: Apache License 2.0
We are implementing 2 of the syscalls that deal with removing files and empty directories.
Lines 99 to 101 in 7349f7d
Lines 108 to 110 in 7349f7d
We have implemented both and it seems to work for empty file and empty directory.
The code is based on https://github.com/bjorn3/browser_wasi_shim/pull/42/files#diff-177a21b9f40c72ea679cf8658d14ed0d9702afcea694e92e0936f11ab182d2a3R331-R333
with some additional checks.
unlinkat
to unlink the files and remove the empty directories. This goes into an infinite loop.browser_wasi_shim/src/wasi_defs.ts
Line 116 in 7349f7d
browser_wasi_shim/src/fs_fd.ts
Lines 290 to 291 in 7349f7d
Wasi requires that pointers are aligned and that a trap should happen if pointers are not aligned.
browser_wasi_shim/src/fs_fd.ts
Line 230 in 4f69fae
Change this to https://github.com/golang/go/blob/aa8e4c5e610145af682d48b064fa0d28ed9a91e4/src/syscall/tables_wasip1.go#L56
ENOENT Errno = 44
Hey, I'm not sure how much effort this would be, so: would it be viable to support the Origin-Private Filesystem (OPFS) in the fds: []
argument to the WASI constructor? I suppose that you'd need to write a new Directory
subclass, which wraps a FileSystemDirectoryHandle or something like that?
// open directory in OPFS
const opfs = await navigator.storage.getDirectory();
const dir = await opfs.getDirectoryHandle("wasi-context", { create: true });
// initialize WASI shim
let wasi = new WASI(args, envs, [
new OpenFile(new File([])), // stdin
new OpenFile(new File([])), // stdout
new OpenFile(new File([])), // stderr
new WrapDirHandle(dir), // <----- ?!
]);
...
As far as I can tell, supporting this API would also allow you to use window.showDirectoryPicker()
and use an actual directory on the client machine for the execution context.
Hi, thanks for this wonderful effort :)
I'm very interested in running thread code from WASI .wasm
file on the browser. Is it possible right now? If not, can I make a PR for that using web workers?
Hello. First of all, thanks for the great project.
I found that in this repo (and in deno/std/wasi which is deprecated and removed), the interface of args_size_get
is args_sizes_get(argc: number, argv_buf_size: number): number
. However, the standard of wasi has the interface as args_sizes_get() -> Result<(size, size), errno>
May I ask why there's the difference?
Hello,
I am looking for the "rustc_binary.wasm" file, but could not find it anywhere. Where could I find it?
Thanks
Lines 38 to 39 in f4d2382
time="2023-10-11T10:49:24Z" level=fatal msg="impossible to open zip reader: read /language-platforms.zip: errno 4294967295"
proxy for fd_pread !! 4 25784616 1 128772n 25784612
index.js:110 return_value for fd_pread is -1
-1 becomes positive 4294967295 2^32-1 in javascript because of signed 2s complement being interpreted as unsigned javascript number
Instead of calling _start
, _initialize
should be used per https://nodejs.org/api/wasi.html#wasiinitializeinstance.
An example is to support Haskell Wasm Reactor Module:
// initialize Haskell Wasm Reactor Module
wasi.inst = inst;
inst.exports._initialize();
inst.exports.hs_init(0, 0);
Full example: https://github.com/hellwolf/haskell-examples/blob/master/2023-02-24-wasm-comm/client.js
What is your recommendation?
I'm using File
/OpenFile
to provide a file to the WebAssembly code. It is calling fd_seek(0n, wasi.WHENCE_END)
, but I receive the error message can't convert BigInt to number
on the following line of the function:
calculated_offset = this.file.data.byteLength + offset;
One simple fix might be to explicitly convert to BigInt
:
calculated_offset = BigInt(this.file.data.byteLength) + BigInt(offset);
I've done the following monkey-patching and it has resolved the issue for me, but maybe the line mentioned above could instead explicitly convert to BigInt
or otherwise handle scenarios where the two values have different types.
const old_fd_seek = OpenFile.prototype.fd_seek;
OpenFile.prototype.fd_seek = function(offset, whence) {
if (whence == 2 /* WHENCE_END */) {
return old_fd_seek.call(this, BigInt(this.file.data.byteLength) + BigInt(offset), 0 /* WHENCE_SET */);
}
return old_fd_seek.call(this, offset, whence);
}
In order to make this library a bit more streamlined, I'd suggest removing the xterm
and xterm-addon-fit
dependencies since they're not needed by the library itself. Would it make sense to split this repo into two separate projects, one for the WASI shim itself and another for the rustc-in-a-browser app?
I'm trying to use this module in a create-react-app
project, and I'm trying to test my project with the built-in Jest test system.
Jest doesn't run Node in ESM mode; it can handle ESM code with import
statements, but behind the scenes it does transpilation to run on require()
.
To use Jest with dependencies that are ESM modules, you have to add them to a negative regular expression in jest.transformIgnorePatterns
in your package.json
, so that Jest knows it needs to transpile them:
"jest": {
"transformIgnorePatterns": [
"node_modules/(?!(@bjorn3/browser_wasi_shim)/)"
]
}
But even though Jest can transform this module just fine, it can't deal with the conditional export in this project's package.json
, which only specifies a file to expose in "import" mode:
browser_wasi_shim/package.json
Lines 25 to 26 in f1f5fd2
I get a Jest error like this when I try to run my tests:
> [email protected] test
> react-scripts test --reporters default jest-compact-reporter --seed=1
Jest v27.5.1 node v18.7.0 darwin jest-min-reporter v0.1.0
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
FAIL src/GBZBaseAPI.test.js
● Test suite failed to run
Cannot find module '@bjorn3/browser_wasi_shim' from 'src/GBZBaseAPI.mjs'
Require stack:
src/GBZBaseAPI.mjs
src/GBZBaseAPI.test.js
1 | import { APIInterface } from "./APIInterface.mjs";
2 | import { readFile } from "fs-extra";
> 3 | import { WASI, File, OpenFile, PreopenDirectory } from "@bjorn3/browser_wasi_shim";
| ^
4 |
5 | // TODO: The Webpack way to get the WASM would be something like:
6 | //import QueryWasm from "gbz-base/target/wasm32-wasi/release/query.wasm";
at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:324:11)
at Object.<anonymous> (src/GBZBaseAPI.mjs:3:1)
If I add a "default": "./dist/index.js"
export to this project's package.json
in my node_modules
, Jest can find it and import and transpile it.
There might be a way to give Jest a custom module resolver to work around this, but I think the configuration fields required are not among those that Facebook permits you to use in a create-react-app
project.
It would be good if this project exposed an export like "default" that would work in this situation.
Currently, there are a lot of console.log
statements in wasi.js and elsewhere, which is nice for debugging but should probably be turned off for a release scenario. I'm not sure what the current best practice is for this kind of thing in the JS world, so I'm open to suggestions about how to do it.
index.js
currently has both import ... from ...
statements and module.exports = ...
syntaxes, which are two different import systems.
The current problem I'm facing is I'm trying to bundle a script importing @bjorn3/browser_wasi_shim
with webpack, and it fails at buildtime when importing with require()
(because @bjorn3/browser_wasi_shim
's package.json
has an exports
field that says index.js
is only importable via import
statements) and fails at runtime when importing with import
(because webpack throws an error if an ESM module tries to set module.exports
)
https://stackoverflow.com/a/42450109/4966649
Repro:
mkdir src
echo 'import { WASI } from "@bjorn3/browser_wasi_shim"' > src/index.js
npm install webpack webpack-cli @bjorn3/browser_wasi_shim
npx webpack
node dist/main.js
Expected clean exit, got Error: ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead
Less importantly, it would be great if @bjorn3/browser_wasi_shim
could provide a UMD build so that it's easy to just do something like
<script src="//unpkg.com/@bjorn/browser_wasi_shim"></script>
<script>
const { WASI } = window['@bjorn/browser_wasi_shim']
new WASI(...)
</script>
For now, I can just bundle the package myself with webpack.
I'm interested in using this library, but I noticed there's no license file and no license specified in package.json. Would you mind adding one?
The condition should be entry.stat().filetype === wasi.FILETYPE_DIRECTORY
to check if the entry filetype is actually a directory.
browser_wasi_shim/src/fs_fd.ts
Line 283 in 51f5c29
I originally chose flow over typescript because it allows putting type definitions in comments and as such doesn't require a separate compilation step. Unfortunately flow has several limitations including not supporting bigints and some incorrect builtin type declarations. As such I think using typescript is better in the long term.
I'm trying to use this package, but, copying the code from the readme leaves me with code that doesn't compile.
Is this still a valid example for a simple usage?
Hi, I tried to play the example accoding to https://github.com/bjorn3/browser_wasi_shim#running-the-demo, but the last console log show some error error: could not exec the linker `cc`
.
INFO rustc_interface::passes 0 parse sess buffered_lints
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=()
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=InstantiatedPredicates { predicates: [], spans: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=()
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=()
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<() as std::process::Termination>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<() as std::process::Termination>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=Binder { value: fn(), bound_vars: [] }
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=fn()
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=InstantiatedPredicates { predicates: [], spans: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=FnDef(DefId(1:3322 ~ std[56f0]::io::stdio::print), [])
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=fn(std::fmt::Arguments<'?1>)
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=std::fmt::Arguments<'?2>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=std::fmt::Arguments<'?2>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=std::fmt::Arguments<'?3>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=None
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=InstantiatedPredicates { predicates: [], spans: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=['?3, ?0e: bool]
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=InstantiatedPredicates { predicates: [Binder { value: ConstArgHasType(?0e: bool, bool), bound_vars: [] }], spans: [/home/gh-bjorn3/rust/library/core/src/fmt/mod.rs:321:9: 321:14 (#0)] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=FnDef(DefId(2:9612 ~ core[a167]::fmt::{impl#2}::new_const), ['?3, ?0e: bool])
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=std::fmt::Arguments<'?3>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=std::fmt::Arguments<'?2>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate('?1, '?1), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate('?2, '?2), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=fn(&'?3 [&ReStatic str]) -> std::fmt::Arguments<'?3>
┘
┐rustc_hir_typeck::coercion::coerce a=&ReStatic str, b=&ReStatic str
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<& as std::ops::CoerceUnsized<&>>
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<& as std::ops::CoerceUnsized<&>>
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate('?7, '?6), bound_vars: [] }
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: TraitPredicate(< as std::marker::Unsize<>>, polarity:Positive), bound_vars: [] }
├─┘
┘
┐rustc_hir_typeck::coercion::coerce a=&'?4 [&ReStatic str; 1_usize], b=&'?3 [&ReStatic str]
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<& as std::ops::CoerceUnsized<&>>
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<& as std::ops::CoerceUnsized<&>>
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate('?9, '?8), bound_vars: [] }
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: TraitPredicate(< as std::marker::Unsize<>>, polarity:Positive), bound_vars: [] }
├─┘
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate([&ReStatic str], '?3), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: TraitPredicate(<&'static str as std::marker::Sized>, polarity:Positive), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate(str, ReStatic), bound_vars: [] }
┘
┐rustc_hir_typeck::coercion::coerce a=std::fmt::Arguments<'?3>, b=std::fmt::Arguments<'?1>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate('?3, '?3), bound_vars: [] }
┘
┐rustc_hir_typeck::coercion::coerce a=(), b=()
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=std::fmt::Arguments<'?0>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=()
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=&'?3 [&ReStatic str]
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=std::fmt::Arguments<'?3>
┘
┐rustc_span::source_map::find_width_of_character_at_span forwards=false
┘
┐rustc_span::source_map::find_width_of_character_at_span forwards=false
┘
┐rustc_span::source_map::find_width_of_character_at_span forwards=false
┘
┐rustc_span::source_map::find_width_of_character_at_span forwards=false
┘
┐rustc_span::source_map::find_width_of_character_at_span forwards=false
┘
┐rustc_span::source_map::find_width_of_character_at_span forwards=false
┘
┐rustc_span::source_map::find_width_of_character_at_span forwards=false
┘
┐rustc_mir_build::build::expr::as_constant::lit_to_mir_constant
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<std::fmt::Arguments<'> as std::marker::Copy>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<std::fmt::Arguments<'> as std::marker::Copy>
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[Binder { value: ConstArgHasType(host/#1: bool, bool), bound_vars: [] }]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=FnDef(DefId(2:9612 ~ core[a167]::fmt::{impl#2}::new_const), ['?1, ?0e: bool])
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=Binder { value: ConstArgHasType(?0e: bool, bool), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=std::fmt::Arguments<'?2>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=std::fmt::Arguments<'?1>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate('?1, '?1), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: ConstArgHasType(true, bool), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<& as std::ops::CoerceUnsized<&>>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate('?5, '?4), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: TraitPredicate(< as std::marker::Unsize<>>, polarity:Positive), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate([&ReStatic str], '?0), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: TraitPredicate(<&'static str as std::marker::Sized>, polarity:Positive), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate(str, ReStatic), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: OutlivesPredicate('?0, '?0), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<std::fmt::Arguments<'> as std::marker::Copy>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<std::fmt::Arguments<'_> as std::marker::Copy>
┘
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [[&ReErased str]], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [[&ReErased str]], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(usize) with 0 obligations
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [[core::fmt::rt::Placeholder]], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [[core::fmt::rt::Placeholder]], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(usize) with 0 obligations
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [[core::fmt::rt::Argument]], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [[core::fmt::rt::Argument]], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(usize) with 0 obligations
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[Binder { value: OutlivesPredicate(ReEarlyParam(DefId(2:42784 ~ core[a167]::fmt::Arguments::'a), 0, 'a), ReEarlyParam(DefId(2:42784 ~ core[a167]::fmt::Arguments::'a), 0, 'a)), bound_vars: [] }]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [str], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [str], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(usize) with 0 obligations
┐rustc_const_eval::interpret::eval_context::frame main
├─┐rustc_const_eval::interpret::eval_context::frame main
│ ├─ 4ms INFO rustc_const_eval::interpret::step _1 = [const "Hello World!\n"]
│ ├─ 27ms INFO rustc_const_eval::interpret::step _0 = &_1
│ ├─ 30ms INFO rustc_const_eval::interpret::step return
│ ├─ 35ms INFO rustc_const_eval::interpret::eval_context popping stack frame (returning from function)
├─┘
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
INFO rustc_interface::passes Pre-codegen
Ty interner total ty lt ct all
Adt : 25 9.8%, 0.0% 3.9% 0.0% 0.0%
Array : 12 4.7%, 0.0% 3.5% 0.0% 0.0%
Slice : 11 4.3%, 0.0% 2.0% 0.0% 0.0%
RawPtr : 1 0.4%, 0.0% 0.0% 0.0% 0.0%
Ref : 59 23.0%, 2.3% 15.2% 0.0% 0.0%
FnDef : 11 4.3%, 0.0% 2.3% 0.8% 0.0%
FnPtr : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
Placeholder : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
Coroutine : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
CoroutineWitness : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
Dynamic : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
Closure : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
Tuple : 1 0.4%, 0.0% 0.0% 0.0% 0.0%
Bound : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
Param : 6 2.3%, 0.0% 0.0% 0.0% 0.0%
Infer : 126 49.2%, 39.1% 0.0% 0.0% 0.0%
Alias : 4 1.6%, 0.0% 0.0% 0.0% 0.0%
Foreign : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
total 256 41.4% 27.0% 0.8% 0.0%
GenericArgs interner: #87
Region interner: #549
Const Allocation interner: #3
Layout interner: #9
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[Binder { value: TraitPredicate(<() as std::marker::Sized>, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(<() as std::process::Termination>, polarity:Positive), bound_vars: [] }, Binder { value: OutlivesPredicate((), ReStatic), bound_vars: [] }]
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<() as std::process::Termination>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<() as std::process::Termination>
┘
┐rustc_const_eval::interpret::eval_context::frame Arguments::<'>::new_const
├─ 12ms INFO rustc_const_eval::interpret::step 1 = [const "invalid args"]
├─ 18ms INFO rustc_const_eval::interpret::step 0 = &1
├─ 23ms INFO rustc_const_eval::interpret::step return
├─ 27ms INFO rustc_const_eval::interpret::eval_context popping stack frame (returning from function)
┘
┐rustc_const_eval::interpret::eval_context::frame Arguments::<'>::new_const
├─ 5ms INFO rustc_const_eval::interpret::step 1 = []
├─┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [Foreign(DefId(2:9570 ~ core[a167]::fmt::rt::{extern#0}::Opaque))], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }, depth=0)
│ ├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [Foreign(DefId(2:9570 ~ core[a167]::fmt::rt::{extern#0}::Opaque))], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }
│ ├─┘
├─┘
├─ 56ms INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(()) with 0 obligations
├─┐rustc_trait_selection::traits::fully_normalize
│ ├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
│ ├─┘
├─┘
├─┐rustc_infer::infer::lexical_region_resolve::collect_errors
├─┘
├─┐rustc_trait_selection::traits::fully_normalize
│ ├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
│ ├─┘
├─┘
├─┐rustc_infer::infer::lexical_region_resolve::collect_errors
├─┘
├─118ms INFO rustc_const_eval::interpret::step 0 = &1
├─122ms INFO rustc_const_eval::interpret::step return
├─126ms INFO rustc_const_eval::interpret::eval_context popping stack frame (returning from function)
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[Binder { value: TraitPredicate(<Self as std::ops::FnMut>, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(<Self as std::ops::FnOnce>, polarity:Positive), bound_vars: [] }]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<&mut _ as std::ops::DispatchFromDyn<&mut >>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<&mut _ as std::ops::DispatchFromDyn<&mut >>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: TraitPredicate(< as std::marker::Unsize<>>, polarity:Positive), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [dyn [Binder(Trait(std::ops::FnMut), [])] + ReErased], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [dyn [Binder(Trait(std::ops::FnMut), [])] + ReErased], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(std::ptr::DynMetadata<dyn [Binder(Trait(std::ops::FnMut), [])] + ReErased>) with 0 obligations
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [Foreign(DefId(2:1778 ~ core[a167]::ptr::metadata::{extern#0}::VTable))], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [Foreign(DefId(2:1778 ~ core[a167]::ptr::metadata::{extern#0}::VTable))], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(()) with 0 obligations
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=(Binder { value: <{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnMut<()>>, bound_vars: [] }, Binder { value: <{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnMut<()>>, bound_vars: [] })
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[Binder { value: TraitPredicate(<Self as std::ops::Fn>, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(<Self as std::ops::FnMut>, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(<Self as std::ops::FnOnce>, polarity:Positive), bound_vars: [] }]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<& as std::ops::DispatchFromDyn<&>>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<& as std::ops::DispatchFromDyn<&>>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: TraitPredicate(< as std::marker::Unsize<>>, polarity:Positive), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [dyn [Binder(Trait(std::ops::Fn), [])] + ReErased], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [dyn [Binder(Trait(std::ops::Fn), [])] + ReErased], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(std::ptr::DynMetadata<dyn [Binder(Trait(std::ops::Fn), [])] + ReErased>) with 0 obligations
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [Foreign(DefId(2:1778 ~ core[a167]::ptr::metadata::{extern#0}::VTable))], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [Foreign(DefId(2:1778 ~ core[a167]::ptr::metadata::{extern#0}::VTable))], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(()) with 0 obligations
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=(Binder { value: <{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::Fn<()>>, bound_vars: [] }, Binder { value: <{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::Fn<()>>, bound_vars: [] })
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder(fn(), [])
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[Binder { value: TraitPredicate(<Self as std::ops::FnOnce>, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] }]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=(Binder { value: <{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnOnce<()>>, bound_vars: [] }, Binder { value: <{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnOnce<()>>, bound_vars: [] })
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=<() as std::process::Termination>
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=(Binder { value: <fn() as std::ops::FnOnce<()>>, bound_vars: [] }, Binder { value: <fn() as std::ops::FnOnce<()>>, bound_vars: [] })
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=()
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_const_eval::interpret::eval_context::frame libc::unix::linux_like::EXIT_SUCCESS
├─ 6ms INFO rustc_const_eval::interpret::step _0 = const 0_i32
├─ 13ms INFO rustc_const_eval::interpret::step return
├─ 19ms INFO rustc_const_eval::interpret::eval_context popping stack frame (returning from function)
┘
┐rustc_const_eval::interpret::eval_context::frame std::sys::unix::process::process_common::ExitCode::SUCCESS
├─ 6ms INFO rustc_const_eval::interpret::step StorageLive(_1)
├─ 11ms INFO rustc_const_eval::interpret::step StorageLive(_2)
├─ 17ms INFO rustc_const_eval::interpret::step _2 = const _ as u8 (IntToInt)
├─ 28ms INFO rustc_const_eval::interpret::step _1 = _2
├─ 34ms INFO rustc_const_eval::interpret::step _0 = std::sys::unix::process::process_common::ExitCode(move _1)
├─ 40ms INFO rustc_const_eval::interpret::step StorageDead(_2)
├─ 46ms INFO rustc_const_eval::interpret::step StorageDead(_1)
├─ 51ms INFO rustc_const_eval::interpret::step return
├─ 56ms INFO rustc_const_eval::interpret::eval_context popping stack frame (returning from function)
┘
┐rustc_const_eval::interpret::eval_context::frame ExitCode::SUCCESS
├─ 5ms INFO rustc_const_eval::interpret::step _0 = ExitCode(const _)
├─ 10ms INFO rustc_const_eval::interpret::step return
├─ 15ms INFO rustc_const_eval::interpret::eval_context popping stack frame (returning from function)
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[Binder { value: ProjectionPredicate(AliasTy { args: [F/#0, ()], def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output) }, Term::Ty(T/#1)), bound_vars: [] }, Binder { value: TraitPredicate(<F as std::ops::FnOnce<()>>, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] }]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(, polarity:Positive), bound_vars: [] }]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[Binder { value: OutlivesPredicate(T/#0, ReStatic), bound_vars: [] }]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [Self/#0, Args/#1], def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output) }, depth=0)
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(Alias(Projection, AliasTy { args: [Self/#0, Args/#1], def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output) })) with 0 obligations
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [Closure(DefId(1:46 ~ std[56f0]::rt::lang_start::{closure#0}), [(), i8, Binder(extern "RustCall" fn(()) -> i32, []), (Binder(fn(), []),)]), ()], def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=(Binder { value: <{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnOnce<()>>, bound_vars: [] }, Binder { value: <{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnOnce<()>>, bound_vars: [] })
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: extern "RustCall" fn(()) -> i32, bound_vars: [] }
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [Closure(DefId(1:46 ~ std[56f0]::rt::lang_start::{closure#0}), [(), i8, Binder(extern "RustCall" fn(()) -> i32, []), (Binder(fn(), []),)]), ()], def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output) }
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [Closure(DefId(1:46 ~ std[56f0]::rt::lang_start::{closure#0}), [(), i8, Binder(extern "RustCall" fn(()) -> i32, []), (Binder(fn(), []),)]), ()], def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(i32) with 0 obligations
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [Binder(fn(), []), ()], def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=(Binder { value: <fn() as std::ops::FnOnce<()>>, bound_vars: [] }, Binder { value: <fn() as std::ops::FnOnce<()>>, bound_vars: [] })
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=()
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: fn(), bound_vars: [] }
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [Binder(fn(), []), ()], def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output) }
├─┘
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [Binder(fn(), []), ()], def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(()) with 0 obligations
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=Binder { value: TraitPredicate(<{closure@std::rt::lang_start<()>::{closure#0}} as std::marker::Unpin>, polarity:Positive), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=(Binder(fn(), []),)
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=3, value=Binder { value: TraitPredicate(<(fn(),) as std::marker::Unpin>, polarity:Positive), bound_vars: [] }
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=3, value=Binder(fn(), [])
┘
┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=4, value=Binder { value: TraitPredicate(<fn() as std::marker::Unpin>, polarity:Positive), bound_vars: [] }
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [dyn [Binder(Trait(std::ops::Fn<()>), []), Binder(Projection(ExistentialProjection { def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output), args: [()], term: Term::Ty(i32) }), []), Binder(AutoTrait(DefId(2:2805 ~ core[a167]::marker::Sync)), []), Binder(AutoTrait(DefId(2:8670 ~ core[a167]::panic::unwind_safe::RefUnwindSafe)), [])] + ReErased], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [dyn [Binder(Trait(std::ops::Fn<()>), []), Binder(Projection(ExistentialProjection { def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output), args: [()], term: Term::Ty(i32) }), []), Binder(AutoTrait(DefId(2:2805 ~ core[a167]::marker::Sync)), []), Binder(AutoTrait(DefId(2:8670 ~ core[a167]::panic::unwind_safe::RefUnwindSafe)), [])] + ReErased], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(std::ptr::DynMetadata<dyn [Binder(Trait(std::ops::Fn<()>), []), Binder(Projection(ExistentialProjection { def_id: DefId(2:3058 ~ core[a167]::ops::function::FnOnce::Output), args: [()], term: Term::Ty(i32) }), []), Binder(AutoTrait(DefId(2:2805 ~ core[a167]::marker::Sync)), []), Binder(AutoTrait(DefId(2:8670 ~ core[a167]::panic::unwind_safe::RefUnwindSafe)), [])] + ReErased>) with 0 obligations
┐rustc_trait_selection::traits::project::project obligation=Obligation(predicate=AliasTy { args: [Foreign(DefId(2:1778 ~ core[a167]::ptr::metadata::{extern#0}::VTable))], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }, depth=0)
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=AliasTy { args: [Foreign(DefId(2:1778 ~ core[a167]::ptr::metadata::{extern#0}::VTable))], def_id: DefId(2:1751 ~ core[a167]::ptr::metadata::Pointee::Metadata) }
├─┘
┘
INFO rustc_trait_selection::traits::query::normalize normalize::<rustc_middle::ty::generic_args::GenericArg>: result=Ok(()) with 0 obligations
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[Binder { value: ConstArgHasType(host/#0: bool, bool), bound_vars: [] }]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
┐rustc_trait_selection::traits::fully_normalize
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors
┘
INFO rustc_interface::passes Post-codegen
Ty interner total ty lt ct all
Adt : 46 11.4%, 0.0% 2.5% 0.0% 0.0%
Array : 14 3.5%, 0.0% 2.2% 0.0% 0.0%
Slice : 11 2.7%, 0.0% 1.2% 0.0% 0.0%
RawPtr : 15 3.7%, 0.0% 0.0% 0.0% 0.0%
Ref : 117 28.9%, 2.5% 11.6% 0.0% 0.0%
FnDef : 33 8.1%, 0.0% 1.5% 0.5% 0.0%
FnPtr : 6 1.5%, 0.0% 0.0% 0.0% 0.0%
Placeholder : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
Coroutine : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
CoroutineWitness : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
Dynamic : 7 1.7%, 0.0% 0.0% 0.0% 0.0%
Closure : 2 0.5%, 0.0% 0.0% 0.0% 0.0%
Tuple : 3 0.7%, 0.0% 0.0% 0.0% 0.0%
Bound : 0 0.0%, 0.0% 0.0% 0.0% 0.0%
Param : 11 2.7%, 0.0% 0.0% 0.0% 0.0%
Infer : 126 31.1%, 24.7% 0.0% 0.0% 0.0%
Alias : 12 3.0%, 0.0% 0.0% 0.0% 0.0%
Foreign : 2 0.5%, 0.0% 0.0% 0.0% 0.0%
total 405 27.2% 19.0% 0.5% 0.0%
GenericArgs interner: #145
Region interner: #563
Const Allocation interner: #13
Layout interner: #28
INFO rustc_codegen_ssa::back::link preparing Executable to "hello"
INFO rustc_codegen_ssa::back::link
error: could not exec the linker cc
|
= note: operation not supported on this platform
= note:
Done
</details>
I find ConsoleStdout
from an existing test very useful to incrementally get log output while running WASI programs that use stdout
/stderr
:
browser_wasi_shim/test/adapters/browser/run-test.html
Lines 4 to 33 in b18b2da
In particular, in conjunction with an additional static method
static lineBuffered(write) {
const dec = new TextDecoder("utf-8", { fatal: false });
let line_buf = "";
return new ConsoleStdout((buffer) => {
line_buf += dec.decode(buffer, { stream: true });
const lines = line_buf.split("\n");
for (const [i, line] of lines.entries()) {
if (i < lines.length - 1) {
write(line);
} else {
line_buf = line;
}
}
});
}
which can eg be used like this
[
new OpenFile(new File([])), // stdin
ConsoleStdout.lineBuffered(msg => console.log(`[WASI stdout] ${msg}`)),
ConsoleStdout.lineBuffered(msg => console.warn(`[WASI stderr] ${msg}`)),
]
Is it in scope to add this to the library such that it can be reused by other projects? If so, happy to create a PR.
Currently fs_core.ts
and fs_fd.ts
import each other. Fortunately it does not cause any problem at the moment, but Rollup conservatively warns about this. (I faced it while changing default bundled WASI implementation of ruby.wasm: ruby/ruby.wasm#332)
$ npx rollup ./dist/index.js -o /dev/null
./dist/index.js → ../../../../../../dev/null...
(!) Circular dependency
dist/fs_core.js -> dist/fs_fd.js -> dist/fs_core.js
created ../../../../../../dev/null in 174ms
There are some options to address this issue. Which option do you like, @bjorn3? I personally prefer 2. since it is the simplest and does not change any public API.
fs_core.ts
and fs_fd.ts
fs_core.ts
and fs_fd.ts
's API to avoid cycleHey @bjorn3,
Thanks for sharing this library - exciting stuff!
I've been trying to find a way to invoke a function on a wasm32-wasi
library. As it is a library is has no start
function.
Is there a way to avoid calling wasi.start(instance)
and instead just call functions exported by the instance?
Something along these lines perhaps?
wasi.invoke(instance.exports.my_func)
Would be awesome - please let me know if I'm just missing something
Hello, thank you for this great library.
When using it for program built with https://gitlab.haskell.org/ghc/ghc-wasm-meta, it is failing early on because of the poll_oneoff "async io not supported" exception. Using return 0
instead makes the program go a bit further, but then it crash again when reading the stdin. Would it be possible to implement this api?
Some applications, such as Clang/LLVM compiled to WASI, will break in strange ways if st_ino
is zero or the same for every file. Although a user can work around this by subclassing File
and Directory
and overriding stat
to return a unique inode number (e.g. by incrementing a global variable, something like this), I feel like something like this should exist by default in fs_mem
Incidentally, I seem to recall reading a long time ago that leaving This is wrong, sorry. (very old versions of st_nlink
as 0 can also cause issues, but I can't find evidence to back that up. In any case, the usual stub implementation that I can find (e.g. in examples for FUSE filesystems) sets nlink
to 2 for all directories and 1 for all files.find
would in fact fail if st_nlink
was exactly 2 for all directories, and the workaround was to set it to 1. Search for subdirs_unreliable
in https://git.savannah.gnu.org/cgit/findutils.git/commit/find?id=5768a03ddfb5e18b1682e339d6cdd24ff721c510 )
Hi! Thanks for this great library!
Just a heads up that I've run into an issue around BigInts when using 64-bit wasm. I know this is to be expected but figured I'd flag it all the same just to get it on your radar.
TypeError: Cannot mix BigInt and other types, use explicit conversions
at Ciovec.read_bytes_array (file:///Users/stuff/node_modules/@bjorn3/browser_wasi_shim/dist/wasi_defs.js:1:4249)
at fd_write (file:///Users/stuff/node_modules/@bjorn3/browser_wasi_shim/dist/wasi.js:1:8534)
at wasm://wasm/00091766:wasm-function[206]:0x1ccc0
at wasm://wasm/00091766:wasm-function[198]:0x1c83c
at wasm://wasm/00091766:wasm-function[150]:0x14cf4
at wasm://wasm/00091766:wasm-function[53]:0x878a
at wasm://wasm/00091766:wasm-function[191]:0x196d9
rust 1.78.0, target: wasm32-wasip1-threads
using std::fs::File::open, I tried open '/cache/system/font/Ko/NotoSansKR-Bold.woff2' which is not exists actually,
and I got error,
[WASI stderr] called `Result::unwrap()` on an `Err` value: Custom { kind: Uncategorized, error: "failed to find a pre-opened file descriptor through which \"/cache/__system__/font/Ko/NotoSansKR-Bold.woff2\" could be opened" }
maybe wasi-sdk problem...?
@bjorn3 as I mentioned here bytecodealliance/jco#42 (comment) I think the way to go about supporting the component model is:
js-component-bindgen-component
import { generate } from './js-component-bindgen-component.js`
let { files, imports, exports } = generate(component, opts);
<head><script>...
so it can be used by the window.Unlike Date.now, Performance.now is not restricted to 1ms resolution. So, using it could help improve the accuracy of the clock functions.
Uncaught SyntaxError: The requested module '@bjorn3/browser_wasi_shim' does not provide an export named 'ConsoleStdout'
The usage example tells you to install from NPM and use code which imports ConsoleStdout
. However, the NPM package doesn't have any code for ConsoleStdout
because the changes from #67 were not published to NPM.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.