@@ -646,25 +646,55 @@ where R: 'static + Send,
646
646
647
647
krate. version = crate_version;
648
648
649
+ let diag = core:: new_handler ( error_format, None ) ;
650
+
651
+ fn report_deprecated_attr ( name : & str , diag : & errors:: Handler ) {
652
+ let mut msg = diag. struct_warn ( & format ! ( "WARNING: the `#![doc({})]` attribute is \
653
+ considered deprecated", name) ) ;
654
+ msg. warn ( "please see https://github.com/rust-lang/rust/issues/44136" ) ;
655
+
656
+ if name == "no_default_passes" {
657
+ msg. help ( "you may want to use `#![doc(document_private_items)]`" ) ;
658
+ }
659
+
660
+ msg. emit ( ) ;
661
+ }
662
+
649
663
// Process all of the crate attributes, extracting plugin metadata along
650
664
// with the passes which we are supposed to run.
651
665
for attr in krate. module . as_ref ( ) . unwrap ( ) . attrs . lists ( "doc" ) {
652
666
let name = attr. name ( ) . map ( |s| s. as_str ( ) ) ;
653
667
let name = name. as_ref ( ) . map ( |s| & s[ ..] ) ;
654
668
if attr. is_word ( ) {
655
669
if name == Some ( "no_default_passes" ) {
670
+ report_deprecated_attr ( "no_default_passes" , & diag) ;
656
671
default_passes = false ;
657
672
}
658
673
} else if let Some ( value) = attr. value_str ( ) {
659
674
let sink = match name {
660
- Some ( "passes" ) => & mut passes,
661
- Some ( "plugins" ) => & mut plugins,
675
+ Some ( "passes" ) => {
676
+ report_deprecated_attr ( "passes = \" ...\" " , & diag) ;
677
+ & mut passes
678
+ } ,
679
+ Some ( "plugins" ) => {
680
+ report_deprecated_attr ( "plugins = \" ...\" " , & diag) ;
681
+ & mut plugins
682
+ } ,
662
683
_ => continue ,
663
684
} ;
664
685
for p in value. as_str ( ) . split_whitespace ( ) {
665
686
sink. push ( p. to_string ( ) ) ;
666
687
}
667
688
}
689
+
690
+ if attr. is_word ( ) && name == Some ( "document_private_items" ) {
691
+ default_passes = false ;
692
+
693
+ passes = vec ! [
694
+ String :: from( "collapse-docs" ) ,
695
+ String :: from( "unindent-comments" ) ,
696
+ ] ;
697
+ }
668
698
}
669
699
670
700
if default_passes {
0 commit comments