From 51142a0f5fd55d864c068759a7f0e00ab64f6e37 Mon Sep 17 00:00:00 2001 From: Jeremy Fitzhardinge Date: Wed, 14 Jul 2021 16:39:17 -0700 Subject: [PATCH] Make --cap-lints and related options leave crate hash alone Closes: #87144 --- compiler/rustc_interface/src/tests.rs | 22 ++++++++++++++++++---- compiler/rustc_session/src/options.rs | 6 +++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index a053253ec16e0..7e9a2c1312aac 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -236,9 +236,9 @@ fn test_lints_tracking_hash_different_values() { (String::from("d"), Level::Deny), ]; - assert_different_hash(&v1, &v2); - assert_different_hash(&v1, &v3); - assert_different_hash(&v2, &v3); + assert_non_crate_hash_different(&v1, &v2); + assert_non_crate_hash_different(&v1, &v3); + assert_non_crate_hash_different(&v2, &v3); } #[test] @@ -261,7 +261,21 @@ fn test_lints_tracking_hash_different_construction_order() { ]; // The hash should be order-dependent - assert_different_hash(&v1, &v2); + assert_non_crate_hash_different(&v1, &v2); +} + +#[test] +fn test_lint_cap_hash_different() { + let mut v1 = Options::default(); + let mut v2 = Options::default(); + let v3 = Options::default(); + + v1.lint_cap = Some(Level::Forbid); + v2.lint_cap = Some(Level::Allow); + + assert_non_crate_hash_different(&v1, &v2); + assert_non_crate_hash_different(&v1, &v3); + assert_non_crate_hash_different(&v2, &v3); } #[test] diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 4c40d0c367eca..5d4b32b2b9e3a 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -133,9 +133,9 @@ top_level_options!( /// can influence whether overflow checks are done or not. debug_assertions: bool [TRACKED], debuginfo: DebugInfo [TRACKED], - lint_opts: Vec<(String, lint::Level)> [TRACKED], - lint_cap: Option [TRACKED], - force_warns: Vec [TRACKED], + lint_opts: Vec<(String, lint::Level)> [TRACKED_NO_CRATE_HASH], + lint_cap: Option [TRACKED_NO_CRATE_HASH], + force_warns: Vec [TRACKED_NO_CRATE_HASH], describe_lints: bool [UNTRACKED], output_types: OutputTypes [TRACKED], search_paths: Vec [UNTRACKED],