]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_interface/src/tests.rs
use iter:: before free functions
[rust.git] / compiler / rustc_interface / src / tests.rs
1 use crate::interface::parse_cfgspecs;
2
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,
11 };
12 use rustc_session::lint::Level;
13 use rustc_session::search_paths::SearchPath;
14 use rustc_session::utils::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, TlsModel};
21 use std::collections::{BTreeMap, BTreeSet};
22 use std::iter::FromIterator;
23 use std::path::PathBuf;
24
25 type CfgSpecs = FxHashSet<(String, Option<String>)>;
26
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"));
30     (sessopts, cfg)
31 }
32
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(
37         sessopts,
38         None,
39         registry,
40         DiagnosticOutput::Default,
41         Default::default(),
42         None,
43     );
44     (sess, cfg)
45 }
46
47 fn new_public_extern_entry<S, I>(locations: I) -> ExternEntry
48 where
49     S: Into<String>,
50     I: IntoIterator<Item = S>,
51 {
52     let locations: BTreeSet<_> = locations.into_iter().map(|s| s.into()).collect();
53
54     ExternEntry {
55         location: ExternLocation::ExactPaths(locations),
56         is_private_dep: false,
57         add_prelude: true,
58     }
59 }
60
61 fn optgroups() -> getopts::Options {
62     let mut opts = getopts::Options::new();
63     for group in rustc_optgroups() {
64         (group.apply)(&mut opts);
65     }
66     return opts;
67 }
68
69 fn mk_map<K: Ord, V>(entries: Vec<(K, V)>) -> BTreeMap<K, V> {
70     BTreeMap::from_iter(entries.into_iter())
71 }
72
73 // When the user supplies --test we should implicitly supply --cfg test
74 #[test]
75 fn test_switch_implies_cfg_test() {
76     rustc_span::with_default_session_globals(|| {
77         let matches = optgroups().parse(&["--test".to_string()]).unwrap();
78         let (sess, cfg) = mk_session(matches);
79         let cfg = build_configuration(&sess, to_crate_config(cfg));
80         assert!(cfg.contains(&(sym::test, None)));
81     });
82 }
83
84 // When the user supplies --test and --cfg test, don't implicitly add another --cfg test
85 #[test]
86 fn test_switch_implies_cfg_test_unless_cfg_test() {
87     rustc_span::with_default_session_globals(|| {
88         let matches = optgroups().parse(&["--test".to_string(), "--cfg=test".to_string()]).unwrap();
89         let (sess, cfg) = mk_session(matches);
90         let cfg = build_configuration(&sess, to_crate_config(cfg));
91         let mut test_items = cfg.iter().filter(|&&(name, _)| name == sym::test);
92         assert!(test_items.next().is_some());
93         assert!(test_items.next().is_none());
94     });
95 }
96
97 #[test]
98 fn test_can_print_warnings() {
99     rustc_span::with_default_session_globals(|| {
100         let matches = optgroups().parse(&["-Awarnings".to_string()]).unwrap();
101         let (sess, _) = mk_session(matches);
102         assert!(!sess.diagnostic().can_emit_warnings());
103     });
104
105     rustc_span::with_default_session_globals(|| {
106         let matches =
107             optgroups().parse(&["-Awarnings".to_string(), "-Dwarnings".to_string()]).unwrap();
108         let (sess, _) = mk_session(matches);
109         assert!(sess.diagnostic().can_emit_warnings());
110     });
111
112     rustc_span::with_default_session_globals(|| {
113         let matches = optgroups().parse(&["-Adead_code".to_string()]).unwrap();
114         let (sess, _) = mk_session(matches);
115         assert!(sess.diagnostic().can_emit_warnings());
116     });
117 }
118
119 #[test]
120 fn test_output_types_tracking_hash_different_paths() {
121     let mut v1 = Options::default();
122     let mut v2 = Options::default();
123     let mut v3 = Options::default();
124
125     v1.output_types = OutputTypes::new(&[(OutputType::Exe, Some(PathBuf::from("./some/thing")))]);
126     v2.output_types = OutputTypes::new(&[(OutputType::Exe, Some(PathBuf::from("/some/thing")))]);
127     v3.output_types = OutputTypes::new(&[(OutputType::Exe, None)]);
128
129     assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
130     assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
131     assert!(v2.dep_tracking_hash() != v3.dep_tracking_hash());
132
133     // Check clone
134     assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
135     assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
136     assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
137 }
138
139 #[test]
140 fn test_output_types_tracking_hash_different_construction_order() {
141     let mut v1 = Options::default();
142     let mut v2 = Options::default();
143
144     v1.output_types = OutputTypes::new(&[
145         (OutputType::Exe, Some(PathBuf::from("./some/thing"))),
146         (OutputType::Bitcode, Some(PathBuf::from("./some/thing.bc"))),
147     ]);
148
149     v2.output_types = OutputTypes::new(&[
150         (OutputType::Bitcode, Some(PathBuf::from("./some/thing.bc"))),
151         (OutputType::Exe, Some(PathBuf::from("./some/thing"))),
152     ]);
153
154     assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());
155
156     // Check clone
157     assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
158 }
159
160 #[test]
161 fn test_externs_tracking_hash_different_construction_order() {
162     let mut v1 = Options::default();
163     let mut v2 = Options::default();
164     let mut v3 = Options::default();
165
166     v1.externs = Externs::new(mk_map(vec![
167         (String::from("a"), new_public_extern_entry(vec!["b", "c"])),
168         (String::from("d"), new_public_extern_entry(vec!["e", "f"])),
169     ]));
170
171     v2.externs = Externs::new(mk_map(vec![
172         (String::from("d"), new_public_extern_entry(vec!["e", "f"])),
173         (String::from("a"), new_public_extern_entry(vec!["b", "c"])),
174     ]));
175
176     v3.externs = Externs::new(mk_map(vec![
177         (String::from("a"), new_public_extern_entry(vec!["b", "c"])),
178         (String::from("d"), new_public_extern_entry(vec!["f", "e"])),
179     ]));
180
181     assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());
182     assert_eq!(v1.dep_tracking_hash(), v3.dep_tracking_hash());
183     assert_eq!(v2.dep_tracking_hash(), v3.dep_tracking_hash());
184
185     // Check clone
186     assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
187     assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
188     assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
189 }
190
191 #[test]
192 fn test_lints_tracking_hash_different_values() {
193     let mut v1 = Options::default();
194     let mut v2 = Options::default();
195     let mut v3 = Options::default();
196
197     v1.lint_opts = vec![
198         (String::from("a"), Level::Allow),
199         (String::from("b"), Level::Warn),
200         (String::from("c"), Level::Deny),
201         (String::from("d"), Level::Forbid),
202     ];
203
204     v2.lint_opts = vec![
205         (String::from("a"), Level::Allow),
206         (String::from("b"), Level::Warn),
207         (String::from("X"), Level::Deny),
208         (String::from("d"), Level::Forbid),
209     ];
210
211     v3.lint_opts = vec![
212         (String::from("a"), Level::Allow),
213         (String::from("b"), Level::Warn),
214         (String::from("c"), Level::Forbid),
215         (String::from("d"), Level::Deny),
216     ];
217
218     assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
219     assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
220     assert!(v2.dep_tracking_hash() != v3.dep_tracking_hash());
221
222     // Check clone
223     assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
224     assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
225     assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
226 }
227
228 #[test]
229 fn test_lints_tracking_hash_different_construction_order() {
230     let mut v1 = Options::default();
231     let mut v2 = Options::default();
232
233     v1.lint_opts = vec![
234         (String::from("a"), Level::Allow),
235         (String::from("b"), Level::Warn),
236         (String::from("c"), Level::Deny),
237         (String::from("d"), Level::Forbid),
238     ];
239
240     v2.lint_opts = vec![
241         (String::from("a"), Level::Allow),
242         (String::from("c"), Level::Deny),
243         (String::from("b"), Level::Warn),
244         (String::from("d"), Level::Forbid),
245     ];
246
247     assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());
248
249     // Check clone
250     assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
251     assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
252 }
253
254 #[test]
255 fn test_search_paths_tracking_hash_different_order() {
256     let mut v1 = Options::default();
257     let mut v2 = Options::default();
258     let mut v3 = Options::default();
259     let mut v4 = Options::default();
260
261     const JSON: ErrorOutputType = ErrorOutputType::Json {
262         pretty: false,
263         json_rendered: HumanReadableErrorType::Default(ColorConfig::Never),
264     };
265
266     // Reference
267     v1.search_paths.push(SearchPath::from_cli_opt("native=abc", JSON));
268     v1.search_paths.push(SearchPath::from_cli_opt("crate=def", JSON));
269     v1.search_paths.push(SearchPath::from_cli_opt("dependency=ghi", JSON));
270     v1.search_paths.push(SearchPath::from_cli_opt("framework=jkl", JSON));
271     v1.search_paths.push(SearchPath::from_cli_opt("all=mno", JSON));
272
273     v2.search_paths.push(SearchPath::from_cli_opt("native=abc", JSON));
274     v2.search_paths.push(SearchPath::from_cli_opt("dependency=ghi", JSON));
275     v2.search_paths.push(SearchPath::from_cli_opt("crate=def", JSON));
276     v2.search_paths.push(SearchPath::from_cli_opt("framework=jkl", JSON));
277     v2.search_paths.push(SearchPath::from_cli_opt("all=mno", JSON));
278
279     v3.search_paths.push(SearchPath::from_cli_opt("crate=def", JSON));
280     v3.search_paths.push(SearchPath::from_cli_opt("framework=jkl", JSON));
281     v3.search_paths.push(SearchPath::from_cli_opt("native=abc", JSON));
282     v3.search_paths.push(SearchPath::from_cli_opt("dependency=ghi", JSON));
283     v3.search_paths.push(SearchPath::from_cli_opt("all=mno", JSON));
284
285     v4.search_paths.push(SearchPath::from_cli_opt("all=mno", JSON));
286     v4.search_paths.push(SearchPath::from_cli_opt("native=abc", JSON));
287     v4.search_paths.push(SearchPath::from_cli_opt("crate=def", JSON));
288     v4.search_paths.push(SearchPath::from_cli_opt("dependency=ghi", JSON));
289     v4.search_paths.push(SearchPath::from_cli_opt("framework=jkl", JSON));
290
291     assert!(v1.dep_tracking_hash() == v2.dep_tracking_hash());
292     assert!(v1.dep_tracking_hash() == v3.dep_tracking_hash());
293     assert!(v1.dep_tracking_hash() == v4.dep_tracking_hash());
294
295     // Check clone
296     assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
297     assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
298     assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
299     assert_eq!(v4.dep_tracking_hash(), v4.clone().dep_tracking_hash());
300 }
301
302 #[test]
303 fn test_native_libs_tracking_hash_different_values() {
304     let mut v1 = Options::default();
305     let mut v2 = Options::default();
306     let mut v3 = Options::default();
307     let mut v4 = Options::default();
308
309     // Reference
310     v1.libs = vec![
311         (String::from("a"), None, NativeLibKind::StaticBundle),
312         (String::from("b"), None, NativeLibKind::Framework),
313         (String::from("c"), None, NativeLibKind::Unspecified),
314     ];
315
316     // Change label
317     v2.libs = vec![
318         (String::from("a"), None, NativeLibKind::StaticBundle),
319         (String::from("X"), None, NativeLibKind::Framework),
320         (String::from("c"), None, NativeLibKind::Unspecified),
321     ];
322
323     // Change kind
324     v3.libs = vec![
325         (String::from("a"), None, NativeLibKind::StaticBundle),
326         (String::from("b"), None, NativeLibKind::StaticBundle),
327         (String::from("c"), None, NativeLibKind::Unspecified),
328     ];
329
330     // Change new-name
331     v4.libs = vec![
332         (String::from("a"), None, NativeLibKind::StaticBundle),
333         (String::from("b"), Some(String::from("X")), NativeLibKind::Framework),
334         (String::from("c"), None, NativeLibKind::Unspecified),
335     ];
336
337     assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
338     assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
339     assert!(v1.dep_tracking_hash() != v4.dep_tracking_hash());
340
341     // Check clone
342     assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
343     assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
344     assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
345     assert_eq!(v4.dep_tracking_hash(), v4.clone().dep_tracking_hash());
346 }
347
348 #[test]
349 fn test_native_libs_tracking_hash_different_order() {
350     let mut v1 = Options::default();
351     let mut v2 = Options::default();
352     let mut v3 = Options::default();
353
354     // Reference
355     v1.libs = vec![
356         (String::from("a"), None, NativeLibKind::StaticBundle),
357         (String::from("b"), None, NativeLibKind::Framework),
358         (String::from("c"), None, NativeLibKind::Unspecified),
359     ];
360
361     v2.libs = vec![
362         (String::from("b"), None, NativeLibKind::Framework),
363         (String::from("a"), None, NativeLibKind::StaticBundle),
364         (String::from("c"), None, NativeLibKind::Unspecified),
365     ];
366
367     v3.libs = vec![
368         (String::from("c"), None, NativeLibKind::Unspecified),
369         (String::from("a"), None, NativeLibKind::StaticBundle),
370         (String::from("b"), None, NativeLibKind::Framework),
371     ];
372
373     assert!(v1.dep_tracking_hash() == v2.dep_tracking_hash());
374     assert!(v1.dep_tracking_hash() == v3.dep_tracking_hash());
375     assert!(v2.dep_tracking_hash() == v3.dep_tracking_hash());
376
377     // Check clone
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 }
382
383 #[test]
384 fn test_codegen_options_tracking_hash() {
385     let reference = Options::default();
386     let mut opts = Options::default();
387
388     macro_rules! untracked {
389         ($name: ident, $non_default_value: expr) => {
390             opts.cg.$name = $non_default_value;
391             assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
392         };
393     }
394
395     // Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
396     // This list is in alphabetical order.
397     untracked!(ar, String::from("abc"));
398     untracked!(codegen_units, Some(42));
399     untracked!(default_linker_libraries, true);
400     untracked!(extra_filename, String::from("extra-filename"));
401     untracked!(incremental, Some(String::from("abc")));
402     // `link_arg` is omitted because it just forwards to `link_args`.
403     untracked!(link_args, vec![String::from("abc"), String::from("def")]);
404     untracked!(link_dead_code, Some(true));
405     untracked!(link_self_contained, Some(true));
406     untracked!(linker, Some(PathBuf::from("linker")));
407     untracked!(linker_flavor, Some(LinkerFlavor::Gcc));
408     untracked!(no_stack_check, true);
409     untracked!(remark, Passes::Some(vec![String::from("pass1"), String::from("pass2")]));
410     untracked!(rpath, true);
411     untracked!(save_temps, true);
412
413     macro_rules! tracked {
414         ($name: ident, $non_default_value: expr) => {
415             opts = reference.clone();
416             opts.cg.$name = $non_default_value;
417             assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
418         };
419     }
420
421     // Make sure that changing a [TRACKED] option changes the hash.
422     // This list is in alphabetical order.
423     tracked!(code_model, Some(CodeModel::Large));
424     tracked!(control_flow_guard, CFGuard::Checks);
425     tracked!(debug_assertions, Some(true));
426     tracked!(debuginfo, 0xdeadbeef);
427     tracked!(embed_bitcode, false);
428     tracked!(force_frame_pointers, Some(false));
429     tracked!(force_unwind_tables, Some(true));
430     tracked!(inline_threshold, Some(0xf007ba11));
431     tracked!(linker_plugin_lto, LinkerPluginLto::LinkerPluginAuto);
432     tracked!(llvm_args, vec![String::from("1"), String::from("2")]);
433     tracked!(lto, LtoCli::Fat);
434     tracked!(metadata, vec![String::from("A"), String::from("B")]);
435     tracked!(no_prepopulate_passes, true);
436     tracked!(no_redzone, Some(true));
437     tracked!(no_vectorize_loops, true);
438     tracked!(no_vectorize_slp, true);
439     tracked!(opt_level, "3".to_string());
440     tracked!(overflow_checks, Some(true));
441     tracked!(panic, Some(PanicStrategy::Abort));
442     tracked!(passes, vec![String::from("1"), String::from("2")]);
443     tracked!(prefer_dynamic, true);
444     tracked!(profile_generate, SwitchWithOptPath::Enabled(None));
445     tracked!(profile_use, Some(PathBuf::from("abc")));
446     tracked!(relocation_model, Some(RelocModel::Pic));
447     tracked!(soft_float, true);
448     tracked!(target_cpu, Some(String::from("abc")));
449     tracked!(target_feature, String::from("all the features, all of them"));
450 }
451
452 #[test]
453 fn test_debugging_options_tracking_hash() {
454     let reference = Options::default();
455     let mut opts = Options::default();
456
457     macro_rules! untracked {
458         ($name: ident, $non_default_value: expr) => {
459             opts.debugging_opts.$name = $non_default_value;
460             assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
461         };
462     }
463
464     // Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
465     // This list is in alphabetical order.
466     untracked!(ast_json, true);
467     untracked!(ast_json_noexpand, true);
468     untracked!(borrowck, String::from("other"));
469     untracked!(borrowck_stats, true);
470     untracked!(deduplicate_diagnostics, true);
471     untracked!(dep_tasks, true);
472     untracked!(dont_buffer_diagnostics, true);
473     untracked!(dump_dep_graph, true);
474     untracked!(dump_mir, Some(String::from("abc")));
475     untracked!(dump_mir_dataflow, true);
476     untracked!(dump_mir_dir, String::from("abc"));
477     untracked!(dump_mir_exclude_pass_number, true);
478     untracked!(dump_mir_graphviz, true);
479     untracked!(emit_stack_sizes, true);
480     untracked!(hir_stats, true);
481     untracked!(identify_regions, true);
482     untracked!(incremental_ignore_spans, true);
483     untracked!(incremental_info, true);
484     untracked!(incremental_verify_ich, true);
485     untracked!(input_stats, true);
486     untracked!(keep_hygiene_data, true);
487     untracked!(link_native_libraries, false);
488     untracked!(llvm_time_trace, true);
489     untracked!(ls, true);
490     untracked!(macro_backtrace, true);
491     untracked!(meta_stats, true);
492     untracked!(nll_facts, true);
493     untracked!(no_analysis, true);
494     untracked!(no_interleave_lints, true);
495     untracked!(no_leak_check, true);
496     untracked!(no_parallel_llvm, true);
497     untracked!(parse_only, true);
498     untracked!(perf_stats, true);
499     untracked!(polonius, true);
500     // `pre_link_arg` is omitted because it just forwards to `pre_link_args`.
501     untracked!(pre_link_args, vec![String::from("abc"), String::from("def")]);
502     untracked!(print_link_args, true);
503     untracked!(print_llvm_passes, true);
504     untracked!(print_mono_items, Some(String::from("abc")));
505     untracked!(print_type_sizes, true);
506     untracked!(proc_macro_backtrace, true);
507     untracked!(query_dep_graph, true);
508     untracked!(query_stats, true);
509     untracked!(save_analysis, true);
510     untracked!(self_profile, SwitchWithOptPath::Enabled(None));
511     untracked!(self_profile_events, Some(vec![String::new()]));
512     untracked!(span_debug, true);
513     untracked!(span_free_formats, true);
514     untracked!(strip, Strip::None);
515     untracked!(terminal_width, Some(80));
516     untracked!(threads, 99);
517     untracked!(time, true);
518     untracked!(time_llvm_passes, true);
519     untracked!(time_passes, true);
520     untracked!(trace_macros, true);
521     untracked!(trim_diagnostic_paths, false);
522     untracked!(ui_testing, true);
523     untracked!(unpretty, Some("expanded".to_string()));
524     untracked!(unstable_options, true);
525     untracked!(validate_mir, true);
526     untracked!(verbose, true);
527
528     macro_rules! tracked {
529         ($name: ident, $non_default_value: expr) => {
530             opts = reference.clone();
531             opts.debugging_opts.$name = $non_default_value;
532             assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
533         };
534     }
535
536     // Make sure that changing a [TRACKED] option changes the hash.
537     // This list is in alphabetical order.
538     tracked!(allow_features, Some(vec![String::from("lang_items")]));
539     tracked!(always_encode_mir, true);
540     tracked!(asm_comments, true);
541     tracked!(binary_dep_depinfo, true);
542     tracked!(chalk, true);
543     tracked!(codegen_backend, Some("abc".to_string()));
544     tracked!(crate_attr, vec!["abc".to_string()]);
545     tracked!(debug_macros, true);
546     tracked!(dep_info_omit_d_target, true);
547     tracked!(dual_proc_macros, true);
548     tracked!(fewer_names, true);
549     tracked!(force_overflow_checks, Some(true));
550     tracked!(force_unstable_if_unmarked, true);
551     tracked!(fuel, Some(("abc".to_string(), 99)));
552     tracked!(human_readable_cgu_names, true);
553     tracked!(inline_in_all_cgus, Some(true));
554     tracked!(insert_sideeffect, true);
555     tracked!(instrument_coverage, true);
556     tracked!(instrument_mcount, true);
557     tracked!(link_only, true);
558     tracked!(merge_functions, Some(MergeFunctions::Disabled));
559     tracked!(mir_emit_retag, true);
560     tracked!(mir_opt_level, 3);
561     tracked!(mutable_noalias, true);
562     tracked!(new_llvm_pass_manager, true);
563     tracked!(no_codegen, true);
564     tracked!(no_generate_arange_section, true);
565     tracked!(no_link, true);
566     tracked!(no_profiler_runtime, true);
567     tracked!(osx_rpath_install_name, true);
568     tracked!(panic_abort_tests, true);
569     tracked!(plt, Some(true));
570     tracked!(print_fuel, Some("abc".to_string()));
571     tracked!(profile, true);
572     tracked!(profile_emit, Some(PathBuf::from("abc")));
573     tracked!(relro_level, Some(RelroLevel::Full));
574     tracked!(report_delayed_bugs, true);
575     tracked!(run_dsymutil, false);
576     tracked!(sanitizer, SanitizerSet::ADDRESS);
577     tracked!(sanitizer_memory_track_origins, 2);
578     tracked!(sanitizer_recover, SanitizerSet::ADDRESS);
579     tracked!(saturating_float_casts, Some(true));
580     tracked!(share_generics, Some(true));
581     tracked!(show_span, Some(String::from("abc")));
582     tracked!(src_hash_algorithm, Some(SourceFileHashAlgorithm::Sha1));
583     tracked!(symbol_mangling_version, SymbolManglingVersion::V0);
584     tracked!(teach, true);
585     tracked!(thinlto, Some(true));
586     tracked!(tls_model, Some(TlsModel::GeneralDynamic));
587     tracked!(treat_err_as_bug, Some(1));
588     tracked!(unleash_the_miri_inside_of_you, true);
589     tracked!(use_ctors_section, Some(true));
590     tracked!(verify_llvm_ir, true);
591 }
592
593 #[test]
594 fn test_edition_parsing() {
595     // test default edition
596     let options = Options::default();
597     assert!(options.edition == DEFAULT_EDITION);
598
599     let matches = optgroups().parse(&["--edition=2018".to_string()]).unwrap();
600     let (sessopts, _) = build_session_options_and_crate_config(matches);
601     assert!(sessopts.edition == Edition::Edition2018)
602 }