Skip to content

Commit 7314c85

Browse files
committed
---
yaml --- r: 171619 b: refs/heads/batch c: 7e87ea9 h: refs/heads/master i: 171617: 20493f9 171615: 2e058df v: v3
1 parent 6b0894d commit 7314c85

File tree

11 files changed

+119
-169
lines changed

11 files changed

+119
-169
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
3030
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32-
refs/heads/batch: 3248bc5bd0384712e70f67eb90daa38ae5e5a21f
32+
refs/heads/batch: 7e87ea9fc5c3ab5d6c853e6d3ae0603f19526eb4
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 496dc4eae7de9d14cd49511a9acfbf5f11ae6c3f
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928

branches/batch/src/librustc/middle/infer/region_inference/graphviz.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use middle::ty;
2222
use super::Constraint;
2323
use middle::infer::SubregionOrigin;
2424
use middle::infer::region_inference::RegionVarBindings;
25-
use session::config;
2625
use util::nodemap::{FnvHashMap, FnvHashSet};
2726
use util::ppaux::Repr;
2827

@@ -55,7 +54,7 @@ pub fn maybe_print_constraints_for<'a, 'tcx>(region_vars: &RegionVarBindings<'a,
5554
subject_node: ast::NodeId) {
5655
let tcx = region_vars.tcx;
5756

58-
if !region_vars.tcx.sess.debugging_opt(config::PRINT_REGION_GRAPH) {
57+
if !region_vars.tcx.sess.opts.debugging_opts.print_region_graph {
5958
return;
6059
}
6160

branches/batch/src/librustc/session/config.rs

Lines changed: 79 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub struct Options {
9999
pub parse_only: bool,
100100
pub no_trans: bool,
101101
pub no_analysis: bool,
102-
pub debugging_opts: u64,
102+
pub debugging_opts: DebuggingOptions,
103103
/// Whether to write dependency files. It's (enabled, optional filename).
104104
pub write_dependency_info: (bool, Option<Path>),
105105
pub prints: Vec<PrintRequest>,
@@ -224,7 +224,7 @@ pub fn basic_options() -> Options {
224224
parse_only: false,
225225
no_trans: false,
226226
no_analysis: false,
227-
debugging_opts: 0,
227+
debugging_opts: basic_debugging_options(),
228228
write_dependency_info: (false, None),
229229
prints: Vec::new(),
230230
cg: basic_codegen_options(),
@@ -257,103 +257,6 @@ pub enum CrateType {
257257
CrateTypeStaticlib,
258258
}
259259

260-
macro_rules! debugging_opts {
261-
([ $opt:ident ] $cnt:expr ) => (
262-
pub const $opt: u64 = 1 << $cnt;
263-
);
264-
([ $opt:ident, $($rest:ident),* ] $cnt:expr ) => (
265-
pub const $opt: u64 = 1 << $cnt;
266-
debugging_opts! { [ $($rest),* ] $cnt + 1 }
267-
)
268-
}
269-
270-
debugging_opts! {
271-
[
272-
VERBOSE,
273-
TIME_PASSES,
274-
COUNT_LLVM_INSNS,
275-
TIME_LLVM_PASSES,
276-
TRANS_STATS,
277-
ASM_COMMENTS,
278-
NO_VERIFY,
279-
BORROWCK_STATS,
280-
NO_LANDING_PADS,
281-
DEBUG_LLVM,
282-
COUNT_TYPE_SIZES,
283-
META_STATS,
284-
GC,
285-
PRINT_LINK_ARGS,
286-
PRINT_LLVM_PASSES,
287-
AST_JSON,
288-
AST_JSON_NOEXPAND,
289-
LS,
290-
SAVE_ANALYSIS,
291-
PRINT_MOVE_FRAGMENTS,
292-
FLOWGRAPH_PRINT_LOANS,
293-
FLOWGRAPH_PRINT_MOVES,
294-
FLOWGRAPH_PRINT_ASSIGNS,
295-
FLOWGRAPH_PRINT_ALL,
296-
PRINT_REGION_GRAPH,
297-
PARSE_ONLY,
298-
NO_TRANS,
299-
NO_ANALYSIS,
300-
UNSTABLE_OPTIONS,
301-
PRINT_ENUM_SIZES
302-
]
303-
0
304-
}
305-
306-
pub fn debugging_opts_map() -> Vec<(&'static str, &'static str, u64)> {
307-
vec![("verbose", "in general, enable more debug printouts", VERBOSE),
308-
("time-passes", "measure time of each rustc pass", TIME_PASSES),
309-
("count-llvm-insns", "count where LLVM \
310-
instrs originate", COUNT_LLVM_INSNS),
311-
("time-llvm-passes", "measure time of each LLVM pass",
312-
TIME_LLVM_PASSES),
313-
("trans-stats", "gather trans statistics", TRANS_STATS),
314-
("asm-comments", "generate comments into the assembly (may change behavior)",
315-
ASM_COMMENTS),
316-
("no-verify", "skip LLVM verification", NO_VERIFY),
317-
("borrowck-stats", "gather borrowck statistics", BORROWCK_STATS),
318-
("no-landing-pads", "omit landing pads for unwinding",
319-
NO_LANDING_PADS),
320-
("debug-llvm", "enable debug output from LLVM", DEBUG_LLVM),
321-
("count-type-sizes", "count the sizes of aggregate types",
322-
COUNT_TYPE_SIZES),
323-
("meta-stats", "gather metadata statistics", META_STATS),
324-
("print-link-args", "Print the arguments passed to the linker",
325-
PRINT_LINK_ARGS),
326-
("gc", "Garbage collect shared data (experimental)", GC),
327-
("print-llvm-passes",
328-
"Prints the llvm optimization passes being run",
329-
PRINT_LLVM_PASSES),
330-
("ast-json", "Print the AST as JSON and halt", AST_JSON),
331-
("ast-json-noexpand", "Print the pre-expansion AST as JSON and halt", AST_JSON_NOEXPAND),
332-
("ls", "List the symbols defined by a library crate", LS),
333-
("save-analysis", "Write syntax and type analysis information \
334-
in addition to normal output", SAVE_ANALYSIS),
335-
("print-move-fragments", "Print out move-fragment data for every fn",
336-
PRINT_MOVE_FRAGMENTS),
337-
("flowgraph-print-loans", "Include loan analysis data in \
338-
--pretty flowgraph output", FLOWGRAPH_PRINT_LOANS),
339-
("flowgraph-print-moves", "Include move analysis data in \
340-
--pretty flowgraph output", FLOWGRAPH_PRINT_MOVES),
341-
("flowgraph-print-assigns", "Include assignment analysis data in \
342-
--pretty flowgraph output", FLOWGRAPH_PRINT_ASSIGNS),
343-
("flowgraph-print-all", "Include all dataflow analysis data in \
344-
--pretty flowgraph output", FLOWGRAPH_PRINT_ALL),
345-
("print-region-graph", "Prints region inference graph. \
346-
Use with RUST_REGION_GRAPH=help for more info",
347-
PRINT_REGION_GRAPH),
348-
("parse-only", "Parse only; do not compile, assemble, or link", PARSE_ONLY),
349-
("no-trans", "Run all passes except translation; no output", NO_TRANS),
350-
("no-analysis", "Parse and expand the source, but run no analysis and",
351-
NO_ANALYSIS),
352-
("unstable-options", "Adds unstable command line options to rustc interface",
353-
UNSTABLE_OPTIONS),
354-
("print-enum-sizes", "Print the size of enums and their variants", PRINT_ENUM_SIZES),
355-
]
356-
}
357260

358261
#[derive(Clone)]
359262
pub enum Passes {
@@ -387,6 +290,7 @@ macro_rules! options {
387290
$($opt:ident : $t:ty = ($init:expr, $parse:ident, $desc:expr)),* ,) =>
388291
(
389292
#[derive(Clone)]
293+
#[allow(missing_copy_implementations)]
390294
pub struct $struct_name { $(pub $opt: $t),* }
391295

392296
pub fn $defaultfn() -> $struct_name {
@@ -439,7 +343,7 @@ macro_rules! options {
439343
Option<&'static str>, &'static str)] =
440344
&[ $( (stringify!($opt), $mod_set::$opt, $mod_desc::$parse, $desc) ),* ];
441345

442-
#[allow(non_upper_case_globals)]
346+
#[allow(non_upper_case_globals, dead_code)]
443347
mod $mod_desc {
444348
pub const parse_bool: Option<&'static str> = None;
445349
pub const parse_opt_bool: Option<&'static str> = None;
@@ -454,6 +358,7 @@ macro_rules! options {
454358
Some("a number");
455359
}
456360

361+
#[allow(dead_code)]
457362
mod $mod_set {
458363
use super::{$struct_name, Passes, SomePasses, AllPasses};
459364

@@ -608,6 +513,73 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
608513
"Optimize with possible levels 0-3"),
609514
}
610515

516+
517+
options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
518+
build_debugging_options, "Z", "debugging",
519+
DB_OPTIONS, db_type_desc, dbsetters,
520+
verbose: bool = (false, parse_bool,
521+
"in general, enable more debug printouts"),
522+
time_passes: bool = (false, parse_bool,
523+
"measure time of each rustc pass"),
524+
count_llvm_insns: bool = (false, parse_bool,
525+
"count where LLVM instrs originate"),
526+
time_llvm_passes: bool = (false, parse_bool,
527+
"measure time of each LLVM pass"),
528+
trans_stats: bool = (false, parse_bool,
529+
"gather trans statistics"),
530+
asm_comments: bool = (false, parse_bool,
531+
"generate comments into the assembly (may change behavior)"),
532+
no_verify: bool = (false, parse_bool,
533+
"skip LLVM verification"),
534+
borrowck_stats: bool = (false, parse_bool,
535+
"gather borrowck statistics"),
536+
no_landing_pads: bool = (false, parse_bool,
537+
"omit landing pads for unwinding"),
538+
debug_llvm: bool = (false, parse_bool,
539+
"enable debug output from LLVM"),
540+
count_type_sizes: bool = (false, parse_bool,
541+
"count the sizes of aggregate types"),
542+
meta_stats: bool = (false, parse_bool,
543+
"gather metadata statistics"),
544+
print_link_args: bool = (false, parse_bool,
545+
"Print the arguments passed to the linker"),
546+
gc: bool = (false, parse_bool,
547+
"Garbage collect shared data (experimental)"),
548+
print_llvm_passes: bool = (false, parse_bool,
549+
"Prints the llvm optimization passes being run"),
550+
ast_json: bool = (false, parse_bool,
551+
"Print the AST as JSON and halt"),
552+
ast_json_noexpand: bool = (false, parse_bool,
553+
"Print the pre-expansion AST as JSON and halt"),
554+
ls: bool = (false, parse_bool,
555+
"List the symbols defined by a library crate"),
556+
save_analysis: bool = (false, parse_bool,
557+
"Write syntax and type analysis information in addition to normal output"),
558+
print_move_fragments: bool = (false, parse_bool,
559+
"Print out move-fragment data for every fn"),
560+
flowgraph_print_loans: bool = (false, parse_bool,
561+
"Include loan analysis data in --pretty flowgraph output"),
562+
flowgraph_print_moves: bool = (false, parse_bool,
563+
"Include move analysis data in --pretty flowgraph output"),
564+
flowgraph_print_assigns: bool = (false, parse_bool,
565+
"Include assignment analysis data in --pretty flowgraph output"),
566+
flowgraph_print_all: bool = (false, parse_bool,
567+
"Include all dataflow analysis data in --pretty flowgraph output"),
568+
print_region_graph: bool = (false, parse_bool,
569+
"Prints region inference graph. \
570+
Use with RUST_REGION_GRAPH=help for more info"),
571+
parse_only: bool = (false, parse_bool,
572+
"Parse only; do not compile, assemble, or link"),
573+
no_trans: bool = (false, parse_bool,
574+
"Run all passes except translation; no output"),
575+
no_analysis: bool = (false, parse_bool,
576+
"Parse and expand the source, but run no analysis"),
577+
unstable_options: bool = (false, parse_bool,
578+
"Adds unstable command line options to rustc interface"),
579+
print_enum_sizes: bool = (false, parse_bool,
580+
"Print the size of enums and their variants"),
581+
}
582+
611583
pub fn default_lib_output() -> CrateType {
612584
CrateTypeRlib
613585
}
@@ -883,52 +855,36 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
883855
}
884856
}
885857

886-
let mut debugging_opts = 0;
887-
let debug_flags = matches.opt_strs("Z");
888-
let debug_map = debugging_opts_map();
889-
for debug_flag in debug_flags.iter() {
890-
let mut this_bit = 0;
891-
for &(name, _, bit) in debug_map.iter() {
892-
if name == *debug_flag {
893-
this_bit = bit;
894-
break;
895-
}
896-
}
897-
if this_bit == 0 {
898-
early_error(&format!("unknown debug flag: {}",
899-
*debug_flag)[])
900-
}
901-
debugging_opts |= this_bit;
902-
}
858+
let debugging_opts = build_debugging_options(matches);
903859

904860
let parse_only = if matches.opt_present("parse-only") {
905861
// FIXME(acrichto) remove this eventually
906862
early_warn("--parse-only is deprecated in favor of -Z parse-only");
907863
true
908864
} else {
909-
debugging_opts & PARSE_ONLY != 0
865+
debugging_opts.parse_only
910866
};
911867
let no_trans = if matches.opt_present("no-trans") {
912868
// FIXME(acrichto) remove this eventually
913869
early_warn("--no-trans is deprecated in favor of -Z no-trans");
914870
true
915871
} else {
916-
debugging_opts & NO_TRANS != 0
872+
debugging_opts.no_trans
917873
};
918874
let no_analysis = if matches.opt_present("no-analysis") {
919875
// FIXME(acrichto) remove this eventually
920876
early_warn("--no-analysis is deprecated in favor of -Z no-analysis");
921877
true
922878
} else {
923-
debugging_opts & NO_ANALYSIS != 0
879+
debugging_opts.no_analysis
924880
};
925881

926-
if debugging_opts & DEBUG_LLVM != 0 {
882+
if debugging_opts.debug_llvm {
927883
unsafe { llvm::LLVMSetDebug(1); }
928884
}
929885

930886
let mut output_types = Vec::new();
931-
if !parse_only && !no_trans {
887+
if !debugging_opts.parse_only && !no_trans {
932888
let unparsed_output_types = matches.opt_strs("emit");
933889
for unparsed_output_type in unparsed_output_types.iter() {
934890
for part in unparsed_output_type.split(',') {
@@ -998,7 +954,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
998954
}
999955
}
1000956
};
1001-
let gc = debugging_opts & GC != 0;
957+
let gc = debugging_opts.gc;
1002958
let debuginfo = if matches.opt_present("g") {
1003959
if matches.opt_present("debuginfo") {
1004960
early_error("-g and --debuginfo both provided");

branches/batch/src/librustc/session/mod.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ impl Session {
164164
pub fn diagnostic<'a>(&'a self) -> &'a diagnostic::SpanHandler {
165165
&self.parse_sess.span_diagnostic
166166
}
167-
pub fn debugging_opt(&self, opt: u64) -> bool {
168-
(self.opts.debugging_opts & opt) != 0
169-
}
170167
pub fn codemap<'a>(&'a self) -> &'a codemap::CodeMap {
171168
&self.parse_sess.span_diagnostic.cm
172169
}
@@ -176,36 +173,36 @@ impl Session {
176173
self.span_bug(sp,
177174
&format!("impossible case reached: {}", msg)[]);
178175
}
179-
pub fn verbose(&self) -> bool { self.debugging_opt(config::VERBOSE) }
180-
pub fn time_passes(&self) -> bool { self.debugging_opt(config::TIME_PASSES) }
176+
pub fn verbose(&self) -> bool { self.opts.debugging_opts.verbose }
177+
pub fn time_passes(&self) -> bool { self.opts.debugging_opts.time_passes }
181178
pub fn count_llvm_insns(&self) -> bool {
182-
self.debugging_opt(config::COUNT_LLVM_INSNS)
179+
self.opts.debugging_opts.count_llvm_insns
183180
}
184181
pub fn count_type_sizes(&self) -> bool {
185-
self.debugging_opt(config::COUNT_TYPE_SIZES)
182+
self.opts.debugging_opts.count_type_sizes
186183
}
187184
pub fn time_llvm_passes(&self) -> bool {
188-
self.debugging_opt(config::TIME_LLVM_PASSES)
185+
self.opts.debugging_opts.time_llvm_passes
189186
}
190-
pub fn trans_stats(&self) -> bool { self.debugging_opt(config::TRANS_STATS) }
191-
pub fn meta_stats(&self) -> bool { self.debugging_opt(config::META_STATS) }
192-
pub fn asm_comments(&self) -> bool { self.debugging_opt(config::ASM_COMMENTS) }
193-
pub fn no_verify(&self) -> bool { self.debugging_opt(config::NO_VERIFY) }
194-
pub fn borrowck_stats(&self) -> bool { self.debugging_opt(config::BORROWCK_STATS) }
187+
pub fn trans_stats(&self) -> bool { self.opts.debugging_opts.trans_stats }
188+
pub fn meta_stats(&self) -> bool { self.opts.debugging_opts.meta_stats }
189+
pub fn asm_comments(&self) -> bool { self.opts.debugging_opts.asm_comments }
190+
pub fn no_verify(&self) -> bool { self.opts.debugging_opts.no_verify }
191+
pub fn borrowck_stats(&self) -> bool { self.opts.debugging_opts.borrowck_stats }
195192
pub fn print_llvm_passes(&self) -> bool {
196-
self.debugging_opt(config::PRINT_LLVM_PASSES)
193+
self.opts.debugging_opts.print_llvm_passes
197194
}
198195
pub fn lto(&self) -> bool {
199196
self.opts.cg.lto
200197
}
201198
pub fn no_landing_pads(&self) -> bool {
202-
self.debugging_opt(config::NO_LANDING_PADS)
199+
self.opts.debugging_opts.no_landing_pads
203200
}
204201
pub fn unstable_options(&self) -> bool {
205-
self.debugging_opt(config::UNSTABLE_OPTIONS)
202+
self.opts.debugging_opts.unstable_options
206203
}
207204
pub fn print_enum_sizes(&self) -> bool {
208-
self.debugging_opt(config::PRINT_ENUM_SIZES)
205+
self.opts.debugging_opts.print_enum_sizes
209206
}
210207
pub fn sysroot<'a>(&'a self) -> &'a Path {
211208
match self.opts.maybe_sysroot {

branches/batch/src/librustc_borrowck/borrowck/fragments.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use borrowck::LoanPathKind::{LpVar, LpUpvar, LpDowncast, LpExtend};
1919
use borrowck::LoanPathElem::{LpDeref, LpInterior};
2020
use borrowck::move_data::{InvalidMovePathIndex};
2121
use borrowck::move_data::{MoveData, MovePathIndex};
22-
use rustc::session::config;
2322
use rustc::middle::ty;
2423
use rustc::middle::mem_categorization as mc;
2524
use rustc::util::ppaux::{Repr, UserString};
@@ -133,7 +132,7 @@ pub fn instrument_move_fragments<'tcx>(this: &MoveData<'tcx>,
133132

134133
let span_err =
135134
attrs.iter().any(|a| a.check_name("rustc_move_fragments"));
136-
let print = tcx.sess.debugging_opt(config::PRINT_MOVE_FRAGMENTS);
135+
let print = tcx.sess.opts.debugging_opts.print_move_fragments;
137136

138137
(span_err, print)
139138
};

0 commit comments

Comments
 (0)