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

Method emit

cranelift/isle/isle/src/error.rs:169–193  ·  view source on GitHub ↗
(
        &self,
        f: &mut std::fmt::Formatter,
        diagnostics: Vec<Diagnostic<usize>>,
    )

Source from the content-addressed store, hash-verified

167
168 #[cfg(feature = "fancy-errors")]
169 fn emit(
170 &self,
171 f: &mut std::fmt::Formatter,
172 diagnostics: Vec<Diagnostic<usize>>,
173 ) -> std::fmt::Result {
174 use codespan_reporting::term::termcolor;
175 let w = termcolor::BufferWriter::stderr(termcolor::ColorChoice::Auto);
176 let mut b = w.buffer();
177 let mut files = codespan_reporting::files::SimpleFiles::new();
178 for (name, source) in self
179 .files
180 .file_names
181 .iter()
182 .zip(self.files.file_texts.iter())
183 {
184 files.add(name, source);
185 }
186 for diagnostic in diagnostics {
187 codespan_reporting::term::emit(&mut b, &Default::default(), &files, &diagnostic)
188 .map_err(|_| std::fmt::Error)?;
189 }
190 let b = b.into_inner();
191 let b = std::str::from_utf8(&b).map_err(|_| std::fmt::Error)?;
192 f.write_str(b)
193 }
194
195 #[cfg(not(feature = "fancy-errors"))]
196 fn emit(

Callers 1

fmtMethod · 0.45

Calls 15

emitFunction · 0.85
OkFunction · 0.85
file_line_mapMethod · 0.80
checked_subMethod · 0.80
copiedMethod · 0.80
stderrFunction · 0.50
newFunction · 0.50
bufferMethod · 0.45
iterMethod · 0.45
addMethod · 0.45
into_innerMethod · 0.45
write_strMethod · 0.45

Tested by

no test coverage detected