Tweak diagnostics
- Tweak lint message - Display multi-segment paths correctly
This commit is contained in:
parent
13884dc2af
commit
13076f90d2
5 changed files with 25 additions and 22 deletions
|
@ -597,11 +597,14 @@ impl CheckAttrVisitor<'tcx> {
|
||||||
hir_id,
|
hir_id,
|
||||||
i_meta.span,
|
i_meta.span,
|
||||||
|lint| {
|
|lint| {
|
||||||
lint.build(&format!(
|
let msg = if let Ok(snippet) =
|
||||||
"unknown `doc` attribute `{}`",
|
self.tcx.sess.source_map().span_to_snippet(i_meta.path.span)
|
||||||
i_meta.name_or_empty()
|
{
|
||||||
))
|
format!("unknown `doc` attribute `{}`", snippet,)
|
||||||
.emit();
|
} else {
|
||||||
|
String::from("unknown `doc` attribute")
|
||||||
|
};
|
||||||
|
lint.build(&msg).emit();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
is_valid = false;
|
is_valid = false;
|
||||||
|
@ -613,7 +616,7 @@ impl CheckAttrVisitor<'tcx> {
|
||||||
hir_id,
|
hir_id,
|
||||||
meta.span(),
|
meta.span(),
|
||||||
|lint| {
|
|lint| {
|
||||||
lint.build(&format!("unknown `doc` attribute")).emit();
|
lint.build(&format!("invalid `doc` attribute")).emit();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
is_valid = false;
|
is_valid = false;
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
pub fn foo() {}
|
pub fn foo() {}
|
||||||
|
|
||||||
#[doc(123)]
|
#[doc(123)]
|
||||||
//~^ ERROR unknown `doc` attribute
|
//~^ ERROR invalid `doc` attribute
|
||||||
//~| WARN
|
//~| WARN
|
||||||
#[doc("hello", "bar")]
|
#[doc("hello", "bar")]
|
||||||
//~^ ERROR unknown `doc` attribute
|
//~^ ERROR invalid `doc` attribute
|
||||||
//~| WARN
|
//~| WARN
|
||||||
//~| ERROR unknown `doc` attribute
|
//~| ERROR invalid `doc` attribute
|
||||||
//~| WARN
|
//~| WARN
|
||||||
#[doc(foo::bar, crate::bar::baz = "bye")]
|
#[doc(foo::bar, crate::bar::baz = "bye")]
|
||||||
//~^ ERROR unknown `doc` attribute
|
//~^ ERROR unknown `doc` attribute
|
||||||
|
|
|
@ -13,7 +13,7 @@ LL | #![deny(warnings)]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute
|
error: invalid `doc` attribute
|
||||||
--> $DIR/doc-attr.rs:12:7
|
--> $DIR/doc-attr.rs:12:7
|
||||||
|
|
|
|
||||||
LL | #[doc(123)]
|
LL | #[doc(123)]
|
||||||
|
@ -22,7 +22,7 @@ LL | #[doc(123)]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute
|
error: invalid `doc` attribute
|
||||||
--> $DIR/doc-attr.rs:15:7
|
--> $DIR/doc-attr.rs:15:7
|
||||||
|
|
|
|
||||||
LL | #[doc("hello", "bar")]
|
LL | #[doc("hello", "bar")]
|
||||||
|
@ -31,7 +31,7 @@ LL | #[doc("hello", "bar")]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute
|
error: invalid `doc` attribute
|
||||||
--> $DIR/doc-attr.rs:15:16
|
--> $DIR/doc-attr.rs:15:16
|
||||||
|
|
|
|
||||||
LL | #[doc("hello", "bar")]
|
LL | #[doc("hello", "bar")]
|
||||||
|
@ -40,7 +40,7 @@ LL | #[doc("hello", "bar")]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute ``
|
error: unknown `doc` attribute `foo::bar`
|
||||||
--> $DIR/doc-attr.rs:20:7
|
--> $DIR/doc-attr.rs:20:7
|
||||||
|
|
|
|
||||||
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
||||||
|
@ -49,7 +49,7 @@ LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute ``
|
error: unknown `doc` attribute `crate::bar::baz`
|
||||||
--> $DIR/doc-attr.rs:20:17
|
--> $DIR/doc-attr.rs:20:17
|
||||||
|
|
|
|
||||||
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
pub fn foo() {}
|
pub fn foo() {}
|
||||||
|
|
||||||
#[doc(123)]
|
#[doc(123)]
|
||||||
//~^ ERROR unknown `doc` attribute
|
//~^ ERROR invalid `doc` attribute
|
||||||
//~| WARN
|
//~| WARN
|
||||||
#[doc("hello", "bar")]
|
#[doc("hello", "bar")]
|
||||||
//~^ ERROR unknown `doc` attribute
|
//~^ ERROR invalid `doc` attribute
|
||||||
//~| WARN
|
//~| WARN
|
||||||
//~| ERROR unknown `doc` attribute
|
//~| ERROR invalid `doc` attribute
|
||||||
//~| WARN
|
//~| WARN
|
||||||
#[doc(foo::bar, crate::bar::baz = "bye")]
|
#[doc(foo::bar, crate::bar::baz = "bye")]
|
||||||
//~^ ERROR unknown `doc` attribute
|
//~^ ERROR unknown `doc` attribute
|
||||||
|
|
|
@ -13,7 +13,7 @@ LL | #![deny(warnings)]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute
|
error: invalid `doc` attribute
|
||||||
--> $DIR/doc-attr.rs:12:7
|
--> $DIR/doc-attr.rs:12:7
|
||||||
|
|
|
|
||||||
LL | #[doc(123)]
|
LL | #[doc(123)]
|
||||||
|
@ -22,7 +22,7 @@ LL | #[doc(123)]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute
|
error: invalid `doc` attribute
|
||||||
--> $DIR/doc-attr.rs:15:7
|
--> $DIR/doc-attr.rs:15:7
|
||||||
|
|
|
|
||||||
LL | #[doc("hello", "bar")]
|
LL | #[doc("hello", "bar")]
|
||||||
|
@ -31,7 +31,7 @@ LL | #[doc("hello", "bar")]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute
|
error: invalid `doc` attribute
|
||||||
--> $DIR/doc-attr.rs:15:16
|
--> $DIR/doc-attr.rs:15:16
|
||||||
|
|
|
|
||||||
LL | #[doc("hello", "bar")]
|
LL | #[doc("hello", "bar")]
|
||||||
|
@ -40,7 +40,7 @@ LL | #[doc("hello", "bar")]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute ``
|
error: unknown `doc` attribute `foo::bar`
|
||||||
--> $DIR/doc-attr.rs:20:7
|
--> $DIR/doc-attr.rs:20:7
|
||||||
|
|
|
|
||||||
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
||||||
|
@ -49,7 +49,7 @@ LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute ``
|
error: unknown `doc` attribute `crate::bar::baz`
|
||||||
--> $DIR/doc-attr.rs:20:17
|
--> $DIR/doc-attr.rs:20:17
|
||||||
|
|
|
|
||||||
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue