Improve comments
This commit is contained in:
parent
c80c34867f
commit
45fd5e697f
@ -421,15 +421,15 @@ impl DefCollector<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// When the fixed-point loop reaches a stable state, we might still have some unresolved
|
/// When the fixed-point loop reaches a stable state, we might still have
|
||||||
/// attributes (or unexpanded attribute proc macros) left over. This takes one of them, and
|
/// some unresolved attributes left over. This takes one of them, and feeds
|
||||||
/// feeds the item it's applied to back into name resolution.
|
/// the item it's applied to back into name resolution.
|
||||||
///
|
///
|
||||||
/// This effectively ignores the fact that the macro is there and just treats the items as
|
/// This effectively ignores the fact that the macro is there and just treats the items as
|
||||||
/// normal code.
|
/// normal code.
|
||||||
///
|
///
|
||||||
/// This improves UX when proc macros are turned off or don't work, and replicates the behavior
|
/// This improves UX for unresolved attributes, and replicates the
|
||||||
/// before we supported proc. attribute macros.
|
/// behavior before we supported proc. attribute macros.
|
||||||
fn reseed_with_unresolved_attribute(&mut self) -> ReachedFixedPoint {
|
fn reseed_with_unresolved_attribute(&mut self) -> ReachedFixedPoint {
|
||||||
cov_mark::hit!(unresolved_attribute_fallback);
|
cov_mark::hit!(unresolved_attribute_fallback);
|
||||||
|
|
||||||
@ -1229,6 +1229,7 @@ impl DefCollector<'_> {
|
|||||||
);
|
);
|
||||||
let loc: MacroCallLoc = self.db.lookup_intern_macro_call(call_id);
|
let loc: MacroCallLoc = self.db.lookup_intern_macro_call(call_id);
|
||||||
|
|
||||||
|
// If proc attribute macro expansion is disabled, skip expanding it here
|
||||||
if !self.db.enable_proc_attr_macros() {
|
if !self.db.enable_proc_attr_macros() {
|
||||||
self.def_map.diagnostics.push(DefDiagnostic::unresolved_proc_macro(
|
self.def_map.diagnostics.push(DefDiagnostic::unresolved_proc_macro(
|
||||||
directive.module_id,
|
directive.module_id,
|
||||||
@ -1250,8 +1251,10 @@ impl DefCollector<'_> {
|
|||||||
|
|
||||||
if let MacroDefKind::ProcMacro(exp, ..) = loc.def.kind {
|
if let MacroDefKind::ProcMacro(exp, ..) = loc.def.kind {
|
||||||
if exp.is_dummy() {
|
if exp.is_dummy() {
|
||||||
// Proc macros that cannot be expanded are treated as not
|
// If there's no expander for the proc macro (e.g.
|
||||||
// resolved, in order to fall back later.
|
// because proc macros are disabled, or building the
|
||||||
|
// proc macro crate failed), report this and skip
|
||||||
|
// expansion like we would if it was disabled
|
||||||
self.def_map.diagnostics.push(DefDiagnostic::unresolved_proc_macro(
|
self.def_map.diagnostics.push(DefDiagnostic::unresolved_proc_macro(
|
||||||
directive.module_id,
|
directive.module_id,
|
||||||
loc.kind,
|
loc.kind,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user