3 use crate::interface::parse_cfgspecs;
6 use rustc::middle::cstore;
7 use rustc::session::config::{build_configuration, build_session_options, to_crate_config};
8 use rustc::session::config::{LtoCli, LinkerPluginLto, SwitchWithOptPath, ExternEntry};
9 use rustc::session::config::{Externs, OutputType, OutputTypes, SymbolManglingVersion};
10 use rustc::session::config::{rustc_optgroups, Options, ErrorOutputType, Passes};
11 use rustc::session::{build_session, Session};
12 use rustc::session::search_paths::SearchPath;
13 use std::collections::{BTreeMap, BTreeSet};
14 use std::iter::FromIterator;
15 use std::path::PathBuf;
16 use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel};
17 use syntax::symbol::sym;
18 use syntax::edition::{Edition, DEFAULT_EDITION};
20 use rustc_data_structures::fx::FxHashSet;
21 use rustc_errors::{ColorConfig, emitter::HumanReadableErrorType, registry};
23 type CfgSpecs = FxHashSet<(String, Option<String>)>;
25 fn build_session_options_and_crate_config(matches: getopts::Matches) -> (Options, CfgSpecs) {
26 let sessopts = build_session_options(&matches);
27 let cfg = parse_cfgspecs(matches.opt_strs("cfg"));
31 fn mk_session(matches: getopts::Matches) -> (Session, CfgSpecs) {
32 let registry = registry::Registry::new(&[]);
33 let (sessopts, cfg) = build_session_options_and_crate_config(matches);
34 let sess = build_session(sessopts, None, registry);
38 fn new_public_extern_entry<S, I>(locations: I) -> ExternEntry
41 I: IntoIterator<Item = Option<S>>,
43 let locations: BTreeSet<_> = locations.into_iter().map(|o| o.map(|s| s.into()))
52 fn optgroups() -> getopts::Options {
53 let mut opts = getopts::Options::new();
54 for group in rustc_optgroups() {
55 (group.apply)(&mut opts);
60 fn mk_map<K: Ord, V>(entries: Vec<(K, V)>) -> BTreeMap<K, V> {
61 BTreeMap::from_iter(entries.into_iter())
64 // When the user supplies --test we should implicitly supply --cfg test
66 fn test_switch_implies_cfg_test() {
67 syntax::with_default_globals(|| {
68 let matches = optgroups().parse(&["--test".to_string()]).unwrap();
69 let (sess, cfg) = mk_session(matches);
70 let cfg = build_configuration(&sess, to_crate_config(cfg));
71 assert!(cfg.contains(&(sym::test, None)));
75 // When the user supplies --test and --cfg test, don't implicitly add another --cfg test
77 fn test_switch_implies_cfg_test_unless_cfg_test() {
78 syntax::with_default_globals(|| {
79 let matches = optgroups().parse(&["--test".to_string(), "--cfg=test".to_string()]).unwrap();
80 let (sess, cfg) = mk_session(matches);
81 let cfg = build_configuration(&sess, to_crate_config(cfg));
82 let mut test_items = cfg.iter().filter(|&&(name, _)| name == sym::test);
83 assert!(test_items.next().is_some());
84 assert!(test_items.next().is_none());
89 fn test_can_print_warnings() {
90 syntax::with_default_globals(|| {
91 let matches = optgroups().parse(&["-Awarnings".to_string()]).unwrap();
92 let (sess, _) = mk_session(matches);
93 assert!(!sess.diagnostic().can_emit_warnings());
96 syntax::with_default_globals(|| {
97 let matches = optgroups()
98 .parse(&["-Awarnings".to_string(), "-Dwarnings".to_string()])
100 let (sess, _) = mk_session(matches);
101 assert!(sess.diagnostic().can_emit_warnings());
104 syntax::with_default_globals(|| {
105 let matches = optgroups().parse(&["-Adead_code".to_string()]).unwrap();
106 let (sess, _) = mk_session(matches);
107 assert!(sess.diagnostic().can_emit_warnings());
112 fn test_output_types_tracking_hash_different_paths() {
113 let mut v1 = Options::default();
114 let mut v2 = Options::default();
115 let mut v3 = Options::default();
118 OutputTypes::new(&[(OutputType::Exe, Some(PathBuf::from("./some/thing")))]);
120 OutputTypes::new(&[(OutputType::Exe, Some(PathBuf::from("/some/thing")))]);
121 v3.output_types = OutputTypes::new(&[(OutputType::Exe, None)]);
123 assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
124 assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
125 assert!(v2.dep_tracking_hash() != v3.dep_tracking_hash());
128 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
129 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
130 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
134 fn test_output_types_tracking_hash_different_construction_order() {
135 let mut v1 = Options::default();
136 let mut v2 = Options::default();
138 v1.output_types = OutputTypes::new(&[
139 (OutputType::Exe, Some(PathBuf::from("./some/thing"))),
140 (OutputType::Bitcode, Some(PathBuf::from("./some/thing.bc"))),
143 v2.output_types = OutputTypes::new(&[
144 (OutputType::Bitcode, Some(PathBuf::from("./some/thing.bc"))),
145 (OutputType::Exe, Some(PathBuf::from("./some/thing"))),
148 assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());
151 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
155 fn test_externs_tracking_hash_different_construction_order() {
156 let mut v1 = Options::default();
157 let mut v2 = Options::default();
158 let mut v3 = Options::default();
160 v1.externs = Externs::new(mk_map(vec![
163 new_public_extern_entry(vec![Some("b"), Some("c")])
167 new_public_extern_entry(vec![Some("e"), Some("f")])
171 v2.externs = Externs::new(mk_map(vec![
174 new_public_extern_entry(vec![Some("e"), Some("f")])
178 new_public_extern_entry(vec![Some("b"), Some("c")])
182 v3.externs = Externs::new(mk_map(vec![
185 new_public_extern_entry(vec![Some("b"), Some("c")])
189 new_public_extern_entry(vec![Some("f"), Some("e")])
193 assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());
194 assert_eq!(v1.dep_tracking_hash(), v3.dep_tracking_hash());
195 assert_eq!(v2.dep_tracking_hash(), v3.dep_tracking_hash());
198 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
199 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
200 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
204 fn test_lints_tracking_hash_different_values() {
205 let mut v1 = Options::default();
206 let mut v2 = Options::default();
207 let mut v3 = Options::default();
210 (String::from("a"), lint::Allow),
211 (String::from("b"), lint::Warn),
212 (String::from("c"), lint::Deny),
213 (String::from("d"), lint::Forbid),
217 (String::from("a"), lint::Allow),
218 (String::from("b"), lint::Warn),
219 (String::from("X"), lint::Deny),
220 (String::from("d"), lint::Forbid),
224 (String::from("a"), lint::Allow),
225 (String::from("b"), lint::Warn),
226 (String::from("c"), lint::Forbid),
227 (String::from("d"), lint::Deny),
230 assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
231 assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
232 assert!(v2.dep_tracking_hash() != v3.dep_tracking_hash());
235 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
236 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
237 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
241 fn test_lints_tracking_hash_different_construction_order() {
242 let mut v1 = Options::default();
243 let mut v2 = Options::default();
246 (String::from("a"), lint::Allow),
247 (String::from("b"), lint::Warn),
248 (String::from("c"), lint::Deny),
249 (String::from("d"), lint::Forbid),
253 (String::from("a"), lint::Allow),
254 (String::from("c"), lint::Deny),
255 (String::from("b"), lint::Warn),
256 (String::from("d"), lint::Forbid),
259 assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());
262 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
263 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
267 fn test_search_paths_tracking_hash_different_order() {
268 let mut v1 = Options::default();
269 let mut v2 = Options::default();
270 let mut v3 = Options::default();
271 let mut v4 = Options::default();
273 const JSON: ErrorOutputType = ErrorOutputType::Json {
275 json_rendered: HumanReadableErrorType::Default(ColorConfig::Never),
280 .push(SearchPath::from_cli_opt("native=abc", JSON));
282 .push(SearchPath::from_cli_opt("crate=def", JSON));
284 .push(SearchPath::from_cli_opt("dependency=ghi", JSON));
286 .push(SearchPath::from_cli_opt("framework=jkl", JSON));
288 .push(SearchPath::from_cli_opt("all=mno", JSON));
291 .push(SearchPath::from_cli_opt("native=abc", JSON));
293 .push(SearchPath::from_cli_opt("dependency=ghi", JSON));
295 .push(SearchPath::from_cli_opt("crate=def", JSON));
297 .push(SearchPath::from_cli_opt("framework=jkl", JSON));
299 .push(SearchPath::from_cli_opt("all=mno", JSON));
302 .push(SearchPath::from_cli_opt("crate=def", JSON));
304 .push(SearchPath::from_cli_opt("framework=jkl", JSON));
306 .push(SearchPath::from_cli_opt("native=abc", JSON));
308 .push(SearchPath::from_cli_opt("dependency=ghi", JSON));
310 .push(SearchPath::from_cli_opt("all=mno", JSON));
313 .push(SearchPath::from_cli_opt("all=mno", JSON));
315 .push(SearchPath::from_cli_opt("native=abc", JSON));
317 .push(SearchPath::from_cli_opt("crate=def", JSON));
319 .push(SearchPath::from_cli_opt("dependency=ghi", JSON));
321 .push(SearchPath::from_cli_opt("framework=jkl", JSON));
323 assert!(v1.dep_tracking_hash() == v2.dep_tracking_hash());
324 assert!(v1.dep_tracking_hash() == v3.dep_tracking_hash());
325 assert!(v1.dep_tracking_hash() == v4.dep_tracking_hash());
328 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
329 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
330 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
331 assert_eq!(v4.dep_tracking_hash(), v4.clone().dep_tracking_hash());
335 fn test_native_libs_tracking_hash_different_values() {
336 let mut v1 = Options::default();
337 let mut v2 = Options::default();
338 let mut v3 = Options::default();
339 let mut v4 = Options::default();
343 (String::from("a"), None, Some(cstore::NativeStatic)),
344 (String::from("b"), None, Some(cstore::NativeFramework)),
345 (String::from("c"), None, Some(cstore::NativeUnknown)),
350 (String::from("a"), None, Some(cstore::NativeStatic)),
351 (String::from("X"), None, Some(cstore::NativeFramework)),
352 (String::from("c"), None, Some(cstore::NativeUnknown)),
357 (String::from("a"), None, Some(cstore::NativeStatic)),
358 (String::from("b"), None, Some(cstore::NativeStatic)),
359 (String::from("c"), None, Some(cstore::NativeUnknown)),
364 (String::from("a"), None, Some(cstore::NativeStatic)),
367 Some(String::from("X")),
368 Some(cstore::NativeFramework),
370 (String::from("c"), None, Some(cstore::NativeUnknown)),
373 assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
374 assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
375 assert!(v1.dep_tracking_hash() != v4.dep_tracking_hash());
378 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
379 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
380 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
381 assert_eq!(v4.dep_tracking_hash(), v4.clone().dep_tracking_hash());
385 fn test_native_libs_tracking_hash_different_order() {
386 let mut v1 = Options::default();
387 let mut v2 = Options::default();
388 let mut v3 = Options::default();
392 (String::from("a"), None, Some(cstore::NativeStatic)),
393 (String::from("b"), None, Some(cstore::NativeFramework)),
394 (String::from("c"), None, Some(cstore::NativeUnknown)),
398 (String::from("b"), None, Some(cstore::NativeFramework)),
399 (String::from("a"), None, Some(cstore::NativeStatic)),
400 (String::from("c"), None, Some(cstore::NativeUnknown)),
404 (String::from("c"), None, Some(cstore::NativeUnknown)),
405 (String::from("a"), None, Some(cstore::NativeStatic)),
406 (String::from("b"), None, Some(cstore::NativeFramework)),
409 assert!(v1.dep_tracking_hash() == v2.dep_tracking_hash());
410 assert!(v1.dep_tracking_hash() == v3.dep_tracking_hash());
411 assert!(v2.dep_tracking_hash() == v3.dep_tracking_hash());
414 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
415 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
416 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
420 fn test_codegen_options_tracking_hash() {
421 let reference = Options::default();
422 let mut opts = Options::default();
424 // Make sure the changing an [UNTRACKED] option leaves the hash unchanged
425 opts.cg.ar = Some(String::from("abc"));
426 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
428 opts.cg.linker = Some(PathBuf::from("linker"));
429 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
431 opts.cg.link_args = Some(vec![String::from("abc"), String::from("def")]);
432 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
434 opts.cg.link_dead_code = true;
435 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
437 opts.cg.rpath = true;
438 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
440 opts.cg.extra_filename = String::from("extra-filename");
441 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
443 opts.cg.codegen_units = Some(42);
444 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
446 opts.cg.remark = Passes::Some(vec![String::from("pass1"), String::from("pass2")]);
447 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
449 opts.cg.save_temps = true;
450 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
452 opts.cg.incremental = Some(String::from("abc"));
453 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
455 // Make sure changing a [TRACKED] option changes the hash
456 opts = reference.clone();
457 opts.cg.lto = LtoCli::Fat;
458 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
460 opts = reference.clone();
461 opts.cg.target_cpu = Some(String::from("abc"));
462 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
464 opts = reference.clone();
465 opts.cg.target_feature = String::from("all the features, all of them");
466 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
468 opts = reference.clone();
469 opts.cg.passes = vec![String::from("1"), String::from("2")];
470 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
472 opts = reference.clone();
473 opts.cg.llvm_args = vec![String::from("1"), String::from("2")];
474 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
476 opts = reference.clone();
477 opts.cg.overflow_checks = Some(true);
478 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
480 opts = reference.clone();
481 opts.cg.no_prepopulate_passes = true;
482 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
484 opts = reference.clone();
485 opts.cg.no_vectorize_loops = true;
486 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
488 opts = reference.clone();
489 opts.cg.no_vectorize_slp = true;
490 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
492 opts = reference.clone();
493 opts.cg.soft_float = true;
494 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
496 opts = reference.clone();
497 opts.cg.prefer_dynamic = true;
498 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
500 opts = reference.clone();
501 opts.cg.no_integrated_as = true;
502 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
504 opts = reference.clone();
505 opts.cg.no_redzone = Some(true);
506 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
508 opts = reference.clone();
509 opts.cg.relocation_model = Some(String::from("relocation model"));
510 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
512 opts = reference.clone();
513 opts.cg.code_model = Some(String::from("code model"));
514 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
516 opts = reference.clone();
517 opts.debugging_opts.tls_model = Some(String::from("tls model"));
518 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
520 opts = reference.clone();
521 opts.cg.profile_generate = SwitchWithOptPath::Enabled(None);
522 assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
524 opts = reference.clone();
525 opts.cg.profile_use = Some(PathBuf::from("abc"));
526 assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
528 opts = reference.clone();
529 opts.cg.metadata = vec![String::from("A"), String::from("B")];
530 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
532 opts = reference.clone();
533 opts.cg.debuginfo = Some(0xdeadbeef);
534 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
536 opts = reference.clone();
537 opts.cg.debuginfo = Some(0xba5eba11);
538 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
540 opts = reference.clone();
541 opts.cg.force_frame_pointers = Some(false);
542 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
544 opts = reference.clone();
545 opts.cg.debug_assertions = Some(true);
546 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
548 opts = reference.clone();
549 opts.cg.inline_threshold = Some(0xf007ba11);
550 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
552 opts = reference.clone();
553 opts.cg.panic = Some(PanicStrategy::Abort);
554 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
556 opts = reference.clone();
557 opts.cg.linker_plugin_lto = LinkerPluginLto::LinkerPluginAuto;
558 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
562 fn test_debugging_options_tracking_hash() {
563 let reference = Options::default();
564 let mut opts = Options::default();
566 // Make sure the changing an [UNTRACKED] option leaves the hash unchanged
567 opts.debugging_opts.verbose = true;
568 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
569 opts.debugging_opts.time_passes = true;
570 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
571 opts.debugging_opts.time_llvm_passes = true;
572 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
573 opts.debugging_opts.input_stats = true;
574 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
575 opts.debugging_opts.borrowck_stats = true;
576 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
577 opts.debugging_opts.meta_stats = true;
578 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
579 opts.debugging_opts.print_link_args = true;
580 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
581 opts.debugging_opts.print_llvm_passes = true;
582 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
583 opts.debugging_opts.ast_json = true;
584 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
585 opts.debugging_opts.ast_json_noexpand = true;
586 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
587 opts.debugging_opts.ls = true;
588 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
589 opts.debugging_opts.save_analysis = true;
590 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
591 opts.debugging_opts.print_region_graph = true;
592 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
593 opts.debugging_opts.parse_only = true;
594 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
595 opts.debugging_opts.incremental = Some(String::from("abc"));
596 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
597 opts.debugging_opts.dump_dep_graph = true;
598 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
599 opts.debugging_opts.query_dep_graph = true;
600 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
601 opts.debugging_opts.no_analysis = true;
602 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
603 opts.debugging_opts.unstable_options = true;
604 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
605 opts.debugging_opts.trace_macros = true;
606 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
607 opts.debugging_opts.keep_hygiene_data = true;
608 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
609 opts.debugging_opts.keep_ast = true;
610 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
611 opts.debugging_opts.print_mono_items = Some(String::from("abc"));
612 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
613 opts.debugging_opts.dump_mir = Some(String::from("abc"));
614 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
615 opts.debugging_opts.dump_mir_dir = String::from("abc");
616 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
617 opts.debugging_opts.dump_mir_graphviz = true;
618 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
620 // Make sure changing a [TRACKED] option changes the hash
621 opts = reference.clone();
622 opts.debugging_opts.asm_comments = true;
623 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
625 opts = reference.clone();
626 opts.debugging_opts.verify_llvm_ir = true;
627 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
629 opts = reference.clone();
630 opts.debugging_opts.no_landing_pads = true;
631 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
633 opts = reference.clone();
634 opts.debugging_opts.fewer_names = true;
635 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
637 opts = reference.clone();
638 opts.debugging_opts.no_codegen = true;
639 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
641 opts = reference.clone();
642 opts.debugging_opts.treat_err_as_bug = Some(1);
643 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
645 opts = reference.clone();
646 opts.debugging_opts.report_delayed_bugs = true;
647 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
649 opts = reference.clone();
650 opts.debugging_opts.continue_parse_after_error = true;
651 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
653 opts = reference.clone();
654 opts.debugging_opts.extra_plugins = vec![String::from("plugin1"), String::from("plugin2")];
655 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
657 opts = reference.clone();
658 opts.debugging_opts.force_overflow_checks = Some(true);
659 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
661 opts = reference.clone();
662 opts.debugging_opts.show_span = Some(String::from("abc"));
663 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
665 opts = reference.clone();
666 opts.debugging_opts.mir_opt_level = 3;
667 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
669 opts = reference.clone();
670 opts.debugging_opts.relro_level = Some(RelroLevel::Full);
671 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
673 opts = reference.clone();
674 opts.debugging_opts.merge_functions = Some(MergeFunctions::Disabled);
675 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
677 opts = reference.clone();
678 opts.debugging_opts.allow_features = Some(vec![String::from("lang_items")]);
679 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
681 opts = reference.clone();
682 opts.debugging_opts.symbol_mangling_version = SymbolManglingVersion::V0;
683 assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
687 fn test_edition_parsing() {
688 // test default edition
689 let options = Options::default();
690 assert!(options.edition == DEFAULT_EDITION);
692 let matches = optgroups()
693 .parse(&["--edition=2018".to_string()])
695 let (sessopts, _) = build_session_options_and_crate_config(matches);
696 assert!(sessopts.edition == Edition::Edition2018)