1 use crate::interface::parse_cfgspecs;
3 use rustc_data_structures::fx::FxHashSet;
4 use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig};
5 use rustc_session::config::Strip;
6 use rustc_session::config::{build_configuration, build_session_options, to_crate_config};
7 use rustc_session::config::{rustc_optgroups, ErrorOutputType, ExternLocation, Options, Passes};
8 use rustc_session::config::{CFGuard, ExternEntry, LinkerPluginLto, LtoCli, SwitchWithOptPath};
9 use rustc_session::config::{
10 Externs, OutputType, OutputTypes, SanitizerSet, SymbolManglingVersion, WasiExecModel,
12 use rustc_session::lint::Level;
13 use rustc_session::search_paths::SearchPath;
14 use rustc_session::utils::{CanonicalizedPath, NativeLibKind};
15 use rustc_session::{build_session, getopts, DiagnosticOutput, Session};
16 use rustc_span::edition::{Edition, DEFAULT_EDITION};
17 use rustc_span::symbol::sym;
18 use rustc_span::SourceFileHashAlgorithm;
19 use rustc_target::spec::{CodeModel, LinkerFlavor, MergeFunctions, PanicStrategy};
20 use rustc_target::spec::{RelocModel, RelroLevel, SplitDebuginfo, TlsModel};
21 use std::collections::{BTreeMap, BTreeSet};
22 use std::iter::FromIterator;
23 use std::path::{Path, PathBuf};
25 type CfgSpecs = FxHashSet<(String, Option<String>)>;
27 fn build_session_options_and_crate_config(matches: getopts::Matches) -> (Options, CfgSpecs) {
28 let sessopts = build_session_options(&matches);
29 let cfg = parse_cfgspecs(matches.opt_strs("cfg"));
33 fn mk_session(matches: getopts::Matches) -> (Session, CfgSpecs) {
34 let registry = registry::Registry::new(&[]);
35 let (sessopts, cfg) = build_session_options_and_crate_config(matches);
36 let sess = build_session(
40 DiagnosticOutput::Default,
48 fn new_public_extern_entry<S, I>(locations: I) -> ExternEntry
51 I: IntoIterator<Item = S>,
53 let locations: BTreeSet<CanonicalizedPath> =
54 locations.into_iter().map(|s| CanonicalizedPath::new(Path::new(&s.into()))).collect();
57 location: ExternLocation::ExactPaths(locations),
58 is_private_dep: false,
63 fn optgroups() -> getopts::Options {
64 let mut opts = getopts::Options::new();
65 for group in rustc_optgroups() {
66 (group.apply)(&mut opts);
71 fn mk_map<K: Ord, V>(entries: Vec<(K, V)>) -> BTreeMap<K, V> {
72 BTreeMap::from_iter(entries.into_iter())
75 // When the user supplies --test we should implicitly supply --cfg test
77 fn test_switch_implies_cfg_test() {
78 rustc_span::with_default_session_globals(|| {
79 let matches = optgroups().parse(&["--test".to_string()]).unwrap();
80 let (sess, cfg) = mk_session(matches);
81 let cfg = build_configuration(&sess, to_crate_config(cfg));
82 assert!(cfg.contains(&(sym::test, None)));
86 // When the user supplies --test and --cfg test, don't implicitly add another --cfg test
88 fn test_switch_implies_cfg_test_unless_cfg_test() {
89 rustc_span::with_default_session_globals(|| {
90 let matches = optgroups().parse(&["--test".to_string(), "--cfg=test".to_string()]).unwrap();
91 let (sess, cfg) = mk_session(matches);
92 let cfg = build_configuration(&sess, to_crate_config(cfg));
93 let mut test_items = cfg.iter().filter(|&&(name, _)| name == sym::test);
94 assert!(test_items.next().is_some());
95 assert!(test_items.next().is_none());
100 fn test_can_print_warnings() {
101 rustc_span::with_default_session_globals(|| {
102 let matches = optgroups().parse(&["-Awarnings".to_string()]).unwrap();
103 let (sess, _) = mk_session(matches);
104 assert!(!sess.diagnostic().can_emit_warnings());
107 rustc_span::with_default_session_globals(|| {
109 optgroups().parse(&["-Awarnings".to_string(), "-Dwarnings".to_string()]).unwrap();
110 let (sess, _) = mk_session(matches);
111 assert!(sess.diagnostic().can_emit_warnings());
114 rustc_span::with_default_session_globals(|| {
115 let matches = optgroups().parse(&["-Adead_code".to_string()]).unwrap();
116 let (sess, _) = mk_session(matches);
117 assert!(sess.diagnostic().can_emit_warnings());
122 fn test_output_types_tracking_hash_different_paths() {
123 let mut v1 = Options::default();
124 let mut v2 = Options::default();
125 let mut v3 = Options::default();
127 v1.output_types = OutputTypes::new(&[(OutputType::Exe, Some(PathBuf::from("./some/thing")))]);
128 v2.output_types = OutputTypes::new(&[(OutputType::Exe, Some(PathBuf::from("/some/thing")))]);
129 v3.output_types = OutputTypes::new(&[(OutputType::Exe, None)]);
131 assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
132 assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
133 assert!(v2.dep_tracking_hash() != v3.dep_tracking_hash());
136 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
137 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
138 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
142 fn test_output_types_tracking_hash_different_construction_order() {
143 let mut v1 = Options::default();
144 let mut v2 = Options::default();
146 v1.output_types = OutputTypes::new(&[
147 (OutputType::Exe, Some(PathBuf::from("./some/thing"))),
148 (OutputType::Bitcode, Some(PathBuf::from("./some/thing.bc"))),
151 v2.output_types = OutputTypes::new(&[
152 (OutputType::Bitcode, Some(PathBuf::from("./some/thing.bc"))),
153 (OutputType::Exe, Some(PathBuf::from("./some/thing"))),
156 assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());
159 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
163 fn test_externs_tracking_hash_different_construction_order() {
164 let mut v1 = Options::default();
165 let mut v2 = Options::default();
166 let mut v3 = Options::default();
168 v1.externs = Externs::new(mk_map(vec![
169 (String::from("a"), new_public_extern_entry(vec!["b", "c"])),
170 (String::from("d"), new_public_extern_entry(vec!["e", "f"])),
173 v2.externs = Externs::new(mk_map(vec![
174 (String::from("d"), new_public_extern_entry(vec!["e", "f"])),
175 (String::from("a"), new_public_extern_entry(vec!["b", "c"])),
178 v3.externs = Externs::new(mk_map(vec![
179 (String::from("a"), new_public_extern_entry(vec!["b", "c"])),
180 (String::from("d"), new_public_extern_entry(vec!["f", "e"])),
183 assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());
184 assert_eq!(v1.dep_tracking_hash(), v3.dep_tracking_hash());
185 assert_eq!(v2.dep_tracking_hash(), v3.dep_tracking_hash());
188 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
189 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
190 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
194 fn test_lints_tracking_hash_different_values() {
195 let mut v1 = Options::default();
196 let mut v2 = Options::default();
197 let mut v3 = Options::default();
200 (String::from("a"), Level::Allow),
201 (String::from("b"), Level::Warn),
202 (String::from("c"), Level::Deny),
203 (String::from("d"), Level::Forbid),
207 (String::from("a"), Level::Allow),
208 (String::from("b"), Level::Warn),
209 (String::from("X"), Level::Deny),
210 (String::from("d"), Level::Forbid),
214 (String::from("a"), Level::Allow),
215 (String::from("b"), Level::Warn),
216 (String::from("c"), Level::Forbid),
217 (String::from("d"), Level::Deny),
220 assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
221 assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
222 assert!(v2.dep_tracking_hash() != v3.dep_tracking_hash());
225 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
226 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
227 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
231 fn test_lints_tracking_hash_different_construction_order() {
232 let mut v1 = Options::default();
233 let mut v2 = Options::default();
236 (String::from("a"), Level::Allow),
237 (String::from("b"), Level::Warn),
238 (String::from("c"), Level::Deny),
239 (String::from("d"), Level::Forbid),
243 (String::from("a"), Level::Allow),
244 (String::from("c"), Level::Deny),
245 (String::from("b"), Level::Warn),
246 (String::from("d"), Level::Forbid),
249 assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());
252 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
253 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
257 fn test_search_paths_tracking_hash_different_order() {
258 let mut v1 = Options::default();
259 let mut v2 = Options::default();
260 let mut v3 = Options::default();
261 let mut v4 = Options::default();
263 const JSON: ErrorOutputType = ErrorOutputType::Json {
265 json_rendered: HumanReadableErrorType::Default(ColorConfig::Never),
269 v1.search_paths.push(SearchPath::from_cli_opt("native=abc", JSON));
270 v1.search_paths.push(SearchPath::from_cli_opt("crate=def", JSON));
271 v1.search_paths.push(SearchPath::from_cli_opt("dependency=ghi", JSON));
272 v1.search_paths.push(SearchPath::from_cli_opt("framework=jkl", JSON));
273 v1.search_paths.push(SearchPath::from_cli_opt("all=mno", JSON));
275 v2.search_paths.push(SearchPath::from_cli_opt("native=abc", JSON));
276 v2.search_paths.push(SearchPath::from_cli_opt("dependency=ghi", JSON));
277 v2.search_paths.push(SearchPath::from_cli_opt("crate=def", JSON));
278 v2.search_paths.push(SearchPath::from_cli_opt("framework=jkl", JSON));
279 v2.search_paths.push(SearchPath::from_cli_opt("all=mno", JSON));
281 v3.search_paths.push(SearchPath::from_cli_opt("crate=def", JSON));
282 v3.search_paths.push(SearchPath::from_cli_opt("framework=jkl", JSON));
283 v3.search_paths.push(SearchPath::from_cli_opt("native=abc", JSON));
284 v3.search_paths.push(SearchPath::from_cli_opt("dependency=ghi", JSON));
285 v3.search_paths.push(SearchPath::from_cli_opt("all=mno", JSON));
287 v4.search_paths.push(SearchPath::from_cli_opt("all=mno", JSON));
288 v4.search_paths.push(SearchPath::from_cli_opt("native=abc", JSON));
289 v4.search_paths.push(SearchPath::from_cli_opt("crate=def", JSON));
290 v4.search_paths.push(SearchPath::from_cli_opt("dependency=ghi", JSON));
291 v4.search_paths.push(SearchPath::from_cli_opt("framework=jkl", JSON));
293 assert!(v1.dep_tracking_hash() == v2.dep_tracking_hash());
294 assert!(v1.dep_tracking_hash() == v3.dep_tracking_hash());
295 assert!(v1.dep_tracking_hash() == v4.dep_tracking_hash());
298 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
299 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
300 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
301 assert_eq!(v4.dep_tracking_hash(), v4.clone().dep_tracking_hash());
305 fn test_native_libs_tracking_hash_different_values() {
306 let mut v1 = Options::default();
307 let mut v2 = Options::default();
308 let mut v3 = Options::default();
309 let mut v4 = Options::default();
313 (String::from("a"), None, NativeLibKind::StaticBundle),
314 (String::from("b"), None, NativeLibKind::Framework),
315 (String::from("c"), None, NativeLibKind::Unspecified),
320 (String::from("a"), None, NativeLibKind::StaticBundle),
321 (String::from("X"), None, NativeLibKind::Framework),
322 (String::from("c"), None, NativeLibKind::Unspecified),
327 (String::from("a"), None, NativeLibKind::StaticBundle),
328 (String::from("b"), None, NativeLibKind::StaticBundle),
329 (String::from("c"), None, NativeLibKind::Unspecified),
334 (String::from("a"), None, NativeLibKind::StaticBundle),
335 (String::from("b"), Some(String::from("X")), NativeLibKind::Framework),
336 (String::from("c"), None, NativeLibKind::Unspecified),
339 assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
340 assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
341 assert!(v1.dep_tracking_hash() != v4.dep_tracking_hash());
344 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
345 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
346 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
347 assert_eq!(v4.dep_tracking_hash(), v4.clone().dep_tracking_hash());
351 fn test_native_libs_tracking_hash_different_order() {
352 let mut v1 = Options::default();
353 let mut v2 = Options::default();
354 let mut v3 = Options::default();
358 (String::from("a"), None, NativeLibKind::StaticBundle),
359 (String::from("b"), None, NativeLibKind::Framework),
360 (String::from("c"), None, NativeLibKind::Unspecified),
364 (String::from("b"), None, NativeLibKind::Framework),
365 (String::from("a"), None, NativeLibKind::StaticBundle),
366 (String::from("c"), None, NativeLibKind::Unspecified),
370 (String::from("c"), None, NativeLibKind::Unspecified),
371 (String::from("a"), None, NativeLibKind::StaticBundle),
372 (String::from("b"), None, NativeLibKind::Framework),
375 assert!(v1.dep_tracking_hash() == v2.dep_tracking_hash());
376 assert!(v1.dep_tracking_hash() == v3.dep_tracking_hash());
377 assert!(v2.dep_tracking_hash() == v3.dep_tracking_hash());
380 assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
381 assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
382 assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
386 fn test_codegen_options_tracking_hash() {
387 let reference = Options::default();
388 let mut opts = Options::default();
390 macro_rules! untracked {
391 ($name: ident, $non_default_value: expr) => {
392 opts.cg.$name = $non_default_value;
393 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
397 // Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
398 // This list is in alphabetical order.
399 untracked!(ar, String::from("abc"));
400 untracked!(codegen_units, Some(42));
401 untracked!(default_linker_libraries, true);
402 untracked!(extra_filename, String::from("extra-filename"));
403 untracked!(incremental, Some(String::from("abc")));
404 // `link_arg` is omitted because it just forwards to `link_args`.
405 untracked!(link_args, vec![String::from("abc"), String::from("def")]);
406 untracked!(link_dead_code, Some(true));
407 untracked!(link_self_contained, Some(true));
408 untracked!(linker, Some(PathBuf::from("linker")));
409 untracked!(linker_flavor, Some(LinkerFlavor::Gcc));
410 untracked!(no_stack_check, true);
411 untracked!(remark, Passes::Some(vec![String::from("pass1"), String::from("pass2")]));
412 untracked!(rpath, true);
413 untracked!(save_temps, true);
415 macro_rules! tracked {
416 ($name: ident, $non_default_value: expr) => {
417 opts = reference.clone();
418 opts.cg.$name = $non_default_value;
419 assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
423 // Make sure that changing a [TRACKED] option changes the hash.
424 // This list is in alphabetical order.
425 tracked!(code_model, Some(CodeModel::Large));
426 tracked!(control_flow_guard, CFGuard::Checks);
427 tracked!(debug_assertions, Some(true));
428 tracked!(debuginfo, 0xdeadbeef);
429 tracked!(embed_bitcode, false);
430 tracked!(force_frame_pointers, Some(false));
431 tracked!(force_unwind_tables, Some(true));
432 tracked!(inline_threshold, Some(0xf007ba11));
433 tracked!(linker_plugin_lto, LinkerPluginLto::LinkerPluginAuto);
434 tracked!(llvm_args, vec![String::from("1"), String::from("2")]);
435 tracked!(lto, LtoCli::Fat);
436 tracked!(metadata, vec![String::from("A"), String::from("B")]);
437 tracked!(no_prepopulate_passes, true);
438 tracked!(no_redzone, Some(true));
439 tracked!(no_vectorize_loops, true);
440 tracked!(no_vectorize_slp, true);
441 tracked!(opt_level, "3".to_string());
442 tracked!(overflow_checks, Some(true));
443 tracked!(panic, Some(PanicStrategy::Abort));
444 tracked!(passes, vec![String::from("1"), String::from("2")]);
445 tracked!(prefer_dynamic, true);
446 tracked!(profile_generate, SwitchWithOptPath::Enabled(None));
447 tracked!(profile_use, Some(PathBuf::from("abc")));
448 tracked!(relocation_model, Some(RelocModel::Pic));
449 tracked!(soft_float, true);
450 tracked!(split_debuginfo, Some(SplitDebuginfo::Packed));
451 tracked!(target_cpu, Some(String::from("abc")));
452 tracked!(target_feature, String::from("all the features, all of them"));
456 fn test_debugging_options_tracking_hash() {
457 let reference = Options::default();
458 let mut opts = Options::default();
460 macro_rules! untracked {
461 ($name: ident, $non_default_value: expr) => {
462 opts.debugging_opts.$name = $non_default_value;
463 assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
467 // Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
468 // This list is in alphabetical order.
469 untracked!(ast_json, true);
470 untracked!(ast_json_noexpand, true);
471 untracked!(borrowck, String::from("other"));
472 untracked!(borrowck_stats, true);
473 untracked!(deduplicate_diagnostics, true);
474 untracked!(dep_tasks, true);
475 untracked!(dont_buffer_diagnostics, true);
476 untracked!(dump_dep_graph, true);
477 untracked!(dump_mir, Some(String::from("abc")));
478 untracked!(dump_mir_dataflow, true);
479 untracked!(dump_mir_dir, String::from("abc"));
480 untracked!(dump_mir_exclude_pass_number, true);
481 untracked!(dump_mir_graphviz, true);
482 untracked!(emit_future_incompat_report, true);
483 untracked!(emit_stack_sizes, true);
484 untracked!(hir_stats, true);
485 untracked!(identify_regions, true);
486 untracked!(incremental_ignore_spans, true);
487 untracked!(incremental_info, true);
488 untracked!(incremental_verify_ich, true);
489 untracked!(input_stats, true);
490 untracked!(keep_hygiene_data, true);
491 untracked!(link_native_libraries, false);
492 untracked!(llvm_time_trace, true);
493 untracked!(ls, true);
494 untracked!(macro_backtrace, true);
495 untracked!(meta_stats, true);
496 untracked!(nll_facts, true);
497 untracked!(no_analysis, true);
498 untracked!(no_interleave_lints, true);
499 untracked!(no_leak_check, true);
500 untracked!(no_parallel_llvm, true);
501 untracked!(parse_only, true);
502 untracked!(perf_stats, true);
503 // `pre_link_arg` is omitted because it just forwards to `pre_link_args`.
504 untracked!(pre_link_args, vec![String::from("abc"), String::from("def")]);
505 untracked!(print_link_args, true);
506 untracked!(print_llvm_passes, true);
507 untracked!(print_mono_items, Some(String::from("abc")));
508 untracked!(print_type_sizes, true);
509 untracked!(proc_macro_backtrace, true);
510 untracked!(query_dep_graph, true);
511 untracked!(query_stats, true);
512 untracked!(save_analysis, true);
513 untracked!(self_profile, SwitchWithOptPath::Enabled(None));
514 untracked!(self_profile_events, Some(vec![String::new()]));
515 untracked!(span_debug, true);
516 untracked!(span_free_formats, true);
517 untracked!(strip, Strip::None);
518 untracked!(terminal_width, Some(80));
519 untracked!(threads, 99);
520 untracked!(time, true);
521 untracked!(time_llvm_passes, true);
522 untracked!(time_passes, true);
523 untracked!(trace_macros, true);
524 untracked!(trim_diagnostic_paths, false);
525 untracked!(ui_testing, true);
526 untracked!(unpretty, Some("expanded".to_string()));
527 untracked!(unstable_options, true);
528 untracked!(validate_mir, true);
529 untracked!(verbose, true);
531 macro_rules! tracked {
532 ($name: ident, $non_default_value: expr) => {
533 opts = reference.clone();
534 opts.debugging_opts.$name = $non_default_value;
535 assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
539 // Make sure that changing a [TRACKED] option changes the hash.
540 // This list is in alphabetical order.
541 tracked!(allow_features, Some(vec![String::from("lang_items")]));
542 tracked!(always_encode_mir, true);
543 tracked!(assume_incomplete_release, true);
544 tracked!(asm_comments, true);
545 tracked!(binary_dep_depinfo, true);
546 tracked!(chalk, true);
547 tracked!(codegen_backend, Some("abc".to_string()));
548 tracked!(crate_attr, vec!["abc".to_string()]);
549 tracked!(debug_macros, true);
550 tracked!(dep_info_omit_d_target, true);
551 tracked!(dual_proc_macros, true);
552 tracked!(fewer_names, Some(true));
553 tracked!(force_overflow_checks, Some(true));
554 tracked!(force_unstable_if_unmarked, true);
555 tracked!(fuel, Some(("abc".to_string(), 99)));
556 tracked!(function_sections, Some(false));
557 tracked!(human_readable_cgu_names, true);
558 tracked!(inline_in_all_cgus, Some(true));
559 tracked!(inline_mir_threshold, 123);
560 tracked!(inline_mir_hint_threshold, 123);
561 tracked!(insert_sideeffect, true);
562 tracked!(instrument_coverage, true);
563 tracked!(instrument_mcount, true);
564 tracked!(link_only, true);
565 tracked!(merge_functions, Some(MergeFunctions::Disabled));
566 tracked!(mir_emit_retag, true);
567 tracked!(mir_opt_level, 3);
568 tracked!(mutable_noalias, true);
569 tracked!(new_llvm_pass_manager, true);
570 tracked!(no_codegen, true);
571 tracked!(no_generate_arange_section, true);
572 tracked!(no_link, true);
573 tracked!(no_profiler_runtime, true);
574 tracked!(osx_rpath_install_name, true);
575 tracked!(panic_abort_tests, true);
576 tracked!(plt, Some(true));
577 tracked!(polonius, true);
578 tracked!(precise_enum_drop_elaboration, false);
579 tracked!(print_fuel, Some("abc".to_string()));
580 tracked!(profile, true);
581 tracked!(profile_emit, Some(PathBuf::from("abc")));
582 tracked!(relax_elf_relocations, Some(true));
583 tracked!(relro_level, Some(RelroLevel::Full));
584 tracked!(report_delayed_bugs, true);
585 tracked!(sanitizer, SanitizerSet::ADDRESS);
586 tracked!(sanitizer_memory_track_origins, 2);
587 tracked!(sanitizer_recover, SanitizerSet::ADDRESS);
588 tracked!(saturating_float_casts, Some(true));
589 tracked!(share_generics, Some(true));
590 tracked!(show_span, Some(String::from("abc")));
591 tracked!(src_hash_algorithm, Some(SourceFileHashAlgorithm::Sha1));
592 tracked!(symbol_mangling_version, Some(SymbolManglingVersion::V0));
593 tracked!(teach, true);
594 tracked!(thinlto, Some(true));
595 tracked!(tune_cpu, Some(String::from("abc")));
596 tracked!(tls_model, Some(TlsModel::GeneralDynamic));
597 tracked!(trap_unreachable, Some(false));
598 tracked!(treat_err_as_bug, Some(1));
599 tracked!(unleash_the_miri_inside_of_you, true);
600 tracked!(use_ctors_section, Some(true));
601 tracked!(verify_llvm_ir, true);
602 tracked!(wasi_exec_model, Some(WasiExecModel::Reactor));
606 fn test_edition_parsing() {
607 // test default edition
608 let options = Options::default();
609 assert!(options.edition == DEFAULT_EDITION);
611 let matches = optgroups().parse(&["--edition=2018".to_string()]).unwrap();
612 let (sessopts, _) = build_session_options_and_crate_config(matches);
613 assert!(sessopts.edition == Edition::Edition2018)