File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -705,7 +705,7 @@ fn test_unstable_options_tracking_hash() {
705
705
untracked ! ( ls, vec![ "all" . to_owned( ) ] ) ;
706
706
untracked ! ( macro_backtrace, true ) ;
707
707
untracked ! ( meta_stats, true ) ;
708
- untracked ! ( mir_include_spans, true ) ;
708
+ untracked ! ( mir_include_spans, Some ( true ) ) ;
709
709
untracked ! ( nll_facts, true ) ;
710
710
untracked ! ( no_analysis, true ) ;
711
711
untracked ! ( no_leak_check, true ) ;
Original file line number Diff line number Diff line change @@ -48,13 +48,25 @@ pub enum PassWhere {
48
48
#[ derive( Copy , Clone ) ]
49
49
pub struct PrettyPrintMirOptions {
50
50
/// Whether to include extra comments, like span info. From `-Z mir-include-spans`.
51
- pub include_extra_comments : bool ,
51
+ include_extra_comments : bool ,
52
52
}
53
53
54
54
impl PrettyPrintMirOptions {
55
55
/// Create the default set of MIR pretty-printing options from the CLI flags.
56
56
pub fn from_cli ( tcx : TyCtxt < ' _ > ) -> Self {
57
- Self { include_extra_comments : tcx. sess . opts . unstable_opts . mir_include_spans }
57
+ // We include extra comments only if there's an explicit opt-in, we don't show them by
58
+ // default.
59
+ Self :: from_cli_with_default ( tcx, false )
60
+ }
61
+
62
+ /// Create MIR pretty-printing options from the CLI flags if specified, using a default value
63
+ /// otherwise.
64
+ pub fn from_cli_with_default ( tcx : TyCtxt < ' _ > , include_extra_comments_default : bool ) -> Self {
65
+ // We include extra comments only if there's an explicit opt-in, we don't show them by
66
+ // default.
67
+ let include_extra_comments =
68
+ tcx. sess . opts . unstable_opts . mir_include_spans . unwrap_or ( include_extra_comments_default) ;
69
+ Self { include_extra_comments }
58
70
}
59
71
}
60
72
Original file line number Diff line number Diff line change @@ -1832,7 +1832,7 @@ options! {
1832
1832
specified passes to be enabled, overriding all other checks. In particular, this will \
1833
1833
enable unsound (known-buggy and hence usually disabled) passes without further warning! \
1834
1834
Passes that are not specified are enabled or disabled by other flags as usual.") ,
1835
- mir_include_spans: bool = ( false , parse_bool , [ UNTRACKED ] ,
1835
+ mir_include_spans: Option < bool > = ( None , parse_opt_bool , [ UNTRACKED ] ,
1836
1836
"use line numbers relative to the function in mir pretty printing" ) ,
1837
1837
mir_keep_place_mention: bool = ( false , parse_bool, [ TRACKED ] ,
1838
1838
"keep place mention MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
You can’t perform that action at this time.
0 commit comments