mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
internal: Compute syntax validation errors on demand
This commit is contained in:
parent
4303e741de
commit
c3c9f5ffe1
11 changed files with 45 additions and 44 deletions
|
@ -303,7 +303,7 @@ fn parse_macro_expansion_error(
|
|||
macro_call_id: MacroCallId,
|
||||
) -> ExpandResult<Box<[SyntaxError]>> {
|
||||
db.parse_macro_expansion(MacroFileId { macro_call_id })
|
||||
.map(|it| it.0.errors().to_vec().into_boxed_slice())
|
||||
.map(|it| it.0.errors().into_boxed_slice())
|
||||
}
|
||||
|
||||
pub(crate) fn parse_with_map(
|
||||
|
@ -445,7 +445,7 @@ fn macro_arg(
|
|||
|
||||
if matches!(loc.def.kind, MacroDefKind::BuiltInEager(..)) {
|
||||
match parse.errors() {
|
||||
[] => ValueResult::ok((Arc::new(tt), undo_info)),
|
||||
errors if errors.is_empty() => ValueResult::ok((Arc::new(tt), undo_info)),
|
||||
errors => ValueResult::new(
|
||||
(Arc::new(tt), undo_info),
|
||||
// Box::<[_]>::from(res.errors()), not stable yet
|
||||
|
|
|
@ -252,7 +252,7 @@ impl InFile<&SyntaxNode> {
|
|||
map_node_range_up(db, &db.expansion_span_map(file_id), self.value.text_range())?;
|
||||
|
||||
// FIXME: Figure out an API that makes proper use of ctx, this only exists to
|
||||
// keep pre-token map rewrite behaviour.
|
||||
// keep pre-token map rewrite behavior.
|
||||
if !ctx.is_root() {
|
||||
return None;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue