@@ -314,6 +314,12 @@ impl<'tcx> ChangeType<'tcx> {
314
314
FnConstChanged { now_const : true } => NonBreaking ,
315
315
}
316
316
}
317
+
318
+ /// Get a detailed explanation of a change, and why it is categorized as-is.
319
+ fn explanation ( & self ) -> & ' static str {
320
+ // TODO: meaningful explanations
321
+ "test"
322
+ }
317
323
}
318
324
319
325
impl < ' a > fmt:: Display for ChangeType < ' a > {
@@ -485,7 +491,7 @@ impl<'tcx> Change<'tcx> {
485
491
}
486
492
487
493
/// Report the change in a structured manner, using rustc's error reporting capabilities.
488
- fn report ( & self , session : & Session ) {
494
+ fn report ( & self , session : & Session , verbose : bool ) {
489
495
if self . max == Patch || !self . output {
490
496
return ;
491
497
}
@@ -499,7 +505,12 @@ impl<'tcx> Change<'tcx> {
499
505
500
506
for change in & self . changes {
501
507
let cat = change. 0 . to_category ( ) ;
502
- let sub_msg = format ! ( "{} ({})" , change. 0 , cat) ;
508
+ let sub_msg = if verbose {
509
+ format ! ( "{} ({}):\n {}" , change. 0 , cat, change. 0 . explanation( ) )
510
+ } else {
511
+ format ! ( "{} ({})" , change. 0 , cat)
512
+ } ;
513
+
503
514
if let Some ( span) = change. 1 {
504
515
if cat == Breaking {
505
516
builder. span_warn ( span, & sub_msg) ;
@@ -661,7 +672,7 @@ impl<'tcx> ChangeSet<'tcx> {
661
672
}
662
673
663
674
/// Format the contents of a change set for user output.
664
- pub fn output ( & self , session : & Session , version : & str ) {
675
+ pub fn output ( & self , session : & Session , version : & str , verbose : bool ) {
665
676
if let Ok ( mut new_version) = Version :: parse ( version) {
666
677
match self . max {
667
678
Patch => new_version. increment_patch ( ) ,
@@ -680,7 +691,7 @@ impl<'tcx> ChangeSet<'tcx> {
680
691
}
681
692
682
693
if let Some ( change) = self . changes . get ( key) {
683
- change. report ( session) ;
694
+ change. report ( session, verbose ) ;
684
695
}
685
696
}
686
697
}
0 commit comments