[glsl-in] Use Span instead of SourceMetadata

This commit is contained in:
João Capucho
2021-09-21 15:51:27 +01:00
committed by Dzmitry Malyshau
parent 42db64628e
commit af44603e47
18 changed files with 256 additions and 348 deletions

View File

@@ -465,9 +465,11 @@ pub fn emit_glsl_parser_error(errors: Vec<naga::front::glsl::Error>, filename: &
let writer = StandardStream::stderr(ColorChoice::Auto);
for err in errors {
let diagnostic = Diagnostic::error()
.with_message(err.kind.to_string())
.with_labels(vec![Label::primary((), err.meta.start..err.meta.end)]);
let mut diagnostic = Diagnostic::error().with_message(err.kind.to_string());
if let Some(range) = err.meta.to_range() {
diagnostic = diagnostic.with_labels(vec![Label::primary((), range)]);
}
term::emit(&mut writer.lock(), &config, &files, &diagnostic).expect("cannot write error");
}