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