resolve: derive diag for undetermined macro resolution
This commit is contained in:
parent
abfc6c4438
commit
7bad066f82
@ -58,6 +58,10 @@ resolve_cannot_determine_import_resolution =
|
|||||||
cannot determine resolution for the import
|
cannot determine resolution for the import
|
||||||
.note = import resolution is stuck, try simplifying other imports
|
.note = import resolution is stuck, try simplifying other imports
|
||||||
|
|
||||||
|
resolve_cannot_determine_macro_resolution =
|
||||||
|
cannot determine resolution for the {$kind} `{$path}`
|
||||||
|
.note = import resolution is stuck, try simplifying macro imports
|
||||||
|
|
||||||
resolve_cannot_find_ident_in_this_scope =
|
resolve_cannot_find_ident_in_this_scope =
|
||||||
cannot find {$expected} `{$ident}` in this scope
|
cannot find {$expected} `{$ident}` in this scope
|
||||||
|
|
||||||
|
@ -654,6 +654,16 @@ pub(crate) struct CannotDetermineImportResolution {
|
|||||||
pub(crate) span: Span,
|
pub(crate) span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(resolve_cannot_determine_macro_resolution)]
|
||||||
|
#[note]
|
||||||
|
pub(crate) struct CannotDetermineMacroResolution {
|
||||||
|
#[primary_span]
|
||||||
|
pub(crate) span: Span,
|
||||||
|
pub(crate) kind: &'static str,
|
||||||
|
pub(crate) path: String,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(resolve_cannot_be_reexported_private, code = "E0364")]
|
#[diag(resolve_cannot_be_reexported_private, code = "E0364")]
|
||||||
pub(crate) struct CannotBeReexportedPrivate {
|
pub(crate) struct CannotBeReexportedPrivate {
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
//! interface provided by `Resolver` to macro expander.
|
//! interface provided by `Resolver` to macro expander.
|
||||||
|
|
||||||
use crate::errors::{
|
use crate::errors::{
|
||||||
self, AddAsNonDerive, CannotFindIdentInThisScope, MacroExpectedFound, RemoveSurroundingDerive,
|
self, AddAsNonDerive, CannotDetermineMacroResolution, CannotFindIdentInThisScope,
|
||||||
|
MacroExpectedFound, RemoveSurroundingDerive,
|
||||||
};
|
};
|
||||||
use crate::Namespace::*;
|
use crate::Namespace::*;
|
||||||
use crate::{BuiltinMacroState, Determinacy};
|
use crate::{BuiltinMacroState, Determinacy};
|
||||||
@ -719,13 +720,11 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||||||
// even if speculative `resolve_path` returned nothing previously, so we skip this
|
// even if speculative `resolve_path` returned nothing previously, so we skip this
|
||||||
// less informative error if the privacy error is reported elsewhere.
|
// less informative error if the privacy error is reported elsewhere.
|
||||||
if this.privacy_errors.is_empty() {
|
if this.privacy_errors.is_empty() {
|
||||||
let msg = format!(
|
this.tcx.sess.emit_err(CannotDetermineMacroResolution {
|
||||||
"cannot determine resolution for the {} `{}`",
|
span,
|
||||||
kind.descr(),
|
kind: kind.descr(),
|
||||||
Segment::names_to_string(path)
|
path: Segment::names_to_string(path),
|
||||||
);
|
});
|
||||||
let msg_note = "import resolution is stuck, try simplifying macro imports";
|
|
||||||
this.tcx.sess.struct_span_err(span, msg).note(msg_note).emit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user