Skip to content

Commit bca1e5f

Browse files
Rename error_sink to diagnostic_sink
1 parent 883c8d1 commit bca1e5f

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

crates/hir_expand/src/eager.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ pub fn expand_eager_macro(
103103
macro_call: InFile<ast::MacroCall>,
104104
def: MacroDefId,
105105
resolver: &dyn Fn(ast::Path) -> Option<MacroDefId>,
106-
mut error_sink: &mut dyn FnMut(mbe::ExpandError),
106+
mut diagnostic_sink: &mut dyn FnMut(mbe::ExpandError),
107107
) -> Result<EagerMacroId, ErrorEmitted> {
108-
let parsed_args = error_sink.option_with(
108+
let parsed_args = diagnostic_sink.option_with(
109109
|| Some(mbe::ast_to_token_tree(&macro_call.value.token_tree()?)?.0),
110110
|| err("malformed macro invocation"),
111111
)?;
@@ -126,20 +126,21 @@ pub fn expand_eager_macro(
126126
let arg_file_id: MacroCallId = arg_id.into();
127127

128128
let parsed_args =
129-
error_sink.result(mbe::token_tree_to_syntax_node(&parsed_args, FragmentKind::Expr))?.0;
129+
diagnostic_sink.result(mbe::token_tree_to_syntax_node(&parsed_args, FragmentKind::Expr))?.0;
130130
let result = eager_macro_recur(
131131
db,
132132
InFile::new(arg_file_id.as_file(), parsed_args.syntax_node()),
133133
krate,
134134
resolver,
135-
error_sink,
135+
diagnostic_sink,
136136
)?;
137-
let subtree = error_sink.option(to_subtree(&result), || err("failed to parse macro result"))?;
137+
let subtree =
138+
diagnostic_sink.option(to_subtree(&result), || err("failed to parse macro result"))?;
138139

139140
if let MacroDefKind::BuiltInEager(eager) = def.kind {
140141
let res = eager.expand(db, arg_id, &subtree);
141142

142-
let (subtree, fragment) = error_sink.expand_result_option(res)?;
143+
let (subtree, fragment) = diagnostic_sink.expand_result_option(res)?;
143144
let eager = EagerCallLoc {
144145
def,
145146
fragment,
@@ -182,7 +183,7 @@ fn eager_macro_recur(
182183
curr: InFile<SyntaxNode>,
183184
krate: CrateId,
184185
macro_resolver: &dyn Fn(ast::Path) -> Option<MacroDefId>,
185-
mut error_sink: &mut dyn FnMut(mbe::ExpandError),
186+
mut diagnostic_sink: &mut dyn FnMut(mbe::ExpandError),
186187
) -> Result<SyntaxNode, ErrorEmitted> {
187188
let original = curr.value.clone();
188189

@@ -191,7 +192,7 @@ fn eager_macro_recur(
191192

192193
// Collect replacement
193194
for child in children {
194-
let def = error_sink
195+
let def = diagnostic_sink
195196
.option_with(|| macro_resolver(child.path()?), || err("failed to resolve macro"))?;
196197
let insert = match def.kind {
197198
MacroDefKind::BuiltInEager(_) => {
@@ -201,7 +202,7 @@ fn eager_macro_recur(
201202
curr.with_value(child.clone()),
202203
def,
203204
macro_resolver,
204-
error_sink,
205+
diagnostic_sink,
205206
)?
206207
.into();
207208
db.parse_or_expand(id.as_file())
@@ -212,10 +213,10 @@ fn eager_macro_recur(
212213
| MacroDefKind::BuiltInDerive(_)
213214
| MacroDefKind::ProcMacro(_) => {
214215
let res = lazy_expand(db, &def, curr.with_value(child.clone()), krate);
215-
let val = error_sink.expand_result_option(res)?;
216+
let val = diagnostic_sink.expand_result_option(res)?;
216217

217218
// replace macro inside
218-
eager_macro_recur(db, val, krate, macro_resolver, error_sink)?
219+
eager_macro_recur(db, val, krate, macro_resolver, diagnostic_sink)?
219220
}
220221
};
221222

0 commit comments

Comments
 (0)