Change:
Look for example to It is deprecated, and in source code there is hint what should be used instead: but in generated html documentation there is no hint about
isn't the correct syntax for the attribute. It should be . You can see it work: . This isn't a rustdoc issue. It's an issue with rustc that it doesn't reject .

Discussion:
let diagnostic = &sess.span_diagnostic; 'outer: for attr in attrs_iter { <del> if attr.path != "deprecated" { continue </del> <ins> if !attr.check_name("deprecated") { continue; </ins> } <del> mark_used(attr); </del> if depr.is_some() { span_err!(diagnostic, item_sp, E0550, "multiple deprecated attributes"); break } <del> depr = if let Some(metas) = attr.meta_item_list() { let get = |meta: &MetaItem, item: &mut Option<Symbol>| { if item.is_some() { handle_errors(sess, meta.span, AttrError::MultipleItem(meta.name())); return false } if let Some(v) = meta.value_str() { *item = Some(v); true } else { if let Some(lit) = meta.name_value_literal() { handle_errors( sess, lit.span, AttrError::UnsupportedLiteral( "literal in `deprecated`  value must be a string", lit.node.is_bytestr() ), ); } else { span_err!(diagnostic, meta.span, E0551, "incorrect meta item"); </del> <ins> let meta = attr.meta().unwrap(); depr = match &meta.node { MetaItemKind::Word => Some(Deprecation { since: None, note: None }), MetaItemKind::NameValue(..) => { meta.value_str().map(|note| { Deprecation { since: None, note: Some(note) } }) } MetaItemKind::List(list) => { let get = |meta: &MetaItem, item: &mut Option<Symbol>| { if item.is_some() { handle_errors(sess, meta.span, AttrError::MultipleItem(meta.name())); return false </ins> } <ins> if let Some(v) = meta.value_str() { *item = Some(v); true } else { if let Some(lit) = meta.name_value_literal() { handle_errors( sess, lit.span, AttrError::UnsupportedLiteral( "literal in `deprecated`  value must be a string", lit.node.is_bytestr() ), ); } else { span_err!(diagnostic, meta.span, E0551, "incorrect meta item"); } </ins> <del> false } }; </del> <ins> false } }; </ins> <del> let mut since = None; let mut note = None; for meta in metas { match &meta.node { NestedMetaItemKind::MetaItem(mi) => { match &*mi.name().as_str() { "since" => if !get(mi, &mut since) { continue 'outer }, "note" => if !get(mi, &mut note) { continue 'outer }, _ => { handle_errors( sess, meta.span, AttrError::UnknownMetaItem(mi.name(), &["since", "note"]), ); continue 'outer </del> <ins> let mut since = None; let mut note = None; for meta in list { match &meta.node { NestedMetaItemKind::MetaItem(mi) => { match &*mi.name().as_str() { "since" => if !get(mi, &mut since) { continue 'outer }, "note" => if !get(mi, &mut note) { continue 'outer }, _ => { handle_errors( sess, meta.span, AttrError::UnknownMetaItem(mi.name(), &["since", "note"]), ); continue 'outer } </ins> } } <del> } NestedMetaItemKind::Literal(lit) => { handle_errors( sess, lit.span, AttrError::UnsupportedLiteral( "item in `deprecated` must be a key/value pair", false, ), ); continue 'outer </del> <ins> NestedMetaItemKind::Literal(lit) => { handle_errors( sess, lit.span, AttrError::UnsupportedLiteral( "item in `deprecated` must be a key/value pair", false, ), ); continue 'outer } </ins> } } <del> } Some(Deprecation {since: since, note: note}) } else { Some(Deprecation{since: None, note: None}) } </del> <ins> Some(Deprecation { since, note }) } }; </ins> } depr

} impl Attribute { <ins> /// Returns `true` if the attribute's path matches the argument. If it matches, then the /// attribute is marked as used. /// /// To check the attribute name without marking it used, use the `path` field directly. </ins> pub fn check_name(&self, name: &str) -> bool { let matches = self.path == name; if matches {

("stable", Whitelisted, template!(List: r#"feature = "name", since = "version""#), Ungated), ("unstable", Whitelisted, template!(List: r#"feature = "name", reason = "...", issue = "N""#), Ungated), <del> ("deprecated", Normal, template!(Word, List: r#"/*opt*/ since = "version", /*opt*/ note = "reason"#, NameValueStr: "reason"), Ungated), </del> <ins> ("deprecated", Normal, template!( Word, List: r#"/*opt*/ since = "version", /*opt*/ note = "reason"#, NameValueStr: "reason" ), Ungated ), </ins> ("rustc_paren_sugar", Normal, template!(Word), Gated(Stability::Unstable, "unboxed_closures",

//      'Deprecated$' #[deprecated] pub struct W; <ins> // @matches deprecated/struct.X.html '//*[@class="stab deprecated"]'  //      'Deprecated: shorthand reason$' #[deprecated = "shorthand reason"] pub struct X; </ins>

#[deprecated(since(b), note = "a")] //~ ERROR incorrect meta item fn f6() { } <ins> #[deprecated(note = b"test")] //~ ERROR literal in `deprecated` value must be a string fn f7() { } #[deprecated("test")] //~ ERROR item in `deprecated` must be a key/value pair fn f8() { } </ins> } #[deprecated(since = "a", note = "b")]

LL |     #[deprecated(since(b), note = "a")] //~ ERROR incorrect meta item |                  ^^^^^^^^ <ins> error[E0565]: literal in `deprecated` value must be a string --> $DIR/deprecation-sanity.rs:19:25 | LL |     #[deprecated(note = b"test")] //~ ERROR literal in `deprecated` value must be a string |                         ^^^^^^^ help: consider removing the prefix: `"test"` error[E0565]: item in `deprecated` must be a key/value pair --> $DIR/deprecation-sanity.rs:22:18 | LL |     #[deprecated("test")] //~ ERROR item in `deprecated` must be a key/value pair |                  ^^^^^^ </ins> error[E0550]: multiple deprecated attributes <del> --> $DIR/deprecation-sanity.rs:22:1 </del> <ins> --> $DIR/deprecation-sanity.rs:28:1 </ins> | LL | fn multiple1() { } //~ ERROR multiple deprecated attributes | ^^^^^^^^^^^^^^^^^^ error[E0538]: multiple 'since' items <del> --> $DIR/deprecation-sanity.rs:24:27 </del> <ins> --> $DIR/deprecation-sanity.rs:30:27 </ins> | LL | #[deprecated(since = "a", since = "b", note = "c")] //~ ERROR multiple 'since' items |                           ^^^^^^^^^^^ <del> error: aborting due to 7 previous errors </del> <ins> error: aborting due to 9 previous errors </ins> <del> Some errors occurred: E0538, E0541, E0550, E0551. </del> <ins> Some errors occurred: E0538, E0541, E0550, E0551, E0565. </ins> For more information about an error, try `rustc --explain E0538`.

<ins> #[deprecated = b"test"] //~ ERROR attribute must be of the form fn foo() {} fn main() {} </ins>

<ins> error: attribute must be of the form `#[deprecated]` or `#[deprecated(/*opt*/ since = "version", /*opt*/ note = "reason)]` or `#[deprecated = "reason"]` --> $DIR/invalid-literal.rs:1:1 | LL | #[deprecated = b"test"] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error </ins>