Fix ui tests

This commit is contained in:
Guillaume Gomez 2025-12-05 01:23:38 +01:00
parent aa3bf6fde9
commit 4936973d49
41 changed files with 730 additions and 321 deletions

View file

@ -10,7 +10,7 @@ use rustc_hir::lints::AttributeLintKind;
use rustc_span::{Span, Symbol, edition, sym};
use thin_vec::ThinVec;
use super::prelude::{Allow, AllowedTargets, MethodKind, Target};
use super::prelude::{Allow, AllowedTargets, Error, MethodKind, Target};
use super::{AcceptMapping, AttributeParser};
use crate::context::{AcceptContext, FinalizeContext, Stage};
use crate::fluent_generated as fluent;
@ -459,7 +459,9 @@ impl DocParser {
) {
match args {
ArgParser::NoArgs => {
todo!()
let suggestions = cx.suggestions();
let span = cx.attr_span;
cx.emit_lint(AttributeLintKind::IllFormedAttributeInput { suggestions }, span);
}
ArgParser::List(items) => {
for i in items.mixed() {
@ -493,12 +495,41 @@ impl DocParser {
impl<S: Stage> AttributeParser<S> for DocParser {
const ATTRIBUTES: AcceptMapping<Self, S> = &[(
&[sym::doc],
template!(List: &["hidden", "inline", "test"], NameValueStr: "string"),
template!(
List: &[
"alias",
"attribute",
"hidden",
"html_favicon_url",
"html_logo_url",
"html_no_source",
"html_playground_url",
"html_root_url",
"issue_tracker_base_url",
"inline",
"no_inline",
"masked",
"cfg",
"notable_trait",
"keyword",
"fake_variadic",
"search_unbox",
"rust_logo",
"auto_cfg",
"test",
"spotlight",
"include",
"no_default_passes",
"passes",
"plugins",
],
NameValueStr: "string"
),
|this, cx, args| {
this.accept_single_doc_attr(cx, args);
},
)];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[
Allow(Target::ExternCrate),
Allow(Target::Use),
Allow(Target::Static),
@ -527,6 +558,7 @@ impl<S: Stage> AttributeParser<S> for DocParser {
Allow(Target::ForeignTy),
Allow(Target::MacroDef),
Allow(Target::Crate),
Error(Target::WherePredicate),
]);
fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {

View file

@ -1,8 +1,8 @@
use std::borrow::Cow;
use rustc_ast as ast;
use rustc_ast::{AttrStyle, NodeId, Safety};
use rustc_ast::token::DocFragmentKind;
use rustc_ast::{AttrStyle, NodeId, Safety};
use rustc_errors::DiagCtxtHandle;
use rustc_feature::{AttributeTemplate, Features};
use rustc_hir::attrs::AttributeKind;
@ -357,7 +357,6 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
continue;
}
let path = parser.path();
for accept in accepts {
let mut cx: AcceptContext<'_, 'sess, S> = AcceptContext {
shared: SharedContext {

View file

@ -2177,7 +2177,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
continue;
}
if attr.is_doc_comment() {
if attr.doc_str_and_fragment_kind().is_some() {
self.cx.sess.psess.buffer_lint(
UNUSED_DOC_COMMENTS,
current_span,

View file

@ -813,19 +813,23 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &
let mut sugared_span: Option<Span> = None;
while let Some(attr) = attrs.next() {
let is_doc_comment = attr.is_doc_comment();
let (is_doc_comment, is_doc_attribute) = match &attr.kind {
AttrKind::DocComment(..) => (true, false),
AttrKind::Normal(normal) if normal.item.path == sym::doc => (true, true),
_ => (false, false),
};
if is_doc_comment {
sugared_span =
Some(sugared_span.map_or(attr.span, |span| span.with_hi(attr.span.hi())));
}
if attrs.peek().is_some_and(|next_attr| next_attr.is_doc_comment()) {
if !is_doc_attribute && attrs.peek().is_some_and(|next_attr| next_attr.is_doc_comment()) {
continue;
}
let span = sugared_span.take().unwrap_or(attr.span);
if is_doc_comment {
if is_doc_comment || is_doc_attribute {
let sub = match attr.kind {
AttrKind::DocComment(CommentKind::Line, _) | AttrKind::Normal(..) => {
BuiltinUnusedDocCommentSub::PlainHelp

View file

@ -1029,25 +1029,27 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
}
}
if let Some((_, span)) = keyword {
self.check_attr_not_crate_level(*span, hir_id, "keyword");
if let Some((_, span)) = keyword
&& self.check_attr_not_crate_level(*span, hir_id, "keyword")
{
self.check_doc_keyword_and_attribute(*span, hir_id, "keyword");
}
if let Some((_, span)) = attribute {
self.check_attr_not_crate_level(*span, hir_id, "attribute");
if let Some((_, span)) = attribute
&& self.check_attr_not_crate_level(*span, hir_id, "attribute")
{
self.check_doc_keyword_and_attribute(*span, hir_id, "attribute");
}
if let Some(span) = fake_variadic {
if self.check_attr_not_crate_level(*span, hir_id, "fake_variadic") {
self.check_doc_fake_variadic(*span, hir_id);
}
if let Some(span) = fake_variadic
&& self.check_attr_not_crate_level(*span, hir_id, "fake_variadic")
{
self.check_doc_fake_variadic(*span, hir_id);
}
if let Some(span) = search_unbox {
if self.check_attr_not_crate_level(*span, hir_id, "search_unbox") {
self.check_doc_search_unbox(*span, hir_id);
}
if let Some(span) = search_unbox
&& self.check_attr_not_crate_level(*span, hir_id, "search_unbox")
{
self.check_doc_search_unbox(*span, hir_id);
}
for i in [
@ -1070,18 +1072,17 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
self.check_doc_inline(hir_id, target, inline);
if let Some(span) = rust_logo {
if self.check_attr_crate_level(*span, hir_id)
&& !self.tcx.features().rustdoc_internals()
{
feature_err(
&self.tcx.sess,
sym::rustdoc_internals,
*span,
fluent::passes_doc_rust_logo,
)
.emit();
}
if let Some(span) = rust_logo
&& self.check_attr_crate_level(*span, hir_id)
&& !self.tcx.features().rustdoc_internals()
{
feature_err(
&self.tcx.sess,
sym::rustdoc_internals,
*span,
fluent::passes_doc_rust_logo,
)
.emit();
}
if let Some(span) = masked {
@ -1984,7 +1985,14 @@ impl<'tcx> Visitor<'tcx> for CheckAttrVisitor<'tcx> {
.hir_attrs(where_predicate.hir_id)
.iter()
.filter(|attr| !ATTRS_ALLOWED.iter().any(|&sym| attr.has_name(sym)))
.filter(|attr| !attr.is_parsed_attr())
// FIXME: We shouldn't need to special-case `doc`!
.filter(|attr| {
matches!(
attr,
Attribute::Parsed(AttributeKind::DocComment { .. } | AttributeKind::Doc(_))
| Attribute::Unparsed(_)
)
})
.map(|attr| attr.span())
.collect::<Vec<_>>();
if !spans.is_empty() {

View file

@ -12,14 +12,15 @@ LL - #![doc(html_favicon_url)]
LL + #![doc = "string"]
|
LL - #![doc(html_favicon_url)]
LL + #![doc(hidden)]
LL + #![doc(alias)]
|
LL - #![doc(html_favicon_url)]
LL + #![doc(inline)]
LL + #![doc(attribute)]
|
LL - #![doc(html_favicon_url)]
LL + #![doc(test)]
LL + #![doc(auto_cfg)]
|
= and 21 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/bad-render-options.rs:6:1
@ -35,14 +36,15 @@ LL - #![doc(html_logo_url)]
LL + #![doc = "string"]
|
LL - #![doc(html_logo_url)]
LL + #![doc(hidden)]
LL + #![doc(alias)]
|
LL - #![doc(html_logo_url)]
LL + #![doc(inline)]
LL + #![doc(attribute)]
|
LL - #![doc(html_logo_url)]
LL + #![doc(test)]
LL + #![doc(auto_cfg)]
|
= and 21 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/bad-render-options.rs:9:1
@ -58,14 +60,15 @@ LL - #![doc(html_playground_url)]
LL + #![doc = "string"]
|
LL - #![doc(html_playground_url)]
LL + #![doc(hidden)]
LL + #![doc(alias)]
|
LL - #![doc(html_playground_url)]
LL + #![doc(inline)]
LL + #![doc(attribute)]
|
LL - #![doc(html_playground_url)]
LL + #![doc(test)]
LL + #![doc(auto_cfg)]
|
= and 21 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/bad-render-options.rs:12:1
@ -81,14 +84,15 @@ LL - #![doc(issue_tracker_base_url)]
LL + #![doc = "string"]
|
LL - #![doc(issue_tracker_base_url)]
LL + #![doc(hidden)]
LL + #![doc(alias)]
|
LL - #![doc(issue_tracker_base_url)]
LL + #![doc(inline)]
LL + #![doc(attribute)]
|
LL - #![doc(issue_tracker_base_url)]
LL + #![doc(test)]
LL + #![doc(auto_cfg)]
|
= and 21 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/bad-render-options.rs:15:1
@ -104,14 +108,15 @@ LL - #![doc(html_favicon_url = 1)]
LL + #![doc = "string"]
|
LL - #![doc(html_favicon_url = 1)]
LL + #![doc(hidden)]
LL + #![doc(alias)]
|
LL - #![doc(html_favicon_url = 1)]
LL + #![doc(inline)]
LL + #![doc(attribute)]
|
LL - #![doc(html_favicon_url = 1)]
LL + #![doc(test)]
LL + #![doc(auto_cfg)]
|
= and 22 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/bad-render-options.rs:18:1
@ -127,14 +132,15 @@ LL - #![doc(html_logo_url = 2)]
LL + #![doc = "string"]
|
LL - #![doc(html_logo_url = 2)]
LL + #![doc(hidden)]
LL + #![doc(alias)]
|
LL - #![doc(html_logo_url = 2)]
LL + #![doc(inline)]
LL + #![doc(attribute)]
|
LL - #![doc(html_logo_url = 2)]
LL + #![doc(test)]
LL + #![doc(auto_cfg)]
|
= and 22 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/bad-render-options.rs:21:1
@ -150,14 +156,15 @@ LL - #![doc(html_playground_url = 3)]
LL + #![doc = "string"]
|
LL - #![doc(html_playground_url = 3)]
LL + #![doc(hidden)]
LL + #![doc(alias)]
|
LL - #![doc(html_playground_url = 3)]
LL + #![doc(inline)]
LL + #![doc(attribute)]
|
LL - #![doc(html_playground_url = 3)]
LL + #![doc(test)]
LL + #![doc(auto_cfg)]
|
= and 22 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/bad-render-options.rs:24:1
@ -173,14 +180,15 @@ LL - #![doc(issue_tracker_base_url = 4)]
LL + #![doc = "string"]
|
LL - #![doc(issue_tracker_base_url = 4)]
LL + #![doc(hidden)]
LL + #![doc(alias)]
|
LL - #![doc(issue_tracker_base_url = 4)]
LL + #![doc(inline)]
LL + #![doc(attribute)]
|
LL - #![doc(issue_tracker_base_url = 4)]
LL + #![doc(test)]
LL + #![doc(auto_cfg)]
|
= and 22 other candidates
error[E0565]: malformed `doc` attribute input
--> $DIR/bad-render-options.rs:27:1
@ -196,14 +204,15 @@ LL - #![doc(html_no_source = "asdf")]
LL + #![doc = "string"]
|
LL - #![doc(html_no_source = "asdf")]
LL + #![doc(hidden)]
LL + #![doc(alias)]
|
LL - #![doc(html_no_source = "asdf")]
LL + #![doc(inline)]
LL + #![doc(attribute)]
|
LL - #![doc(html_no_source = "asdf")]
LL + #![doc(test)]
LL + #![doc(auto_cfg)]
|
= and 22 other candidates
error: aborting due to 9 previous errors

View file

@ -18,14 +18,15 @@ LL - #[doc(alias = 0)]
LL + #[doc = "string"]
|
LL - #[doc(alias = 0)]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(alias = 0)]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(alias = 0)]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error: '"' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:9:15
@ -85,14 +86,15 @@ LL - #[doc(alias(0))]
LL + #[doc = "string"]
|
LL - #[doc(alias(0))]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(alias(0))]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(alias(0))]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error: '"' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:20:13

View file

@ -12,14 +12,15 @@ LL - #[doc(cfg(), cfg(foo, bar))]
LL + #[doc = "string"]
|
LL - #[doc(cfg(), cfg(foo, bar))]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg(), cfg(foo, bar))]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg(), cfg(foo, bar))]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0805]: malformed `doc` attribute input
--> $DIR/doc-cfg.rs:3:1
@ -35,14 +36,15 @@ LL - #[doc(cfg(), cfg(foo, bar))]
LL + #[doc = "string"]
|
LL - #[doc(cfg(), cfg(foo, bar))]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg(), cfg(foo, bar))]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg(), cfg(foo, bar))]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0805]: malformed `doc` attribute input
--> $DIR/doc-cfg.rs:6:1
@ -58,14 +60,15 @@ LL - #[doc(cfg())]
LL + #[doc = "string"]
|
LL - #[doc(cfg())]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg())]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg())]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0805]: malformed `doc` attribute input
--> $DIR/doc-cfg.rs:7:1
@ -81,14 +84,15 @@ LL - #[doc(cfg(foo, bar))]
LL + #[doc = "string"]
|
LL - #[doc(cfg(foo, bar))]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg(foo, bar))]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg(foo, bar))]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/doc-cfg.rs:8:1
@ -104,14 +108,15 @@ LL - #[doc(auto_cfg(hide(foo::bar)))]
LL + #[doc = "string"]
|
LL - #[doc(auto_cfg(hide(foo::bar)))]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(auto_cfg(hide(foo::bar)))]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(auto_cfg(hide(foo::bar)))]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error: aborting due to 5 previous errors

View file

@ -10,14 +10,15 @@ LL - #[doc(cfg = "x")]
LL + #[doc = "string"]
|
LL - #[doc(cfg = "x")]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg = "x")]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg = "x")]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0805]: malformed `doc` attribute input
--> $DIR/invalid-cfg.rs:3:1
@ -33,14 +34,15 @@ LL - #[doc(cfg(x, y))]
LL + #[doc = "string"]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/invalid-cfg.rs:7:1
@ -54,14 +56,15 @@ LL - #[doc(cfg = "x")]
LL + #[doc = "string"]
|
LL - #[doc(cfg = "x")]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg = "x")]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg = "x")]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0805]: malformed `doc` attribute input
--> $DIR/invalid-cfg.rs:8:1
@ -77,14 +80,15 @@ LL - #[doc(cfg(x, y))]
LL + #[doc = "string"]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/invalid-cfg.rs:12:1
@ -98,14 +102,15 @@ LL - #[doc(cfg = "x")]
LL + #[doc = "string"]
|
LL - #[doc(cfg = "x")]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg = "x")]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg = "x")]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0805]: malformed `doc` attribute input
--> $DIR/invalid-cfg.rs:13:1
@ -121,14 +126,15 @@ LL - #[doc(cfg(x, y))]
LL + #[doc = "string"]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/invalid-cfg.rs:18:1
@ -142,14 +148,15 @@ LL - #[doc(cfg = "x")]
LL + #[doc = "string"]
|
LL - #[doc(cfg = "x")]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg = "x")]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg = "x")]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0805]: malformed `doc` attribute input
--> $DIR/invalid-cfg.rs:19:1
@ -165,14 +172,15 @@ LL - #[doc(cfg(x, y))]
LL + #[doc = "string"]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(cfg(x, y))]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error: aborting due to 8 previous errors

View file

@ -12,14 +12,15 @@ LL - #[doc(123)]
LL + #[doc = "string"]
|
LL - #[doc(123)]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc(123)]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc(123)]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/doc-attr.rs:5:1
@ -35,14 +36,15 @@ LL - #[doc("hello", "bar")]
LL + #[doc = "string"]
|
LL - #[doc("hello", "bar")]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc("hello", "bar")]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc("hello", "bar")]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/doc-attr.rs:5:1
@ -58,14 +60,15 @@ LL - #[doc("hello", "bar")]
LL + #[doc = "string"]
|
LL - #[doc("hello", "bar")]
LL + #[doc(hidden)]
LL + #[doc(alias)]
|
LL - #[doc("hello", "bar")]
LL + #[doc(inline)]
LL + #[doc(attribute)]
|
LL - #[doc("hello", "bar")]
LL + #[doc(test)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error: aborting due to 3 previous errors

View file

@ -7,10 +7,10 @@
pub fn foo() {}
#[doc(123)]
//~^ ERROR invalid `doc` attribute
//~^ ERROR malformed `doc` attribute
#[doc("hello", "bar")]
//~^ ERROR invalid `doc` attribute
//~| ERROR invalid `doc` attribute
//~^ ERROR malformed `doc` attribute
//~| ERROR malformed `doc` attribute
#[doc(foo::bar, crate::bar::baz = "bye")]
//~^ ERROR unknown `doc` attribute
//~| ERROR unknown `doc` attribute

View file

@ -1,3 +1,75 @@
error[E0539]: malformed `doc` attribute input
--> $DIR/doc-attr.rs:9:1
|
LL | #[doc(123)]
| ^^^^^^---^^
| |
| expected this to be of the form `... = "..."`
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[doc(123)]
LL + #[doc = "string"]
|
LL - #[doc(123)]
LL + #[doc(alias)]
|
LL - #[doc(123)]
LL + #[doc(attribute)]
|
LL - #[doc(123)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/doc-attr.rs:11:1
|
LL | #[doc("hello", "bar")]
| ^^^^^^-------^^^^^^^^^
| |
| expected this to be of the form `... = "..."`
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[doc("hello", "bar")]
LL + #[doc = "string"]
|
LL - #[doc("hello", "bar")]
LL + #[doc(alias)]
|
LL - #[doc("hello", "bar")]
LL + #[doc(attribute)]
|
LL - #[doc("hello", "bar")]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error[E0539]: malformed `doc` attribute input
--> $DIR/doc-attr.rs:11:1
|
LL | #[doc("hello", "bar")]
| ^^^^^^^^^^^^^^^-----^^
| |
| expected this to be of the form `... = "..."`
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[doc("hello", "bar")]
LL + #[doc = "string"]
|
LL - #[doc("hello", "bar")]
LL + #[doc(alias)]
|
LL - #[doc("hello", "bar")]
LL + #[doc(attribute)]
|
LL - #[doc("hello", "bar")]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error: unknown `doc` attribute `as_ptr`
--> $DIR/doc-attr.rs:5:7
|
@ -6,24 +78,6 @@ LL | #[doc(as_ptr)]
|
= note: `#[deny(invalid_doc_attributes)]` on by default
error: invalid `doc` attribute
--> $DIR/doc-attr.rs:9:7
|
LL | #[doc(123)]
| ^^^
error: invalid `doc` attribute
--> $DIR/doc-attr.rs:11:7
|
LL | #[doc("hello", "bar")]
| ^^^^^^^
error: invalid `doc` attribute
--> $DIR/doc-attr.rs:11:16
|
LL | #[doc("hello", "bar")]
| ^^^^^
error: unknown `doc` attribute `foo::bar`
--> $DIR/doc-attr.rs:14:7
|
@ -34,7 +88,7 @@ error: unknown `doc` attribute `crate::bar::baz`
--> $DIR/doc-attr.rs:14:17
|
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
| ^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^
error: unknown `doc` attribute `as_ptr`
--> $DIR/doc-attr.rs:2:8
@ -44,3 +98,4 @@ LL | #![doc(as_ptr)]
error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0539`.

View file

@ -1,4 +1,4 @@
#![doc(test(""))]
//~^ ERROR `#![doc(test(...)]` does not take a literal
//~^ ERROR malformed `doc` attribute input
fn main() {}

View file

@ -1,10 +1,27 @@
error: `#![doc(test(...)]` does not take a literal
--> $DIR/doc-test-literal.rs:1:13
error[E0565]: malformed `doc` attribute input
--> $DIR/doc-test-literal.rs:1:1
|
LL | #![doc(test(""))]
| ^^
| ^^^^^^^^^^^^--^^^
| |
| didn't expect a literal here
|
= note: `#[deny(invalid_doc_attributes)]` on by default
help: try changing it to one of the following valid forms of the attribute
|
LL - #![doc(test(""))]
LL + #![doc = "string"]
|
LL - #![doc(test(""))]
LL + #![doc(alias)]
|
LL - #![doc(test(""))]
LL + #![doc(attribute)]
|
LL - #![doc(test(""))]
LL + #![doc(auto_cfg)]
|
= and 22 other candidates
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0565`.

View file

@ -3,5 +3,6 @@
#![doc = include_str!("../not_existing_file.md")]
struct Documented {}
//~^^ ERROR couldn't read
//~| ERROR attribute value must be a literal
fn main() {}

View file

@ -4,5 +4,11 @@ error: couldn't read the file
LL | #![doc = include_str!("../not_existing_file.md")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error
error: attribute value must be a literal
--> $DIR/extented-attribute-macro-error.rs:3:10
|
LL | #![doc = include_str!("../not_existing_file.md")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -12,6 +12,8 @@ struct X {
fn main() {
let _ = X {
#[doc(alias = "StructItem")]
//~^ WARN: attribute cannot be used on struct fields
//~| WARN: this was previously accepted by the compiler but is being phased out
foo: 123,
};
}

View file

@ -0,0 +1,12 @@
warning: `#[doc]` attribute cannot be used on struct fields
--> $DIR/issue-115264-expr-field.rs:14:9
|
LL | #[doc(alias = "StructItem")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[doc]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, functions, impl blocks, macro defs, modules, statics, struct fields, trait aliases, traits, type aliases, unions, and use statements
= note: requested on the command line with `-W unused-attributes`
warning: 1 warning emitted

View file

@ -12,6 +12,8 @@ struct X {
fn main() {
let X {
#[doc(alias = "StructItem")]
//~^ WARN: attribute cannot be used on pattern fields
//~| WARN: this was previously accepted by the compiler but is being phased out
foo
} = X {
foo: 123

View file

@ -0,0 +1,12 @@
warning: `#[doc]` attribute cannot be used on pattern fields
--> $DIR/issue-115264-pat-field.rs:14:9
|
LL | #[doc(alias = "StructItem")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[doc]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, functions, impl blocks, macro defs, modules, statics, struct fields, trait aliases, traits, type aliases, unions, and use statements
= note: requested on the command line with `-W unused-attributes`
warning: 1 warning emitted

View file

@ -1,19 +1,29 @@
#![doc = in_root!()] //~ ERROR cannot find macro `in_root`
//~| WARN this was previously accepted by the compiler
#![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
//~| ERROR attribute value must be a literal
#![doc = in_mod_escape!()] //~ ERROR cannot find macro `in_mod_escape`
//~| WARN this was previously accepted by the compiler
#![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
//~| ERROR attribute value must be a literal
#[doc = in_root!()] //~ ERROR cannot find macro `in_root` in this scope
//~| ERROR attribute value must be a literal
#[doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
//~| ERROR attribute value must be a literal
#[doc = in_mod_escape!()] //~ ERROR cannot find macro `in_mod_escape` in this scope
//~| ERROR attribute value must be a literal
#[doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
//~| ERROR attribute value must be a literal
fn before() {
#![doc = in_root!()] //~ ERROR cannot find macro `in_root` in this scope
//~| ERROR attribute value must be a literal
#![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
//~| ERROR attribute value must be a literal
#![doc = in_mod_escape!()] //~ ERROR cannot find macro `in_mod_escape` in this scope
//~| ERROR attribute value must be a literal
#![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
//~| ERROR attribute value must be a literal
}
macro_rules! in_root { () => { "" } }
@ -48,8 +58,10 @@ mod macros_escape {
}
#[doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
//~| ERROR attribute value must be a literal
fn block() {
#![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
//~| ERROR attribute value must be a literal
macro_rules! in_block { () => { "" } }
@ -61,13 +73,17 @@ fn block() {
#[doc = in_root!()] // OK
#[doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
//~| ERROR attribute value must be a literal
#[doc = in_mod_escape!()] // OK
#[doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
//~| ERROR attribute value must be a literal
fn after() {
#![doc = in_root!()] // OK
#![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
//~| ERROR attribute value must be a literal
#![doc = in_mod_escape!()] // OK
#![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
//~| ERROR attribute value must be a literal
}
fn main() {}

View file

@ -7,7 +7,7 @@ LL | #![doc = in_mod!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_block` in this scope
--> $DIR/key-value-expansion-scope.rs:6:10
--> $DIR/key-value-expansion-scope.rs:7:10
|
LL | #![doc = in_block!()]
| ^^^^^^^^
@ -15,7 +15,7 @@ LL | #![doc = in_block!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_root` in this scope
--> $DIR/key-value-expansion-scope.rs:8:9
--> $DIR/key-value-expansion-scope.rs:10:9
|
LL | #[doc = in_root!()]
| ^^^^^^^
@ -23,7 +23,7 @@ LL | #[doc = in_root!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_mod` in this scope
--> $DIR/key-value-expansion-scope.rs:9:9
--> $DIR/key-value-expansion-scope.rs:12:9
|
LL | #[doc = in_mod!()]
| ^^^^^^
@ -31,7 +31,7 @@ LL | #[doc = in_mod!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_mod_escape` in this scope
--> $DIR/key-value-expansion-scope.rs:10:9
--> $DIR/key-value-expansion-scope.rs:14:9
|
LL | #[doc = in_mod_escape!()]
| ^^^^^^^^^^^^^
@ -39,7 +39,7 @@ LL | #[doc = in_mod_escape!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_block` in this scope
--> $DIR/key-value-expansion-scope.rs:11:9
--> $DIR/key-value-expansion-scope.rs:16:9
|
LL | #[doc = in_block!()]
| ^^^^^^^^
@ -47,7 +47,7 @@ LL | #[doc = in_block!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_root` in this scope
--> $DIR/key-value-expansion-scope.rs:13:14
--> $DIR/key-value-expansion-scope.rs:19:14
|
LL | #![doc = in_root!()]
| ^^^^^^^
@ -55,7 +55,7 @@ LL | #![doc = in_root!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_mod` in this scope
--> $DIR/key-value-expansion-scope.rs:14:14
--> $DIR/key-value-expansion-scope.rs:21:14
|
LL | #![doc = in_mod!()]
| ^^^^^^
@ -63,7 +63,7 @@ LL | #![doc = in_mod!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_mod_escape` in this scope
--> $DIR/key-value-expansion-scope.rs:15:14
--> $DIR/key-value-expansion-scope.rs:23:14
|
LL | #![doc = in_mod_escape!()]
| ^^^^^^^^^^^^^
@ -71,7 +71,7 @@ LL | #![doc = in_mod_escape!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_block` in this scope
--> $DIR/key-value-expansion-scope.rs:16:14
--> $DIR/key-value-expansion-scope.rs:25:14
|
LL | #![doc = in_block!()]
| ^^^^^^^^
@ -79,7 +79,7 @@ LL | #![doc = in_block!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_block` in this scope
--> $DIR/key-value-expansion-scope.rs:50:9
--> $DIR/key-value-expansion-scope.rs:60:9
|
LL | #[doc = in_block!()]
| ^^^^^^^^
@ -87,7 +87,7 @@ LL | #[doc = in_block!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_block` in this scope
--> $DIR/key-value-expansion-scope.rs:52:14
--> $DIR/key-value-expansion-scope.rs:63:14
|
LL | #![doc = in_block!()]
| ^^^^^^^^
@ -95,7 +95,7 @@ LL | #![doc = in_block!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_mod` in this scope
--> $DIR/key-value-expansion-scope.rs:63:9
--> $DIR/key-value-expansion-scope.rs:75:9
|
LL | #[doc = in_mod!()]
| ^^^^^^
@ -103,7 +103,7 @@ LL | #[doc = in_mod!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_block` in this scope
--> $DIR/key-value-expansion-scope.rs:65:9
--> $DIR/key-value-expansion-scope.rs:78:9
|
LL | #[doc = in_block!()]
| ^^^^^^^^
@ -111,7 +111,7 @@ LL | #[doc = in_block!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_mod` in this scope
--> $DIR/key-value-expansion-scope.rs:68:14
--> $DIR/key-value-expansion-scope.rs:82:14
|
LL | #![doc = in_mod!()]
| ^^^^^^
@ -119,7 +119,7 @@ LL | #![doc = in_mod!()]
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `in_block` in this scope
--> $DIR/key-value-expansion-scope.rs:70:14
--> $DIR/key-value-expansion-scope.rs:85:14
|
LL | #![doc = in_block!()]
| ^^^^^^^^
@ -138,7 +138,7 @@ LL | #![doc = in_root!()]
= note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default
error: cannot find macro `in_mod_escape` in the current scope when looking from the crate root
--> $DIR/key-value-expansion-scope.rs:4:10
--> $DIR/key-value-expansion-scope.rs:5:10
|
LL | #![doc = in_mod_escape!()]
| ^^^^^^^^^^^^^ not found from the crate root
@ -148,7 +148,7 @@ LL | #![doc = in_mod_escape!()]
= help: import `macro_rules` with `use` to make it callable above its definition
error: cannot find macro `in_mod` in the current scope when looking from module `macros_stay`
--> $DIR/key-value-expansion-scope.rs:21:9
--> $DIR/key-value-expansion-scope.rs:31:9
|
LL | #[doc = in_mod!()]
| ^^^^^^ not found from module `macros_stay`
@ -158,7 +158,7 @@ LL | #[doc = in_mod!()]
= help: import `macro_rules` with `use` to make it callable above its definition
error: cannot find macro `in_mod` in the current scope when looking from module `macros_stay`
--> $DIR/key-value-expansion-scope.rs:24:14
--> $DIR/key-value-expansion-scope.rs:34:14
|
LL | #![doc = in_mod!()]
| ^^^^^^ not found from module `macros_stay`
@ -168,7 +168,7 @@ LL | #![doc = in_mod!()]
= help: import `macro_rules` with `use` to make it callable above its definition
error: cannot find macro `in_mod_escape` in the current scope when looking from module `macros_escape`
--> $DIR/key-value-expansion-scope.rs:36:9
--> $DIR/key-value-expansion-scope.rs:46:9
|
LL | #[doc = in_mod_escape!()]
| ^^^^^^^^^^^^^ not found from module `macros_escape`
@ -178,7 +178,7 @@ LL | #[doc = in_mod_escape!()]
= help: import `macro_rules` with `use` to make it callable above its definition
error: cannot find macro `in_mod_escape` in the current scope when looking from module `macros_escape`
--> $DIR/key-value-expansion-scope.rs:39:14
--> $DIR/key-value-expansion-scope.rs:49:14
|
LL | #![doc = in_mod_escape!()]
| ^^^^^^^^^^^^^ not found from module `macros_escape`
@ -187,7 +187,103 @@ LL | #![doc = in_mod_escape!()]
= note: for more information, see issue #124535 <https://github.com/rust-lang/rust/issues/124535>
= help: import `macro_rules` with `use` to make it callable above its definition
error: aborting due to 22 previous errors
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:3:10
|
LL | #![doc = in_mod!()]
| ^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:7:10
|
LL | #![doc = in_block!()]
| ^^^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:10:9
|
LL | #[doc = in_root!()]
| ^^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:12:9
|
LL | #[doc = in_mod!()]
| ^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:14:9
|
LL | #[doc = in_mod_escape!()]
| ^^^^^^^^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:16:9
|
LL | #[doc = in_block!()]
| ^^^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:19:14
|
LL | #![doc = in_root!()]
| ^^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:21:14
|
LL | #![doc = in_mod!()]
| ^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:23:14
|
LL | #![doc = in_mod_escape!()]
| ^^^^^^^^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:25:14
|
LL | #![doc = in_block!()]
| ^^^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:60:9
|
LL | #[doc = in_block!()]
| ^^^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:63:14
|
LL | #![doc = in_block!()]
| ^^^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:75:9
|
LL | #[doc = in_mod!()]
| ^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:78:9
|
LL | #[doc = in_block!()]
| ^^^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:82:14
|
LL | #![doc = in_mod!()]
| ^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion-scope.rs:85:14
|
LL | #![doc = in_block!()]
| ^^^^^^^^^^^
error: aborting due to 38 previous errors
Future incompatibility report: Future breakage diagnostic:
error: cannot find macro `in_root` in the current scope when looking from the crate root
@ -203,7 +299,7 @@ LL | #![doc = in_root!()]
Future breakage diagnostic:
error: cannot find macro `in_mod_escape` in the current scope when looking from the crate root
--> $DIR/key-value-expansion-scope.rs:4:10
--> $DIR/key-value-expansion-scope.rs:5:10
|
LL | #![doc = in_mod_escape!()]
| ^^^^^^^^^^^^^ not found from the crate root
@ -215,7 +311,7 @@ LL | #![doc = in_mod_escape!()]
Future breakage diagnostic:
error: cannot find macro `in_mod` in the current scope when looking from module `macros_stay`
--> $DIR/key-value-expansion-scope.rs:21:9
--> $DIR/key-value-expansion-scope.rs:31:9
|
LL | #[doc = in_mod!()]
| ^^^^^^ not found from module `macros_stay`
@ -227,7 +323,7 @@ LL | #[doc = in_mod!()]
Future breakage diagnostic:
error: cannot find macro `in_mod` in the current scope when looking from module `macros_stay`
--> $DIR/key-value-expansion-scope.rs:24:14
--> $DIR/key-value-expansion-scope.rs:34:14
|
LL | #![doc = in_mod!()]
| ^^^^^^ not found from module `macros_stay`
@ -239,7 +335,7 @@ LL | #![doc = in_mod!()]
Future breakage diagnostic:
error: cannot find macro `in_mod_escape` in the current scope when looking from module `macros_escape`
--> $DIR/key-value-expansion-scope.rs:36:9
--> $DIR/key-value-expansion-scope.rs:46:9
|
LL | #[doc = in_mod_escape!()]
| ^^^^^^^^^^^^^ not found from module `macros_escape`
@ -251,7 +347,7 @@ LL | #[doc = in_mod_escape!()]
Future breakage diagnostic:
error: cannot find macro `in_mod_escape` in the current scope when looking from module `macros_escape`
--> $DIR/key-value-expansion-scope.rs:39:14
--> $DIR/key-value-expansion-scope.rs:49:14
|
LL | #![doc = in_mod_escape!()]
| ^^^^^^^^^^^^^ not found from module `macros_escape`

View file

@ -1,3 +1,9 @@
error: attribute value must be a literal
--> $DIR/key-value-expansion.rs:21:6
|
LL | bug!((column!()));
| ^^^^^^^^^^^
error: attribute value must be a literal
--> $DIR/key-value-expansion.rs:27:14
|
@ -20,11 +26,5 @@ LL | some_macro!(u8);
|
= note: this error originates in the macro `some_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: attribute value must be a literal
--> $DIR/key-value-expansion.rs:21:6
|
LL | bug!((column!()));
| ^^^^^^^^^^^
error: aborting due to 3 previous errors

View file

@ -182,27 +182,6 @@ LL | #[allow_internal_unsafe = 1]
= help: add `#![feature(allow_internal_unsafe)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]`
--> $DIR/malformed-attrs.rs:41:1
|
LL | #[doc]
| ^^^^^^
|
= 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html>
= note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]`
--> $DIR/malformed-attrs.rs:77:1
|
LL | #[doc]
| ^^^^^^
|
= 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html>
error[E0539]: malformed `windows_subsystem` attribute input
--> $DIR/malformed-attrs.rs:26:1
|
@ -790,6 +769,16 @@ LL | #[diagnostic::on_unimplemented = 1]
|
= help: only `message`, `note` and `label` are allowed as options
error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
--> $DIR/malformed-attrs.rs:41:1
|
LL | #[doc]
| ^^^^^^
|
= 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
--> $DIR/malformed-attrs.rs:52:1
|
@ -814,6 +803,15 @@ LL | | #[coroutine = 63] || {}
LL | | }
| |_^
error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
--> $DIR/malformed-attrs.rs:77:1
|
LL | #[doc]
| ^^^^^^
|
= 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
warning: `#[link_name]` attribute cannot be used on functions
--> $DIR/malformed-attrs.rs:88:1
|
@ -875,7 +873,7 @@ error: aborting due to 76 previous errors; 8 warnings emitted
Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805.
For more information about an error, try `rustc --explain E0308`.
Future incompatibility report: Future breakage diagnostic:
error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]`
error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
--> $DIR/malformed-attrs.rs:41:1
|
LL | #[doc]
@ -883,19 +881,6 @@ LL | #[doc]
|
= 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html>
= note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
Future breakage diagnostic:
error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]`
--> $DIR/malformed-attrs.rs:77:1
|
LL | #[doc]
| ^^^^^^
|
= 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html>
= note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
Future breakage diagnostic:
@ -909,6 +894,17 @@ LL | #[inline = 5]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
Future breakage diagnostic:
error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
--> $DIR/malformed-attrs.rs:77:1
|
LL | #[doc]
| ^^^^^^
|
= 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
Future breakage diagnostic:
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
--> $DIR/malformed-attrs.rs:98:1

View file

@ -11,7 +11,7 @@ error: unknown `doc` attribute `include`
--> $DIR/removed-features-note-version-and-pr-issue-141619.rs:2:8
|
LL | #![doc(include("README.md"))]
| ^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^
|
= note: `#[deny(invalid_doc_attributes)]` on by default

View file

@ -5,6 +5,8 @@
//! Ensure that ICE does not occur when reading an invalid UTF8 file with an absolute path.
//! regression test for issue <https://github.com/rust-lang/rust/issues/149304>
#![doc = include_str!(concat!(env!("INVALID_UTF8_BIN")))] //~ ERROR: wasn't a utf-8 file
#![doc = include_str!(concat!(env!("INVALID_UTF8_BIN")))]
//~^ ERROR: wasn't a utf-8 file
//~| ERROR: attribute value must be a literal
fn main() {}

View file

@ -6,5 +6,11 @@ LL | #![doc = include_str!(concat!(env!("INVALID_UTF8_BIN")))]
|
= note: invalid utf-8 at byte `$BYTE`
error: aborting due to 1 previous error
error: attribute value must be a literal
--> $DIR/invalid-utf8-binary-file.rs:8:10
|
LL | #![doc = include_str!(concat!(env!("INVALID_UTF8_BIN")))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,6 +1,7 @@
#![feature(stmt_expr_attributes)]
#![deny(unused_doc_comments)]
#![deny(unused_attributes)]
macro_rules! mac {
() => {}
@ -15,7 +16,10 @@ unsafe extern "C" { }
fn foo() {
/// a //~ ERROR unused doc comment
#[doc(test(attr(allow(dead_code))))] //~ ERROR unused doc comment
#[doc(test(attr(allow(dead_code))))]
//~^ ERROR unused doc comment
//~| ERROR `#[doc]` attribute cannot be used on statements
//~| WARN this was previously accepted by the compiler
let x = 12;
/// multi-line //~ ERROR unused doc comment
@ -24,7 +28,10 @@ fn foo() {
match x {
/// c //~ ERROR unused doc comment
1 => {},
#[doc(test(attr(allow(dead_code))))] //~ ERROR unused doc comment
#[doc(test(attr(allow(dead_code))))]
//~^ ERROR unused doc comment
//~| ERROR `#[doc]` attribute cannot be used on match arms [unused_attributes]
//~| WARN this was previously accepted by the compiler
_ => {}
}
@ -38,7 +45,10 @@ fn foo() {
/// bar //~ ERROR unused doc comment
mac!();
#[doc(test(attr(allow(dead_code))))] //~ ERROR unused doc comment
#[doc(test(attr(allow(dead_code))))]
//~^ ERROR unused doc comment
//~| ERROR `#[doc]` attribute cannot be used on statements
//~| WARN this was previously accepted by the compiler
let x = /** comment */ 47; //~ ERROR unused doc comment
/// dox //~ ERROR unused doc comment

View file

@ -1,5 +1,5 @@
error: unused doc comment
--> $DIR/useless-comment.rs:9:1
--> $DIR/useless-comment.rs:10:1
|
LL | /// foo
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rustdoc does not generate documentation for macro invocations
@ -12,7 +12,7 @@ LL | #![deny(unused_doc_comments)]
| ^^^^^^^^^^^^^^^^^^^
error: unused doc comment
--> $DIR/useless-comment.rs:12:1
--> $DIR/useless-comment.rs:13:1
|
LL | /// a
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -23,7 +23,7 @@ LL | unsafe extern "C" { }
= help: use `//` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:13:1
--> $DIR/useless-comment.rs:14:1
|
LL | #[doc(test(attr(allow(dead_code))))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -33,7 +33,7 @@ LL | unsafe extern "C" { }
= help: use `//` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:38:5
--> $DIR/useless-comment.rs:45:5
|
LL | /// bar
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rustdoc does not generate documentation for macro invocations
@ -41,28 +41,29 @@ LL | /// bar
= help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion
error: unused doc comment
--> $DIR/useless-comment.rs:17:5
--> $DIR/useless-comment.rs:18:5
|
LL | /// a
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #[doc(test(attr(allow(dead_code))))]
...
LL | let x = 12;
| ----------- rustdoc does not generate documentation for statements
|
= help: use `//` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:18:5
--> $DIR/useless-comment.rs:19:5
|
LL | #[doc(test(attr(allow(dead_code))))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | let x = 12;
| ----------- rustdoc does not generate documentation for statements
|
= help: use `//` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:21:5
--> $DIR/useless-comment.rs:25:5
|
LL | / /// multi-line
LL | | /// doc comment
@ -72,6 +73,7 @@ LL | / match x {
LL | | /// c
LL | | 1 => {},
LL | | #[doc(test(attr(allow(dead_code))))]
... |
LL | | _ => {}
LL | | }
| |_____- rustdoc does not generate documentation for expressions
@ -79,7 +81,7 @@ LL | | }
= help: use `//` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:25:9
--> $DIR/useless-comment.rs:29:9
|
LL | /// c
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -89,17 +91,18 @@ LL | 1 => {},
= help: use `//` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:27:9
--> $DIR/useless-comment.rs:31:9
|
LL | #[doc(test(attr(allow(dead_code))))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | _ => {}
| ------- rustdoc does not generate documentation for match arms
|
= help: use `//` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:31:5
--> $DIR/useless-comment.rs:38:5
|
LL | /// foo
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -109,7 +112,7 @@ LL | unsafe {}
= help: use `//` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:34:5
--> $DIR/useless-comment.rs:41:5
|
LL | #[doc = "foo"]
| ^^^^^^^^^^^^^^
@ -120,7 +123,7 @@ LL | 3;
= help: use `//` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:35:5
--> $DIR/useless-comment.rs:42:5
|
LL | #[doc = "bar"]
| ^^^^^^^^^^^^^^
@ -130,17 +133,18 @@ LL | 3;
= help: use `//` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:41:5
--> $DIR/useless-comment.rs:48:5
|
LL | #[doc(test(attr(allow(dead_code))))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | let x = /** comment */ 47;
| -------------------------- rustdoc does not generate documentation for statements
|
= help: use `//` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:42:13
--> $DIR/useless-comment.rs:52:13
|
LL | let x = /** comment */ 47;
| ^^^^^^^^^^^^^^ -- rustdoc does not generate documentation for expressions
@ -148,7 +152,7 @@ LL | let x = /** comment */ 47;
= help: use `/* */` for a plain comment
error: unused doc comment
--> $DIR/useless-comment.rs:44:5
--> $DIR/useless-comment.rs:54:5
|
LL | /// dox
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -159,5 +163,37 @@ LL | | }
|
= help: use `//` for a plain comment
error: aborting due to 15 previous errors
error: `#[doc]` attribute cannot be used on statements
--> $DIR/useless-comment.rs:19:5
|
LL | #[doc(test(attr(allow(dead_code))))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[doc]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, functions, impl blocks, macro defs, modules, statics, struct fields, trait aliases, traits, type aliases, unions, and use statements
note: the lint level is defined here
--> $DIR/useless-comment.rs:4:9
|
LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
error: `#[doc]` attribute cannot be used on match arms
--> $DIR/useless-comment.rs:31:9
|
LL | #[doc(test(attr(allow(dead_code))))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[doc]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, functions, impl blocks, macro defs, modules, statics, struct fields, trait aliases, traits, type aliases, unions, and use statements
error: `#[doc]` attribute cannot be used on statements
--> $DIR/useless-comment.rs:48:5
|
LL | #[doc(test(attr(allow(dead_code))))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[doc]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, functions, impl blocks, macro defs, modules, statics, struct fields, trait aliases, traits, type aliases, unions, and use statements
error: aborting due to 18 previous errors

View file

@ -1,14 +1,3 @@
error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]`
--> $DIR/malformed-regressions.rs:1:1
|
LL | #[doc]
| ^^^^^^
|
= 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html>
= note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
error[E0539]: malformed `link` attribute input
--> $DIR/malformed-regressions.rs:7:1
|
@ -63,6 +52,16 @@ LL | fn main() {}
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: requested on the command line with `-W unused-attributes`
error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
--> $DIR/malformed-regressions.rs:1:1
|
LL | #[doc]
| ^^^^^^
|
= 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
--> $DIR/malformed-regressions.rs:3:1
|
@ -85,7 +84,7 @@ error: aborting due to 5 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0539`.
Future incompatibility report: Future breakage diagnostic:
error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]`
error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
--> $DIR/malformed-regressions.rs:1:1
|
LL | #[doc]
@ -93,7 +92,6 @@ LL | #[doc]
|
= 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 #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html>
= note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
Future breakage diagnostic:

View file

@ -20,19 +20,6 @@ help: surround the identifier with quotation marks to make it into a string lite
LL | #[cfg(key="foo bar baz")]
| + +
error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found expression
--> $DIR/attr-unquoted-ident.rs:18:15
|
LL | #[cfg(key=foo 1 bar 2.0 baz.)]
| ^^^ expressions are not allowed here
|
help: surround the identifier with quotation marks to make it into a string literal
|
LL | #[cfg(key="foo 1 bar 2.0 baz.")]
| + +
error: expected unsuffixed literal, found identifier `nickname`
--> $DIR/attr-unquoted-ident.rs:28:38
|
LL | ($name:ident) => { #[doc(alias = $name)] pub struct S; }
| ^^^^^

View file

@ -21,11 +21,22 @@ impl Foo for Bar {
type X = i32;
fn foo(#[doc(alias = "qux")] _x: u32) -> Self::X {
//~^ ERROR
#[doc(alias = "stmt")] //~ ERROR
//~| WARN `#[doc]` attribute cannot be used on function params
//~| WARN: this was previously accepted by the compiler
#[doc(alias = "stmt")]
//~^ ERROR
//~| WARN `#[doc]` attribute cannot be used on statements
//~| WARN: this was previously accepted by the compiler
let x = 0;
#[doc(alias = "expr")] //~ ERROR
#[doc(alias = "expr")]
//~^ ERROR
//~| WARN `#[doc]` attribute cannot be used on expressions
//~| WARN: this was previously accepted by the compiler
match x {
#[doc(alias = "arm")] //~ ERROR
#[doc(alias = "arm")]
//~^ ERROR
//~| WARN `#[doc]` attribute cannot be used on match arms
//~| WARN: this was previously accepted by the compiler
_ => 0
}
}

View file

@ -5,46 +5,83 @@ LL | fn foo(#[doc(alias = "qux")] _x: u32) -> Self::X {
| ^^^^^^^^^^^^^^^^^^^^^
error: `#[doc(alias = "...")]` isn't allowed on foreign module
--> $DIR/check-doc-alias-attr-location.rs:9:7
--> $DIR/check-doc-alias-attr-location.rs:9:15
|
LL | #[doc(alias = "foo")]
| ^^^^^^^^^^^^^
| ^^^^^
error: `#[doc(alias = "...")]` isn't allowed on implementation block
--> $DIR/check-doc-alias-attr-location.rs:12:7
--> $DIR/check-doc-alias-attr-location.rs:12:15
|
LL | #[doc(alias = "bar")]
| ^^^^^^^^^^^^^
| ^^^^^
error: `#[doc(alias = "...")]` isn't allowed on implementation block
--> $DIR/check-doc-alias-attr-location.rs:18:7
--> $DIR/check-doc-alias-attr-location.rs:18:15
|
LL | #[doc(alias = "foobar")]
| ^^^^^^^^^^^^^^^^
| ^^^^^^^^
error: `#[doc(alias = "...")]` isn't allowed on type alias in implementation block
--> $DIR/check-doc-alias-attr-location.rs:20:11
--> $DIR/check-doc-alias-attr-location.rs:20:19
|
LL | #[doc(alias = "assoc")]
| ^^^^^^^^^^^^^^^
| ^^^^^^^
error: `#[doc(alias = "...")]` isn't allowed on statement
--> $DIR/check-doc-alias-attr-location.rs:24:15
--> $DIR/check-doc-alias-attr-location.rs:26:23
|
LL | #[doc(alias = "stmt")]
| ^^^^^^^^^^^^^^
| ^^^^^^
error: `#[doc(alias = "...")]` isn't allowed on expression
--> $DIR/check-doc-alias-attr-location.rs:26:15
--> $DIR/check-doc-alias-attr-location.rs:31:23
|
LL | #[doc(alias = "expr")]
| ^^^^^^^^^^^^^^
| ^^^^^^
error: `#[doc(alias = "...")]` isn't allowed on match arm
--> $DIR/check-doc-alias-attr-location.rs:28:19
--> $DIR/check-doc-alias-attr-location.rs:36:27
|
LL | #[doc(alias = "arm")]
| ^^^^^^^^^^^^^
| ^^^^^
error: aborting due to 8 previous errors
warning: `#[doc]` attribute cannot be used on function params
--> $DIR/check-doc-alias-attr-location.rs:22:12
|
LL | fn foo(#[doc(alias = "qux")] _x: u32) -> Self::X {
| ^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[doc]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, functions, impl blocks, macro defs, modules, statics, struct fields, trait aliases, traits, type aliases, unions, and use statements
= note: requested on the command line with `-W unused-attributes`
warning: `#[doc]` attribute cannot be used on statements
--> $DIR/check-doc-alias-attr-location.rs:26:9
|
LL | #[doc(alias = "stmt")]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[doc]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, functions, impl blocks, macro defs, modules, statics, struct fields, trait aliases, traits, type aliases, unions, and use statements
warning: `#[doc]` attribute cannot be used on expressions
--> $DIR/check-doc-alias-attr-location.rs:31:9
|
LL | #[doc(alias = "expr")]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[doc]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, functions, impl blocks, macro defs, modules, statics, struct fields, trait aliases, traits, type aliases, unions, and use statements
warning: `#[doc]` attribute cannot be used on match arms
--> $DIR/check-doc-alias-attr-location.rs:36:13
|
LL | #[doc(alias = "arm")]
| ^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[doc]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, functions, impl blocks, macro defs, modules, statics, struct fields, trait aliases, traits, type aliases, unions, and use statements
error: aborting due to 8 previous errors; 4 warnings emitted

View file

@ -4,11 +4,29 @@ error: doc alias attribute expects a string `#[doc(alias = "a")]` or a list of s
LL | #[doc(alias)]
| ^^^^^
error: doc alias attribute expects a string `#[doc(alias = "a")]` or a list of strings `#[doc(alias("a", "b"))]`
--> $DIR/check-doc-alias-attr.rs:8:7
error[E0539]: malformed `doc` attribute input
--> $DIR/check-doc-alias-attr.rs:8:1
|
LL | #[doc(alias = 0)]
| ^^^^^^^^^
| ^^^^^^^^^^^^^^-^^
| |
| expected a string literal here
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[doc(alias = 0)]
LL + #[doc = "string"]
|
LL - #[doc(alias = 0)]
LL + #[doc(alias)]
|
LL - #[doc(alias = 0)]
LL + #[doc(attribute)]
|
LL - #[doc(alias = 0)]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error: '"' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:9:15
@ -54,25 +72,43 @@ error: `#[doc(alias = "...")]` attribute cannot have empty value
LL | #[doc(alias = "")]
| ^^
error: `#[doc(alias("a"))]` expects string literals
--> $DIR/check-doc-alias-attr.rs:19:13
error[E0539]: malformed `doc` attribute input
--> $DIR/check-doc-alias-attr.rs:19:1
|
LL | #[doc(alias(0))]
| ^
| ^^^^^^^^^^^^-^^^
| |
| expected a string literal here
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[doc(alias(0))]
LL + #[doc = "string"]
|
LL - #[doc(alias(0))]
LL + #[doc(alias)]
|
LL - #[doc(alias(0))]
LL + #[doc(attribute)]
|
LL - #[doc(alias(0))]
LL + #[doc(auto_cfg)]
|
= and 22 other candidates
error: '"' character isn't allowed in `#[doc(alias("..."))]`
error: '"' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:20:13
|
LL | #[doc(alias("\""))]
| ^^^^
error: '\n' character isn't allowed in `#[doc(alias("..."))]`
error: '\n' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:21:13
|
LL | #[doc(alias("\n"))]
| ^^^^
error: '\n' character isn't allowed in `#[doc(alias("..."))]`
error: '\n' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:22:13
|
LL | #[doc(alias("
@ -80,25 +116,25 @@ LL | #[doc(alias("
LL | | "))]
| |_^
error: '\t' character isn't allowed in `#[doc(alias("..."))]`
error: '\t' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/check-doc-alias-attr.rs:24:13
|
LL | #[doc(alias("\t"))]
| ^^^^
error: `#[doc(alias("..."))]` cannot start or end with ' '
error: `#[doc(alias = "...")]` cannot start or end with ' '
--> $DIR/check-doc-alias-attr.rs:25:13
|
LL | #[doc(alias(" hello"))]
| ^^^^^^^^
error: `#[doc(alias("..."))]` cannot start or end with ' '
error: `#[doc(alias = "...")]` cannot start or end with ' '
--> $DIR/check-doc-alias-attr.rs:26:13
|
LL | #[doc(alias("hello "))]
| ^^^^^^^^
error: `#[doc(alias("..."))]` attribute cannot have empty value
error: `#[doc(alias = "...")]` attribute cannot have empty value
--> $DIR/check-doc-alias-attr.rs:27:13
|
LL | #[doc(alias(""))]
@ -106,3 +142,4 @@ LL | #[doc(alias(""))]
error: aborting due to 17 previous errors
For more information about this error, try `rustc --explain E0539`.

View file

@ -5,10 +5,10 @@ LL | #[doc(alias = "shouldn't work!")]
| ^^^^^^^^^^^^^^^^^
error: `#![doc(alias = "...")]` isn't allowed as a crate-level attribute
--> $DIR/doc-alias-crate-level.rs:5:8
--> $DIR/doc-alias-crate-level.rs:5:16
|
LL | #![doc(alias = "not working!")]
| ^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,8 +1,8 @@
error: `#[doc(alias = "...")]` is the same as the item's name
--> $DIR/doc-alias-same-name.rs:3:7
error: `#[doc(alias = "Foo"]` is the same as the item's name
--> $DIR/doc-alias-same-name.rs:3:15
|
LL | #[doc(alias = "Foo")]
| ^^^^^^^^^^^^^
| ^^^^^
error: aborting due to 1 previous error

View file

@ -2,7 +2,7 @@ error: unknown `doc` attribute `primitive`
--> $DIR/doc-primitive.rs:3:7
|
LL | #[doc(primitive = "foo")]
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/doc-primitive.rs:1:9

View file

@ -11,10 +11,10 @@ LL | #![deny(invalid_doc_attributes)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: `#[doc(test(...)]` takes a list of attributes
--> $DIR/doc-test-attr.rs:6:8
--> $DIR/doc-test-attr.rs:6:13
|
LL | #![doc(test = "hello")]
| ^^^^^^^^^^^^^^
| ^^^^^^^^^
error: unknown `doc(test)` attribute `a`
--> $DIR/doc-test-attr.rs:8:13

View file

@ -1,14 +1,14 @@
#![crate_type = "lib"]
#![feature(rustdoc_internals)]
#![doc(keyword = "hello")]
#![doc(keyword = "match")]
//~^ ERROR `#![doc(keyword = "...")]` isn't allowed as a crate-level attribute
#[doc(keyword = "hell")] //~ ERROR `#[doc(keyword = "...")]` should be used on empty modules
#[doc(keyword = "match")] //~ ERROR `#[doc(keyword = "...")]` should be used on empty modules
mod foo {
fn hell() {}
}
#[doc(keyword = "hall")] //~ ERROR `#[doc(keyword = "...")]` should be used on modules
#[doc(keyword = "match")] //~ ERROR `#[doc(keyword = "...")]` should be used on modules
fn foo() {}

View file

@ -1,15 +1,3 @@
error: `#[doc(keyword = "...")]` should be used on empty modules
--> $DIR/doc_keyword.rs:6:7
|
LL | #[doc(keyword = "hell")]
| ^^^^^^^^^^^^^^^^
error: `#[doc(keyword = "...")]` should be used on modules
--> $DIR/doc_keyword.rs:11:7
|
LL | #[doc(keyword = "hall")]
| ^^^^^^^^^^^^^^^^
error: nonexistent keyword `tadam` used in `#[doc(keyword = "...")]`
--> $DIR/doc_keyword.rs:22:17
|
@ -18,17 +6,29 @@ LL | #[doc(keyword = "tadam")]
|
= help: only existing keywords are allowed in core/std
error: `#[doc(keyword = "...")]` should be used on empty modules
--> $DIR/doc_keyword.rs:6:7
|
LL | #[doc(keyword = "match")]
| ^^^^^^^
error: `#[doc(keyword = "...")]` should be used on modules
--> $DIR/doc_keyword.rs:11:7
|
LL | #[doc(keyword = "match")]
| ^^^^^^^
error: `#[doc(keyword = "...")]` should be used on modules
--> $DIR/doc_keyword.rs:17:11
|
LL | #[doc(keyword = "match")]
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^
error: `#![doc(keyword = "...")]` isn't allowed as a crate-level attribute
--> $DIR/doc_keyword.rs:4:8
|
LL | #![doc(keyword = "hello")]
| ^^^^^^^^^^^^^^^^^
LL | #![doc(keyword = "match")]
| ^^^^^^^
error: aborting due to 5 previous errors

View file

@ -1,10 +1,10 @@
error: doc alias is duplicated
--> $DIR/duplicate_doc_alias.rs:4:7
--> $DIR/duplicate_doc_alias.rs:4:15
|
LL | #[doc(alias = "A")]
| ----------- first defined here
| --- first defined here
LL | #[doc(alias = "A")]
| ^^^^^^^^^^^
| ^^^
|
note: the lint level is defined here
--> $DIR/duplicate_doc_alias.rs:1:9
@ -16,7 +16,7 @@ error: doc alias is duplicated
--> $DIR/duplicate_doc_alias.rs:6:13
|
LL | #[doc(alias = "B")]
| ----------- first defined here
| --- first defined here
LL | #[doc(alias("B"))]
| ^^^