Auto merge of #114452 - weiznich:feature/diagnostic_on_unimplemented, r=compiler-errors
`#[diagnostic::on_unimplemented]` without filters This commit adds support for a `#[diagnostic::on_unimplemented]` attribute with the following options: * `message` to customize the primary error message * `note` to add a customized note message to an error message * `label` to customize the label part of the error message The relevant behavior is specified in [RFC-3366](https://rust-lang.github.io/rfcs/3366-diagnostic-attribute-namespace.html)
This commit is contained in:
commit
327e6cf55c
18 changed files with 360 additions and 39 deletions
|
@ -26,7 +26,7 @@ use rustc_middle::middle::stability;
|
|||
use rustc_middle::ty::RegisteredTools;
|
||||
use rustc_middle::ty::{TyCtxt, Visibility};
|
||||
use rustc_session::lint::builtin::{
|
||||
LEGACY_DERIVE_HELPERS, SOFT_UNSTABLE, UNKNOWN_DIAGNOSTIC_ATTRIBUTES,
|
||||
LEGACY_DERIVE_HELPERS, SOFT_UNSTABLE, UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
|
||||
};
|
||||
use rustc_session::lint::builtin::{UNUSED_MACROS, UNUSED_MACRO_RULES};
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
|
@ -610,9 +610,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
if res == Res::NonMacroAttr(NonMacroAttrKind::Tool)
|
||||
&& path.segments.len() >= 2
|
||||
&& path.segments[0].ident.name == sym::diagnostic
|
||||
&& path.segments[1].ident.name != sym::on_unimplemented
|
||||
{
|
||||
self.tcx.sess.parse_sess.buffer_lint(
|
||||
UNKNOWN_DIAGNOSTIC_ATTRIBUTES,
|
||||
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
|
||||
path.segments[1].span(),
|
||||
node_id,
|
||||
"unknown diagnostic attribute",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue