2016-12-06 16:40:42 -06:00
|
|
|
// This test case tests the incremental compilation hash (ICH) implementation
|
2017-11-12 18:20:22 -06:00
|
|
|
// for indexing expression.
|
2016-12-06 16:40:42 -06:00
|
|
|
|
|
|
|
// The general pattern followed here is: Change one thing between rev1 and rev2
|
|
|
|
// and make sure that the hash has changed, then change nothing between rev2 and
|
|
|
|
// rev3 and make sure that the hash has not changed.
|
|
|
|
|
2019-07-02 16:30:28 -05:00
|
|
|
// build-pass (FIXME(62277): could be check-pass?)
|
2021-04-22 14:33:16 -05:00
|
|
|
// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
|
|
|
|
// compile-flags: -Z query-dep-graph
|
|
|
|
// [cfail1]compile-flags: -Zincremental-ignore-spans
|
|
|
|
// [cfail2]compile-flags: -Zincremental-ignore-spans
|
|
|
|
// [cfail3]compile-flags: -Zincremental-ignore-spans
|
|
|
|
// [cfail4]compile-flags: -Zincremental-relative-spans
|
|
|
|
// [cfail5]compile-flags: -Zincremental-relative-spans
|
|
|
|
// [cfail6]compile-flags: -Zincremental-relative-spans
|
2016-12-06 16:40:42 -06:00
|
|
|
|
|
|
|
#![allow(warnings)]
|
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
#![crate_type="rlib"]
|
|
|
|
|
2019-08-19 16:31:46 -05:00
|
|
|
// Change simple index
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn change_simple_index(slice: &[u32]) -> u32 {
|
|
|
|
slice[3]
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-15 06:20:42 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
|
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn change_simple_index(slice: &[u32]) -> u32 {
|
|
|
|
slice[4]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-19 16:31:46 -05:00
|
|
|
// Change lower bound
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn change_lower_bound(slice: &[u32]) -> &[u32] {
|
|
|
|
&slice[3..5]
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-15 06:20:42 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
|
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn change_lower_bound(slice: &[u32]) -> &[u32] {
|
|
|
|
&slice[2..5]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-19 16:31:46 -05:00
|
|
|
// Change upper bound
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn change_upper_bound(slice: &[u32]) -> &[u32] {
|
|
|
|
&slice[3..5]
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-15 06:20:42 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
|
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn change_upper_bound(slice: &[u32]) -> &[u32] {
|
|
|
|
&slice[3..7]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-19 16:31:46 -05:00
|
|
|
// Add lower bound
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn add_lower_bound(slice: &[u32]) -> &[u32] {
|
2021-04-22 14:33:16 -05:00
|
|
|
&slice[ ..4]
|
2016-12-06 16:40:42 -06:00
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-15 06:20:42 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
|
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn add_lower_bound(slice: &[u32]) -> &[u32] {
|
|
|
|
&slice[3..4]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-19 16:31:46 -05:00
|
|
|
// Add upper bound
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn add_upper_bound(slice: &[u32]) -> &[u32] {
|
2021-04-22 14:33:16 -05:00
|
|
|
&slice[3.. ]
|
2016-12-06 16:40:42 -06:00
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-15 06:20:42 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
|
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn add_upper_bound(slice: &[u32]) -> &[u32] {
|
|
|
|
&slice[3..7]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-19 16:31:46 -05:00
|
|
|
// Change mutability
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn change_mutability(slice: &mut [u32]) -> u32 {
|
|
|
|
(&mut slice[3..5])[0]
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-15 06:20:42 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
|
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn change_mutability(slice: &mut [u32]) -> u32 {
|
2021-04-22 14:33:16 -05:00
|
|
|
(& slice[3..5])[0]
|
2016-12-06 16:40:42 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-19 16:31:46 -05:00
|
|
|
// Exclusive to inclusive range
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] {
|
2021-04-22 14:33:16 -05:00
|
|
|
&slice[3.. 7]
|
2016-12-06 16:40:42 -06:00
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2021-05-15 06:20:42 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
|
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-12-06 16:40:42 -06:00
|
|
|
fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] {
|
2017-09-19 00:40:04 -05:00
|
|
|
&slice[3..=7]
|
2016-12-06 16:40:42 -06:00
|
|
|
}
|