diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2017-10-26 16:21:37 +0200 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2017-10-26 16:23:31 +0200 |
| commit | 10ffff8bc6f073ffe1342ca3fef229cec0d98693 (patch) | |
| tree | 9ebd2815a6ee0a1412dfd8452c518f6c3171c6cc /src/test | |
| parent | eea916068cc0d0d5d39fc4b02c2c4c88ae9a9138 (diff) | |
| download | rust-10ffff8bc6f073ffe1342ca3fef229cec0d98693.tar.gz rust-10ffff8bc6f073ffe1342ca3fef229cec0d98693.zip | |
incr.comp.: Update overflow-check logic in HIR hashing.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/incremental/hashes/consts.rs | 46 | ||||
| -rw-r--r-- | src/test/incremental/hashes/statics.rs | 46 | ||||
| -rw-r--r-- | src/test/incremental/spans_significant_w_panic.rs | 30 |
3 files changed, 82 insertions, 40 deletions
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<u64> = 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<u16> = 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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; +} |
