2021-02-22 18:58:45 +03:00
|
|
|
use crate::base::ModuleData;
|
2022-11-15 14:24:33 +01:00
|
|
|
use crate::errors::{
|
|
|
|
ModuleCircular, ModuleFileNotFound, ModuleInBlock, ModuleInBlockName, ModuleMultipleCandidates,
|
|
|
|
};
|
2021-02-17 00:56:07 +03:00
|
|
|
use rustc_ast::ptr::P;
|
2022-08-17 12:34:33 +10:00
|
|
|
use rustc_ast::{token, AttrVec, Attribute, Inline, Item, ModSpans};
|
2022-11-15 14:24:33 +01:00
|
|
|
use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed};
|
2020-03-21 23:10:10 +01:00
|
|
|
use rustc_parse::new_parser_from_file;
|
2021-09-17 13:08:56 -07:00
|
|
|
use rustc_parse::validate_attr;
|
2020-03-08 09:28:46 +01:00
|
|
|
use rustc_session::parse::ParseSess;
|
2020-07-30 11:27:50 +10:00
|
|
|
use rustc_session::Session;
|
2020-04-19 13:00:18 +02:00
|
|
|
use rustc_span::symbol::{sym, Ident};
|
2021-02-22 18:42:57 +03:00
|
|
|
use rustc_span::Span;
|
2022-11-15 14:24:33 +01:00
|
|
|
use std::iter::once;
|
2019-08-11 18:34:42 +02:00
|
|
|
use std::path::{self, Path, PathBuf};
|
2023-01-30 15:39:22 +11:00
|
|
|
use thin_vec::ThinVec;
|
2019-08-11 18:34:42 +02:00
|
|
|
|
2020-03-08 22:10:37 +01:00
|
|
|
#[derive(Copy, Clone)]
|
2021-02-22 19:06:36 +03:00
|
|
|
pub enum DirOwnership {
|
2020-03-08 22:10:37 +01:00
|
|
|
Owned {
|
|
|
|
// None if `mod.rs`, `Some("foo")` if we're in `foo.rs`.
|
2020-04-19 13:00:18 +02:00
|
|
|
relative: Option<Ident>,
|
2020-03-08 22:10:37 +01:00
|
|
|
},
|
|
|
|
UnownedViaBlock,
|
|
|
|
}
|
|
|
|
|
2020-01-11 13:19:57 -06:00
|
|
|
// Public for rustfmt usage.
|
|
|
|
pub struct ModulePathSuccess {
|
2021-02-22 19:06:36 +03:00
|
|
|
pub file_path: PathBuf,
|
|
|
|
pub dir_ownership: DirOwnership,
|
2019-08-11 18:34:42 +02:00
|
|
|
}
|
|
|
|
|
2022-05-20 19:51:09 -04:00
|
|
|
pub(crate) struct ParsedExternalMod {
|
2023-01-30 15:39:22 +11:00
|
|
|
pub items: ThinVec<P<Item>>,
|
2022-03-03 18:45:25 -05:00
|
|
|
pub spans: ModSpans,
|
2021-02-22 18:58:45 +03:00
|
|
|
pub file_path: PathBuf,
|
|
|
|
pub dir_path: PathBuf,
|
2021-02-22 19:06:36 +03:00
|
|
|
pub dir_ownership: DirOwnership,
|
2021-02-22 18:58:45 +03:00
|
|
|
}
|
|
|
|
|
2021-02-22 21:22:40 +03:00
|
|
|
pub enum ModError<'a> {
|
|
|
|
CircularInclusion(Vec<PathBuf>),
|
|
|
|
ModInBlock(Option<Ident>),
|
2021-05-05 16:00:18 +08:00
|
|
|
FileNotFound(Ident, PathBuf, PathBuf),
|
2021-05-03 18:57:48 +08:00
|
|
|
MultipleCandidates(Ident, PathBuf, PathBuf),
|
2023-12-19 15:26:24 +11:00
|
|
|
ParserError(DiagnosticBuilder<'a>),
|
2021-02-22 21:22:40 +03:00
|
|
|
}
|
|
|
|
|
2022-05-20 19:51:09 -04:00
|
|
|
pub(crate) fn parse_external_mod(
|
2020-07-30 11:27:50 +10:00
|
|
|
sess: &Session,
|
2021-02-22 19:06:36 +03:00
|
|
|
ident: Ident,
|
2020-03-09 11:16:00 +01:00
|
|
|
span: Span, // The span to blame on errors.
|
2021-02-22 18:58:45 +03:00
|
|
|
module: &ModuleData,
|
2021-02-22 19:06:36 +03:00
|
|
|
mut dir_ownership: DirOwnership,
|
2022-08-17 12:34:33 +10:00
|
|
|
attrs: &mut AttrVec,
|
2021-02-22 18:58:45 +03:00
|
|
|
) -> ParsedExternalMod {
|
2020-03-08 13:36:20 +01:00
|
|
|
// We bail on the first error, but that error does not cause a fatal error... (1)
|
2021-02-22 21:22:40 +03:00
|
|
|
let result: Result<_, ModError<'_>> = try {
|
2020-03-08 13:36:20 +01:00
|
|
|
// Extract the file path and the new ownership.
|
2023-11-21 20:07:32 +01:00
|
|
|
let mp = mod_file_path(sess, ident, attrs, &module.dir_path, dir_ownership)?;
|
2021-02-22 19:06:36 +03:00
|
|
|
dir_ownership = mp.dir_ownership;
|
2020-03-08 13:36:20 +01:00
|
|
|
|
|
|
|
// Ensure file paths are acyclic.
|
2021-02-22 21:22:40 +03:00
|
|
|
if let Some(pos) = module.file_path_stack.iter().position(|p| p == &mp.file_path) {
|
|
|
|
Err(ModError::CircularInclusion(module.file_path_stack[pos..].to_vec()))?;
|
|
|
|
}
|
2020-03-08 13:36:20 +01:00
|
|
|
|
2020-03-21 22:51:03 +01:00
|
|
|
// Actually parse the external file as a module.
|
2021-02-22 19:06:36 +03:00
|
|
|
let mut parser = new_parser_from_file(&sess.parse_sess, &mp.file_path, Some(span));
|
2022-08-17 12:34:33 +10:00
|
|
|
let (inner_attrs, items, inner_span) =
|
2021-02-22 21:22:40 +03:00
|
|
|
parser.parse_mod(&token::Eof).map_err(|err| ModError::ParserError(err))?;
|
2022-08-17 12:34:33 +10:00
|
|
|
attrs.extend(inner_attrs);
|
2021-02-22 19:06:36 +03:00
|
|
|
(items, inner_span, mp.file_path)
|
2020-03-08 13:36:20 +01:00
|
|
|
};
|
|
|
|
// (1) ...instead, we return a dummy module.
|
2022-03-03 18:45:25 -05:00
|
|
|
let (items, spans, file_path) =
|
2021-02-22 21:22:40 +03:00
|
|
|
result.map_err(|err| err.report(sess, span)).unwrap_or_default();
|
2020-03-08 13:36:20 +01:00
|
|
|
|
2021-02-22 18:42:57 +03:00
|
|
|
// Extract the directory path for submodules of the module.
|
2021-02-22 18:58:45 +03:00
|
|
|
let dir_path = file_path.parent().unwrap_or(&file_path).to_owned();
|
2020-03-08 13:36:20 +01:00
|
|
|
|
2022-03-03 18:45:25 -05:00
|
|
|
ParsedExternalMod { items, spans, file_path, dir_path, dir_ownership }
|
2020-03-08 09:54:19 +01:00
|
|
|
}
|
2020-03-07 19:53:25 +01:00
|
|
|
|
2022-05-20 19:51:09 -04:00
|
|
|
pub(crate) fn mod_dir_path(
|
2020-07-30 11:27:50 +10:00
|
|
|
sess: &Session,
|
2021-02-22 19:06:36 +03:00
|
|
|
ident: Ident,
|
2020-03-08 09:54:19 +01:00
|
|
|
attrs: &[Attribute],
|
2021-02-22 18:58:45 +03:00
|
|
|
module: &ModuleData,
|
2021-02-22 19:06:36 +03:00
|
|
|
mut dir_ownership: DirOwnership,
|
2021-02-21 16:32:38 +03:00
|
|
|
inline: Inline,
|
2021-02-22 19:06:36 +03:00
|
|
|
) -> (PathBuf, DirOwnership) {
|
2021-02-21 16:32:38 +03:00
|
|
|
match inline {
|
2021-08-16 17:29:49 +02:00
|
|
|
Inline::Yes
|
|
|
|
if let Some(file_path) = mod_file_path_from_attr(sess, attrs, &module.dir_path) =>
|
|
|
|
{
|
|
|
|
// For inline modules file path from `#[path]` is actually the directory path
|
|
|
|
// for historical reasons, so we don't pop the last segment here.
|
|
|
|
(file_path, DirOwnership::Owned { relative: None })
|
|
|
|
}
|
2021-02-21 16:32:38 +03:00
|
|
|
Inline::Yes => {
|
|
|
|
// We have to push on the current module name in the case of relative
|
|
|
|
// paths in order to ensure that any additional module paths from inline
|
|
|
|
// `mod x { ... }` come after the relative extension.
|
|
|
|
//
|
|
|
|
// For example, a `mod z { ... }` inside `x/y.rs` should set the current
|
|
|
|
// directory path to `/x/y/z`, not `/x/z` with a relative offset of `y`.
|
|
|
|
let mut dir_path = module.dir_path.clone();
|
|
|
|
if let DirOwnership::Owned { relative } = &mut dir_ownership {
|
|
|
|
if let Some(ident) = relative.take() {
|
|
|
|
// Remove the relative offset.
|
2021-12-15 16:13:11 +11:00
|
|
|
dir_path.push(ident.as_str());
|
2021-02-21 16:32:38 +03:00
|
|
|
}
|
|
|
|
}
|
2021-12-15 16:13:11 +11:00
|
|
|
dir_path.push(ident.as_str());
|
2021-02-21 16:32:38 +03:00
|
|
|
|
|
|
|
(dir_path, dir_ownership)
|
2019-08-11 18:34:42 +02:00
|
|
|
}
|
2021-02-21 16:32:38 +03:00
|
|
|
Inline::No => {
|
|
|
|
// FIXME: This is a subset of `parse_external_mod` without actual parsing,
|
|
|
|
// check whether the logic for unloaded, loaded and inline modules can be unified.
|
2023-11-21 20:07:32 +01:00
|
|
|
let file_path = mod_file_path(sess, ident, attrs, &module.dir_path, dir_ownership)
|
2021-02-21 16:32:38 +03:00
|
|
|
.map(|mp| {
|
|
|
|
dir_ownership = mp.dir_ownership;
|
|
|
|
mp.file_path
|
|
|
|
})
|
|
|
|
.unwrap_or_default();
|
2021-02-22 18:58:45 +03:00
|
|
|
|
2021-02-21 16:32:38 +03:00
|
|
|
// Extract the directory path for submodules of the module.
|
|
|
|
let dir_path = file_path.parent().unwrap_or(&file_path).to_owned();
|
|
|
|
|
|
|
|
(dir_path, dir_ownership)
|
|
|
|
}
|
|
|
|
}
|
2019-08-11 18:34:42 +02:00
|
|
|
}
|
2020-03-08 09:28:46 +01:00
|
|
|
|
2021-02-22 19:06:36 +03:00
|
|
|
fn mod_file_path<'a>(
|
2020-07-30 11:27:50 +10:00
|
|
|
sess: &'a Session,
|
2021-02-22 19:06:36 +03:00
|
|
|
ident: Ident,
|
2020-03-08 12:19:27 +01:00
|
|
|
attrs: &[Attribute],
|
2020-03-08 09:28:46 +01:00
|
|
|
dir_path: &Path,
|
2021-02-22 19:06:36 +03:00
|
|
|
dir_ownership: DirOwnership,
|
2021-02-22 21:22:40 +03:00
|
|
|
) -> Result<ModulePathSuccess, ModError<'a>> {
|
2021-02-22 19:06:36 +03:00
|
|
|
if let Some(file_path) = mod_file_path_from_attr(sess, attrs, dir_path) {
|
2021-02-22 16:12:11 +03:00
|
|
|
// All `#[path]` files are treated as though they are a `mod.rs` file.
|
|
|
|
// This means that `mod foo;` declarations inside `#[path]`-included
|
|
|
|
// files are siblings,
|
|
|
|
//
|
|
|
|
// Note that this will produce weirdness when a file named `foo.rs` is
|
|
|
|
// `#[path]` included and contains a `mod foo;` declaration.
|
|
|
|
// If you encounter this, it's your own darn fault :P
|
2021-02-22 19:06:36 +03:00
|
|
|
let dir_ownership = DirOwnership::Owned { relative: None };
|
|
|
|
return Ok(ModulePathSuccess { file_path, dir_ownership });
|
2020-03-08 09:28:46 +01:00
|
|
|
}
|
|
|
|
|
2021-02-22 19:06:36 +03:00
|
|
|
let relative = match dir_ownership {
|
|
|
|
DirOwnership::Owned { relative } => relative,
|
|
|
|
DirOwnership::UnownedViaBlock => None,
|
2020-03-08 09:28:46 +01:00
|
|
|
};
|
2021-02-22 21:22:40 +03:00
|
|
|
let result = default_submod_path(&sess.parse_sess, ident, relative, dir_path);
|
2021-02-22 19:06:36 +03:00
|
|
|
match dir_ownership {
|
2021-02-22 21:22:40 +03:00
|
|
|
DirOwnership::Owned { .. } => result,
|
|
|
|
DirOwnership::UnownedViaBlock => Err(ModError::ModInBlock(match result {
|
|
|
|
Ok(_) | Err(ModError::MultipleCandidates(..)) => Some(ident),
|
|
|
|
_ => None,
|
|
|
|
})),
|
2020-03-08 09:28:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Derive a submodule path from the first found `#[path = "path_string"]`.
|
|
|
|
/// The provided `dir_path` is joined with the `path_string`.
|
2021-02-22 19:06:36 +03:00
|
|
|
fn mod_file_path_from_attr(
|
2020-07-30 11:27:50 +10:00
|
|
|
sess: &Session,
|
|
|
|
attrs: &[Attribute],
|
|
|
|
dir_path: &Path,
|
|
|
|
) -> Option<PathBuf> {
|
2020-03-08 09:28:46 +01:00
|
|
|
// Extract path string from first `#[path = "path_string"]` attribute.
|
2021-09-17 13:08:56 -07:00
|
|
|
let first_path = attrs.iter().find(|at| at.has_name(sym::path))?;
|
2022-02-19 00:48:49 +01:00
|
|
|
let Some(path_sym) = first_path.value_str() else {
|
|
|
|
// This check is here mainly to catch attempting to use a macro,
|
|
|
|
// such as #[path = concat!(...)]. This isn't currently supported
|
|
|
|
// because otherwise the InvocationCollector would need to defer
|
|
|
|
// loading a module until the #[path] attribute was expanded, and
|
|
|
|
// it doesn't support that (and would likely add a bit of
|
|
|
|
// complexity). Usually bad forms are checked in AstValidator (via
|
|
|
|
// `check_builtin_attribute`), but by the time that runs the macro
|
|
|
|
// is expanded, and it doesn't give an error.
|
|
|
|
validate_attr::emit_fatal_malformed_builtin_attribute(
|
|
|
|
&sess.parse_sess,
|
|
|
|
first_path,
|
|
|
|
sym::path,
|
|
|
|
);
|
2021-09-17 13:08:56 -07:00
|
|
|
};
|
2020-03-08 09:28:46 +01:00
|
|
|
|
2021-12-15 08:32:21 +11:00
|
|
|
let path_str = path_sym.as_str();
|
|
|
|
|
2020-03-08 09:28:46 +01:00
|
|
|
// On windows, the base path might have the form
|
|
|
|
// `\\?\foo\bar` in which case it does not tolerate
|
|
|
|
// mixed `/` and `\` separators, so canonicalize
|
|
|
|
// `/` to `\`.
|
|
|
|
#[cfg(windows)]
|
2021-12-15 08:32:21 +11:00
|
|
|
let path_str = path_str.replace("/", "\\");
|
2020-03-08 09:28:46 +01:00
|
|
|
|
2021-12-15 08:32:21 +11:00
|
|
|
Some(dir_path.join(path_str))
|
2020-03-08 09:28:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns a path to a module.
|
|
|
|
// Public for rustfmt usage.
|
|
|
|
pub fn default_submod_path<'a>(
|
|
|
|
sess: &'a ParseSess,
|
2021-02-22 19:06:36 +03:00
|
|
|
ident: Ident,
|
2020-04-19 13:00:18 +02:00
|
|
|
relative: Option<Ident>,
|
2020-03-08 09:28:46 +01:00
|
|
|
dir_path: &Path,
|
2021-02-22 21:22:40 +03:00
|
|
|
) -> Result<ModulePathSuccess, ModError<'a>> {
|
2020-03-08 09:28:46 +01:00
|
|
|
// If we're in a foo.rs file instead of a mod.rs file,
|
|
|
|
// we need to look for submodules in
|
2021-02-22 19:06:36 +03:00
|
|
|
// `./foo/<ident>.rs` and `./foo/<ident>/mod.rs` rather than
|
|
|
|
// `./<ident>.rs` and `./<ident>/mod.rs`.
|
2020-03-08 09:28:46 +01:00
|
|
|
let relative_prefix_string;
|
|
|
|
let relative_prefix = if let Some(ident) = relative {
|
|
|
|
relative_prefix_string = format!("{}{}", ident.name, path::MAIN_SEPARATOR);
|
|
|
|
&relative_prefix_string
|
|
|
|
} else {
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
2022-07-17 04:09:20 +09:00
|
|
|
let default_path_str = format!("{}{}.rs", relative_prefix, ident.name);
|
2020-03-08 09:28:46 +01:00
|
|
|
let secondary_path_str =
|
2022-07-17 04:09:20 +09:00
|
|
|
format!("{}{}{}mod.rs", relative_prefix, ident.name, path::MAIN_SEPARATOR);
|
2020-03-08 09:28:46 +01:00
|
|
|
let default_path = dir_path.join(&default_path_str);
|
|
|
|
let secondary_path = dir_path.join(&secondary_path_str);
|
|
|
|
let default_exists = sess.source_map().file_exists(&default_path);
|
|
|
|
let secondary_exists = sess.source_map().file_exists(&secondary_path);
|
|
|
|
|
2021-02-22 21:22:40 +03:00
|
|
|
match (default_exists, secondary_exists) {
|
2020-03-08 09:28:46 +01:00
|
|
|
(true, false) => Ok(ModulePathSuccess {
|
2021-02-22 19:06:36 +03:00
|
|
|
file_path: default_path,
|
|
|
|
dir_ownership: DirOwnership::Owned { relative: Some(ident) },
|
2020-03-08 09:28:46 +01:00
|
|
|
}),
|
|
|
|
(false, true) => Ok(ModulePathSuccess {
|
2021-02-22 19:06:36 +03:00
|
|
|
file_path: secondary_path,
|
|
|
|
dir_ownership: DirOwnership::Owned { relative: None },
|
2020-03-08 09:28:46 +01:00
|
|
|
}),
|
2021-05-05 16:00:18 +08:00
|
|
|
(false, false) => Err(ModError::FileNotFound(ident, default_path, secondary_path)),
|
2021-05-03 18:57:48 +08:00
|
|
|
(true, true) => Err(ModError::MultipleCandidates(ident, default_path, secondary_path)),
|
2021-02-22 21:22:40 +03:00
|
|
|
}
|
|
|
|
}
|
2020-03-08 09:28:46 +01:00
|
|
|
|
2021-02-22 21:22:40 +03:00
|
|
|
impl ModError<'_> {
|
2022-01-23 12:34:26 -06:00
|
|
|
fn report(self, sess: &Session, span: Span) -> ErrorGuaranteed {
|
2021-02-22 21:22:40 +03:00
|
|
|
match self {
|
|
|
|
ModError::CircularInclusion(file_paths) => {
|
2022-11-15 14:24:33 +01:00
|
|
|
let path_to_string = |path: &PathBuf| path.display().to_string();
|
|
|
|
|
|
|
|
let paths = file_paths
|
|
|
|
.iter()
|
|
|
|
.map(path_to_string)
|
|
|
|
.chain(once(path_to_string(&file_paths[0])))
|
|
|
|
.collect::<Vec<_>>();
|
|
|
|
|
|
|
|
let modules = paths.join(" -> ");
|
|
|
|
|
2023-12-18 22:21:37 +11:00
|
|
|
sess.dcx().emit_err(ModuleCircular { span, modules })
|
2021-02-22 21:22:40 +03:00
|
|
|
}
|
2023-12-18 22:21:37 +11:00
|
|
|
ModError::ModInBlock(ident) => sess.dcx().emit_err(ModuleInBlock {
|
2022-11-15 14:24:33 +01:00
|
|
|
span,
|
|
|
|
name: ident.map(|name| ModuleInBlockName { span, name }),
|
|
|
|
}),
|
|
|
|
ModError::FileNotFound(name, default_path, secondary_path) => {
|
2023-12-18 22:21:37 +11:00
|
|
|
sess.dcx().emit_err(ModuleFileNotFound {
|
2021-02-22 21:22:40 +03:00
|
|
|
span,
|
2022-11-15 14:24:33 +01:00
|
|
|
name,
|
|
|
|
default_path: default_path.display().to_string(),
|
|
|
|
secondary_path: secondary_path.display().to_string(),
|
|
|
|
})
|
2021-02-22 21:22:40 +03:00
|
|
|
}
|
2022-11-15 14:24:33 +01:00
|
|
|
ModError::MultipleCandidates(name, default_path, secondary_path) => {
|
2023-12-18 22:21:37 +11:00
|
|
|
sess.dcx().emit_err(ModuleMultipleCandidates {
|
2021-02-22 21:22:40 +03:00
|
|
|
span,
|
2022-11-15 14:24:33 +01:00
|
|
|
name,
|
|
|
|
default_path: default_path.display().to_string(),
|
|
|
|
secondary_path: secondary_path.display().to_string(),
|
|
|
|
})
|
2021-02-22 21:22:40 +03:00
|
|
|
}
|
Make `DiagnosticBuilder::emit` consuming.
This works for most of its call sites. This is nice, because `emit` very
much makes sense as a consuming operation -- indeed,
`DiagnosticBuilderState` exists to ensure no diagnostic is emitted
twice, but it uses runtime checks.
For the small number of call sites where a consuming emit doesn't work,
the commit adds `DiagnosticBuilder::emit_without_consuming`. (This will
be removed in subsequent commits.)
Likewise, `emit_unless` becomes consuming. And `delay_as_bug` becomes
consuming, while `delay_as_bug_without_consuming` is added (which will
also be removed in subsequent commits.)
All this requires significant changes to `DiagnosticBuilder`'s chaining
methods. Currently `DiagnosticBuilder` method chaining uses a
non-consuming `&mut self -> &mut Self` style, which allows chaining to
be used when the chain ends in `emit()`, like so:
```
struct_err(msg).span(span).emit();
```
But it doesn't work when producing a `DiagnosticBuilder` value,
requiring this:
```
let mut err = self.struct_err(msg);
err.span(span);
err
```
This style of chaining won't work with consuming `emit` though. For
that, we need to use to a `self -> Self` style. That also would allow
`DiagnosticBuilder` production to be chained, e.g.:
```
self.struct_err(msg).span(span)
```
However, removing the `&mut self -> &mut Self` style would require that
individual modifications of a `DiagnosticBuilder` go from this:
```
err.span(span);
```
to this:
```
err = err.span(span);
```
There are *many* such places. I have a high tolerance for tedious
refactorings, but even I gave up after a long time trying to convert
them all.
Instead, this commit has it both ways: the existing `&mut self -> Self`
chaining methods are kept, and new `self -> Self` chaining methods are
added, all of which have a `_mv` suffix (short for "move"). Changes to
the existing `forward!` macro lets this happen with very little
additional boilerplate code. I chose to add the suffix to the new
chaining methods rather than the existing ones, because the number of
changes required is much smaller that way.
This doubled chainging is a bit clumsy, but I think it is worthwhile
because it allows a *lot* of good things to subsequently happen. In this
commit, there are many `mut` qualifiers removed in places where
diagnostics are emitted without being modified. In subsequent commits:
- chaining can be used more, making the code more concise;
- more use of chaining also permits the removal of redundant diagnostic
APIs like `struct_err_with_code`, which can be replaced easily with
`struct_err` + `code_mv`;
- `emit_without_diagnostic` can be removed, which simplifies a lot of
machinery, removing the need for `DiagnosticBuilderState`.
2024-01-03 12:17:35 +11:00
|
|
|
ModError::ParserError(err) => err.emit(),
|
2022-11-15 14:24:33 +01:00
|
|
|
}
|
2021-02-22 21:22:40 +03:00
|
|
|
}
|
2020-03-08 09:28:46 +01:00
|
|
|
}
|