Skip to content

Commit 45fd5e6

Browse files
committed
Improve comments
1 parent c80c348 commit 45fd5e6

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

crates/hir-def/src/nameres/collector.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -421,15 +421,15 @@ impl DefCollector<'_> {
421421
}
422422
}
423423

424-
/// When the fixed-point loop reaches a stable state, we might still have some unresolved
425-
/// attributes (or unexpanded attribute proc macros) left over. This takes one of them, and
426-
/// feeds the item it's applied to back into name resolution.
424+
/// When the fixed-point loop reaches a stable state, we might still have
425+
/// some unresolved attributes left over. This takes one of them, and feeds
426+
/// the item it's applied to back into name resolution.
427427
///
428428
/// This effectively ignores the fact that the macro is there and just treats the items as
429429
/// normal code.
430430
///
431-
/// This improves UX when proc macros are turned off or don't work, and replicates the behavior
432-
/// before we supported proc. attribute macros.
431+
/// This improves UX for unresolved attributes, and replicates the
432+
/// behavior before we supported proc. attribute macros.
433433
fn reseed_with_unresolved_attribute(&mut self) -> ReachedFixedPoint {
434434
cov_mark::hit!(unresolved_attribute_fallback);
435435

@@ -1229,6 +1229,7 @@ impl DefCollector<'_> {
12291229
);
12301230
let loc: MacroCallLoc = self.db.lookup_intern_macro_call(call_id);
12311231

1232+
// If proc attribute macro expansion is disabled, skip expanding it here
12321233
if !self.db.enable_proc_attr_macros() {
12331234
self.def_map.diagnostics.push(DefDiagnostic::unresolved_proc_macro(
12341235
directive.module_id,
@@ -1250,8 +1251,10 @@ impl DefCollector<'_> {
12501251

12511252
if let MacroDefKind::ProcMacro(exp, ..) = loc.def.kind {
12521253
if exp.is_dummy() {
1253-
// Proc macros that cannot be expanded are treated as not
1254-
// resolved, in order to fall back later.
1254+
// If there's no expander for the proc macro (e.g.
1255+
// because proc macros are disabled, or building the
1256+
// proc macro crate failed), report this and skip
1257+
// expansion like we would if it was disabled
12551258
self.def_map.diagnostics.push(DefDiagnostic::unresolved_proc_macro(
12561259
directive.module_id,
12571260
loc.kind,

0 commit comments

Comments
 (0)