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() {
705705 untracked ! ( ls, vec![ "all" . to_owned( ) ] ) ;
706706 untracked ! ( macro_backtrace, true ) ;
707707 untracked ! ( meta_stats, true ) ;
708- untracked ! ( mir_include_spans, true ) ;
708+ untracked ! ( mir_include_spans, Some ( true ) ) ;
709709 untracked ! ( nll_facts, true ) ;
710710 untracked ! ( no_analysis, true ) ;
711711 untracked ! ( no_leak_check, true ) ;
Original file line number Diff line number Diff line change @@ -48,13 +48,25 @@ pub enum PassWhere {
4848#[ derive( Copy , Clone ) ]
4949pub struct PrettyPrintMirOptions {
5050 /// Whether to include extra comments, like span info. From `-Z mir-include-spans`.
51- pub include_extra_comments : bool ,
51+ include_extra_comments : bool ,
5252}
5353
5454impl PrettyPrintMirOptions {
5555 /// Create the default set of MIR pretty-printing options from the CLI flags.
5656 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 }
5870 }
5971}
6072
Original file line number Diff line number Diff line change @@ -1832,7 +1832,7 @@ options! {
18321832 specified passes to be enabled, overriding all other checks. In particular, this will \
18331833 enable unsound (known-buggy and hence usually disabled) passes without further warning! \
18341834 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 ] ,
18361836 "use line numbers relative to the function in mir pretty printing" ) ,
18371837 mir_keep_place_mention: bool = ( false , parse_bool, [ TRACKED ] ,
18381838 "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