From 10ffff8bc6f073ffe1342ca3fef229cec0d98693 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Thu, 26 Oct 2017 16:21:37 +0200 Subject: incr.comp.: Update overflow-check logic in HIR hashing. --- src/test/incremental/hashes/consts.rs | 46 +++++++++++++---------- src/test/incremental/hashes/statics.rs | 46 +++++++++++++---------- src/test/incremental/spans_significant_w_panic.rs | 30 +++++++++++++++ 3 files changed, 82 insertions(+), 40 deletions(-) create mode 100644 src/test/incremental/spans_significant_w_panic.rs (limited to 'src/test') diff --git a/src/test/incremental/hashes/consts.rs b/src/test/incremental/hashes/consts.rs index 35641e978b7..65acfb82da6 100644 --- a/src/test/incremental/hashes/consts.rs +++ b/src/test/incremental/hashes/consts.rs @@ -62,48 +62,54 @@ const CONST_CHANGE_TYPE_2: Option = None; // Change value between simple literals --------------------------------------- -#[cfg(cfail1)] -const CONST_CHANGE_VALUE_1: i16 = 1; - -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_clean(cfg="cfail3")] -const CONST_CHANGE_VALUE_1: i16 = 2; +const CONST_CHANGE_VALUE_1: i16 = { + #[cfg(cfail1)] + { 1 } + #[cfg(not(cfail1))] + { 2 } +}; -// Change value between expressions ------------------------------------------- -#[cfg(cfail1)] -const CONST_CHANGE_VALUE_2: i16 = 1 + 1; -#[cfg(not(cfail1))] +// Change value between expressions ------------------------------------------- #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_dirty(cfg="cfail2")] #[rustc_metadata_clean(cfg="cfail3")] -const CONST_CHANGE_VALUE_2: i16 = 1 + 2; - +const CONST_CHANGE_VALUE_2: i16 = { + #[cfg(cfail1)] + { 1 + 1 } -#[cfg(cfail1)] -const CONST_CHANGE_VALUE_3: i16 = 2 + 3; + #[cfg(not(cfail1))] + { 1 + 2 } +}; -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_dirty(cfg="cfail2")] #[rustc_metadata_clean(cfg="cfail3")] -const CONST_CHANGE_VALUE_3: i16 = 2 * 3; - +const CONST_CHANGE_VALUE_3: i16 = { + #[cfg(cfail1)] + { 2 + 3 } -#[cfg(cfail1)] -const CONST_CHANGE_VALUE_4: i16 = 1 + 2 * 3; + #[cfg(not(cfail1))] + { 2 * 3 } +}; -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_dirty(cfg="cfail2")] #[rustc_metadata_clean(cfg="cfail3")] -const CONST_CHANGE_VALUE_4: i16 = 1 + 2 * 4; +const CONST_CHANGE_VALUE_4: i16 = { + #[cfg(cfail1)] + { 1 + 2 * 3 } + + #[cfg(not(cfail1))] + { 1 + 2 * 4 } +}; // Change type indirectly ----------------------------------------------------- diff --git a/src/test/incremental/hashes/statics.rs b/src/test/incremental/hashes/statics.rs index 4ff80ead89d..7a4123190dd 100644 --- a/src/test/incremental/hashes/statics.rs +++ b/src/test/incremental/hashes/statics.rs @@ -115,49 +115,55 @@ static STATIC_CHANGE_TYPE_2: Option = None; // Change value between simple literals --------------------------------------- -#[cfg(cfail1)] -static STATIC_CHANGE_VALUE_1: i16 = 1; - -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_clean(cfg="cfail2")] #[rustc_metadata_clean(cfg="cfail3")] -static STATIC_CHANGE_VALUE_1: i16 = 2; +static STATIC_CHANGE_VALUE_1: i16 = { + #[cfg(cfail1)] + { 1 } + #[cfg(not(cfail1))] + { 2 } +}; -// Change value between expressions ------------------------------------------- -#[cfg(cfail1)] -static STATIC_CHANGE_VALUE_2: i16 = 1 + 1; -#[cfg(not(cfail1))] +// Change value between expressions ------------------------------------------- #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_clean(cfg="cfail2")] #[rustc_metadata_clean(cfg="cfail3")] -static STATIC_CHANGE_VALUE_2: i16 = 1 + 2; - +static STATIC_CHANGE_VALUE_2: i16 = { + #[cfg(cfail1)] + { 1 + 1 } -#[cfg(cfail1)] -static STATIC_CHANGE_VALUE_3: i16 = 2 + 3; + #[cfg(not(cfail1))] + { 1 + 2 } +}; -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_clean(cfg="cfail2")] #[rustc_metadata_clean(cfg="cfail3")] -static STATIC_CHANGE_VALUE_3: i16 = 2 * 3; - +static STATIC_CHANGE_VALUE_3: i16 = { + #[cfg(cfail1)] + { 2 + 3 } -#[cfg(cfail1)] -static STATIC_CHANGE_VALUE_4: i16 = 1 + 2 * 3; + #[cfg(not(cfail1))] + { 2 * 3 } +}; -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] #[rustc_metadata_clean(cfg="cfail2")] #[rustc_metadata_clean(cfg="cfail3")] -static STATIC_CHANGE_VALUE_4: i16 = 1 + 2 * 4; +static STATIC_CHANGE_VALUE_4: i16 = { + #[cfg(cfail1)] + { 1 + 2 * 3 } + + #[cfg(not(cfail1))] + { 1 + 2 * 4 } +}; // Change type indirectly ----------------------------------------------------- diff --git a/src/test/incremental/spans_significant_w_panic.rs b/src/test/incremental/spans_significant_w_panic.rs new file mode 100644 index 00000000000..c0bf35e781c --- /dev/null +++ b/src/test/incremental/spans_significant_w_panic.rs @@ -0,0 +1,30 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This test makes sure that just changing a definition's location in the +// source file also changes its incr. comp. hash, if debuginfo is enabled. + +// revisions:rpass1 rpass2 + +// compile-flags: -C overflow-checks=on + +#![feature(rustc_attrs)] + +#[cfg(rpass1)] +pub fn main() { + let _ = 0u8 + 1; +} + +#[cfg(rpass2)] +#[rustc_clean(label="Hir", cfg="rpass2")] +#[rustc_dirty(label="HirBody", cfg="rpass2")] +pub fn main() { + let _ = 0u8 + 1; +} -- cgit 1.4.1-3-g733a5