MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / rustc

Function rustc

tests/all/traps.rs:704–726  ·  view source on GitHub ↗
(src: &str)

Source from the content-addressed store, hash-verified

702}
703
704fn rustc(src: &str) -> Vec<u8> {
705 let td = tempfile::TempDir::new().unwrap();
706 let output = td.path().join("foo.wasm");
707 let input = td.path().join("input.rs");
708 std::fs::write(&input, src).unwrap();
709 let result = Command::new("rustc")
710 .arg(&input)
711 .arg("-o")
712 .arg(&output)
713 .arg("--target")
714 .arg("wasm32-wasip1")
715 .arg("-g")
716 .output()
717 .unwrap();
718 if result.status.success() {
719 return std::fs::read(&output).unwrap();
720 }
721 panic!(
722 "rustc failed: {}\n{}",
723 result.status,
724 String::from_utf8_lossy(&result.stderr)
725 );
726}
727
728#[test]
729fn parse_dwarf_info() -> Result<()> {

Callers 1

parse_dwarf_infoFunction · 0.85

Calls 9

outputMethod · 0.80
newFunction · 0.50
writeFunction · 0.50
readFunction · 0.50
unwrapMethod · 0.45
joinMethod · 0.45
pathMethod · 0.45
argMethod · 0.45
successMethod · 0.45

Tested by 1

parse_dwarf_infoFunction · 0.68